marz_d`ghostman

Activity Graph

Page 1 of 2 | Next »

2019-04-18

[09:13:54] marz_d`ghostman: has joined #ruby
[09:14:10] marz_d`ghostman: I have a string with \n in it. How do I get erb to parse that and display a new line?
[13:23:23] marz_d`ghostman: Ping timeout: 256 seconds

2019-04-11

[08:06:48] marz_d`ghostman: has joined #ruby
[08:07:48] marz_d`ghostman: In rails, it doesn't seem that running rails credentials:edit and saving it doesn't seem to be included when dockerizing it.
[08:08:02] marz_d`ghostman: How do I find the file so I can save it along in docker?
[09:52:09] marz_d`ghostman: Ping timeout: 256 seconds

2019-04-08

[18:49:04] marz_d`ghostman: has joined #ruby
[18:49:24] marz_d`ghostman: If I'm running rails with puma, which is the default, will I need nginx or apache?
[18:51:12] marz_d`ghostman: havenwood: so having rails server -e production would suffice?
[18:52:01] marz_d`ghostman: havenwood: Ah, I see what your saying now.
[18:59:13] marz_d`ghostman: havenwood: I agree, I'm currently running my rails app inside docker and setup nginx on this server
[18:59:33] marz_d`ghostman: havenwood: A real pain setting it up :)
[20:58:17] marz_d`ghostman: Quit: Page closed

2019-04-04

[08:38:02] marz_d`ghostman: has joined #ruby
[08:42:35] marz_d`ghostman: Ping timeout: 256 seconds

2019-03-29

[05:31:27] marz_d`ghostman: Quit: Page closed
[06:34:53] marz_d`ghostman: has joined #ruby
[06:35:24] marz_d`ghostman: Has anyone tried developing a video streaming web app via RTSP? WHat tech stack did you use?
[08:15:25] marz_d`ghostman: Ping timeout: 256 seconds

2019-03-28

[14:47:07] marz_d`ghostman: has joined #ruby

2019-03-26

[13:55:39] marz_d`ghostman: Quit: Page closed

2019-03-25

[00:06:07] marz_d`ghostman: has joined #ruby
[00:06:27] marz_d`ghostman: Anyone using the redis-rb gem? How do you display the actual command after getting an error?
[04:12:24] marz_d`ghostman: I have a hash whose key value pairs corresponds to an instance variables. How do I instantiate an object by iterating through a hash? e.g. https://gist.github.com/marzdgzmn/085808bc45267a9beafc9b11b4e92f14

2019-03-20

[06:10:19] marz_d`ghostman: has joined #ruby
[06:11:37] marz_d`ghostman: I'm working on an old rails project. Regarding this snippet https://gist.github.com/marzdgzmn/6b13cb8147c857d30f58b44c7a25497c Is this a ruby thing or a rails thing? Cause I'm testing it on irb and I'm getting an undefined method error
[15:15:25] marz_d`ghostman: Quit: Page closed

2019-03-18

[04:42:54] marz_d`ghostman: has joined #ruby
[04:43:16] marz_d`ghostman: When your app uses secret keys and stuff for api calls, where's the best place to put it? as environment variable on the system?
[04:46:29] marz_d`ghostman: havenwood: I'll take a look at encrypted credentials, thanks, I'm currently using environment variable by the way, was just wondering if there is a more secure way to do it :)
[06:30:33] marz_d`ghostman: Ping timeout: 256 seconds

2019-03-12

[04:19:13] marz_d`ghostman: has joined #elixir-lang
[05:03:14] marz_d`ghostman: Quit: Page closed

2019-03-11

[13:51:22] marz_d`ghostman: has joined #ruby
[13:51:35] marz_d`ghostman: Has anyone tried uploading files to google drive via cli using ruby?
[14:01:43] marz_d`ghostman: Bish: care to elaborate?
[14:01:58] marz_d`ghostman: Bish: that's a bit of a strong negative answer, hehe
[14:18:19] marz_d`ghostman: Bish: Hahaha, Sorry didn't get that sarcasm, was just wondering though if you've done it how you handle tokens? I mean like if you do a cron job running the scripts how do you obtain the token since you'll have to interact with the webpage
[17:09:30] marz_d`ghostman: Quit: Page closed

2019-02-26

[06:34:49] marz_d`ghostman: Ping timeout: 256 seconds

2019-02-20

[06:07:05] marz_d`ghostman: Ping timeout: 256 seconds
[07:51:41] marz_d`ghostman: has joined #ruby
[07:51:51] marz_d`ghostman: I'm working with numbers like 3.9855141693e+07, does ruby support it?
[07:52:10] marz_d`ghostman: I mean what type should I use to properly handle it
[17:06:09] marz_d`ghostman: How do I convert a number with exponential notation from BigDecimal to its original form? e.g. BigDecimal.new('1.6703200934e+08')
[17:10:29] marz_d`ghostman: al2o3-cr: It doesn't seem to convert it back to its original: 1.6703200934e+08
[17:14:04] marz_d`ghostman: al2o3-cr: can you tell me what these numbers are and this conversion process
[17:18:04] marz_d`ghostman: al2o3-cr: thanks a lot

2019-02-19

[03:54:08] marz_d`ghostman: has joined #ruby
[03:55:09] marz_d`ghostman: Anyone using Nokogiri, how do I extract a part of an xml file using the value like <cf>AVERAGE</cf><pdp_per_row>6</pdp_per_row>? I'd like to extract everyhing under that xml tags?
[04:01:59] marz_d`ghostman: mozzarella: https://termbin.com/atf1 I want to extract all data under <cf>AVERAGE</cf><pdp_per_row>6</pdp_per_row>. Is there a way I can filter other than using xml attributes?
[04:02:29] marz_d`ghostman: mozzarella: wrong link, this is the one: https://termbin.com/37wm
[04:16:51] marz_d`ghostman: mozzarella: yep, currently trying to do it via NOkogiri
[04:23:22] marz_d`ghostman: al2o3-cr: everything under <cf>AVERAGE</cf><pdp_per_row>6</pdp_pepr_row>.
[04:26:47] marz_d`ghostman: I'm trying out Nokogiri::XML::Node, I don't know what argument it's requiring with this 'name' and document. I'm getting `new': wrong argument type String (expected Data) (TypeError) https://gist.github.com/marzdgzmn/f3172fc544b5d9158250b764ecef8699
[04:31:32] marz_d`ghostman: al2o3-cr: Wow. I'll work on this one. Thanks
[04:35:24] marz_d`ghostman: We're trying to sort out a graph from rrd :)
[04:35:47] marz_d`ghostman: parsing xml using other languages is a pain, good thing I found out about Nokogiri :)
[04:50:44] marz_d`ghostman: al2o3-cr: mozzarella thanks guys

2019-02-18

[09:33:46] marz_d`ghostman: has joined #ruby
[09:33:56] marz_d`ghostman: anyone using rrd-ffi? do you know how to extract rra data?
[11:13:52] marz_d`ghostman: Quit: Page closed

2019-02-03

[02:43:05] marz_d`ghostman: Ping timeout: 256 seconds

2019-02-02

[12:26:09] marz_d`ghostman: has joined #ruby
[12:28:01] marz_d`ghostman: I'm running my ruby script via cron: scl enable rh-ruby24 /usr/bin/local/ruby_script. Is there a shortcut where it would read and use the ruby version and gemset of that script?
[12:28:14] marz_d`ghostman: Currently I'm getting an error running it unless I run it when i'm on the directory itself
[13:27:25] marz_d`ghostman: j416: it install in the directory itself, when the command to run the script is run via cron, it doesn't seem to use the gemset installed by bundler
[13:36:14] marz_d`ghostman: j416: Ah I just got that, let me try

2019-01-25

[14:50:29] marz_d`ghostman: Quit: Page closed

2019-01-24

[16:08:54] marz_d`ghostman: has joined #ruby
[16:08:59] marz_d`ghostman: anyone using concurrent-ruby gem here?
[16:09:24] marz_d`ghostman: How do you guys execute Futures in parallel? Concurrent::Promises.future(thread_pool) { Sync.run(mirror) }.rescue { |e| send_error_notification(mirror_name: mirror.name, error: e) }.result doesn't seem to work

2019-01-17

[05:59:26] marz_d`ghostman: has joined #ruby
[05:59:48] marz_d`ghostman: I have a script/app written in ruby running in a CentOS7 machine. Is there a utility where I can monitor the process and its subprocesses?
[06:00:31] marz_d`ghostman: The script/app creates a couple of rsync subprocess on a different thread via concurrent-ruby
[11:50:13] marz_d`ghostman: Quit: Page closed

2019-01-10

[09:41:53] marz_d`ghostman: has joined #ruby
[09:42:07] marz_d`ghostman: Why am I getting an error: mirror_manager.rb:74:in `block in <class:Manager>': undefined method `send_error_notification' for Rise::MirrorManager::Manager:Class (NoMethodError) for my code: https://termbin.com/denk
[09:42:54] marz_d`ghostman: I meant: https://termbin.com/xgp2
[09:54:20] marz_d`ghostman: phaul: It does, does it matter if it's private or not? I think I'm calling it inside the object context. Perhaps I'm wrong with this at_exit method
[10:01:03] marz_d`ghostman: I tried invoking the method directly via Rise::MirrorManager::Notification.send_slack_message, but it gives me the same error
[10:04:47] marz_d`ghostman: Ah, I made the module method as a class method via module_function so I can call it in class context
[17:15:19] marz_d`ghostman: Ping timeout: 256 seconds

2018-12-28

[07:04:05] marz_d`ghostman: Quit: Page closed
[09:48:27] marz_d`ghostman: has joined #ruby
[09:49:02] marz_d`ghostman: I've created a /config/initializers/production.rb & test.rb . . . to initialize things. However, how do I select which one should be included when I run it in production and test?
[10:08:34] marz_d`ghostman: Quit: Page closed

2018-12-27

[11:47:32] marz_d`ghostman: Quit: Page closed
[18:09:00] marz_d`ghostman: has joined #ruby
[18:09:30] marz_d`ghostman: I have my gems installed via bundle install --path .bundle on my project root directory. How do I run ruby so that it sees the gems?
[18:12:39] marz_d`ghostman: phaul: Ah, thanks. Also, how do I access instance methods inside at_exit blocks? I placed an at_exit block that I would like to email me if $ERROR_INFO
[18:17:23] marz_d`ghostman: phaul: https://gist.github.com/marzdgzmn/382217dc13aab3df2429d4fbf514eb66
[18:23:40] marz_d`ghostman: baweaver: What do you mean as a supervisor?
[18:42:50] marz_d`ghostman: phaul: It gets triggered via Manager.new.run though hence I'm inlcuding it to make it available as an intance method rather than a class metho
[18:43:18] marz_d`ghostman: phaul: thanks for the recommendation, I'll double check.

2018-12-26

[05:06:21] marz_d`ghostman: has joined #ruby
[06:27:49] marz_d`ghostman: How do I capture my thread's output and error? https://gist.github.com/marzdgzmn/dc6e8992a353ecf9ed2384b2cb987c3a When I manually run the class itself, the one that should be run on a different thread, it gives me errors. But if I run it on a different thread the errors/output doesn't come up
[12:59:56] marz_d`ghostman: What does catch(:halt) { yield } do? I know it catches the thrown :halt but what does the { yield } do? I don't see anywhere it's being used with a block passed to it
[13:00:03] marz_d`ghostman: https://github.com/sinatra/sinatra/blob/v1.4.6/lib/sinatra/base.rb#L1066
[14:05:13] marz_d`ghostman: tbuehlmann: Oh, I see, so the block is passed to invoke, thanks.
[15:04:13] marz_d`ghostman: Ping timeout: 256 seconds
[15:44:40] marz_d`ghostman: has joined #ruby
[15:44:53] marz_d`ghostman: Anyone using concurrent-ruby gem? How do I rescue exception from threads? thread_pool = Concurrent::FixedThreadPool.new(10, max_queue:50) until job_list.empty? job = job_list.shift Concurrent::Promises.future(executor: thread_pool) { MyJob.run(job) }. rescue{ |e| puts e }.result end
[15:45:05] marz_d`ghostman: Sorry, mispasted it, I meant: https://gist.github.com/marzdgzmn/37ef33a17716fae30db86446b4d8b769
[15:45:16] marz_d`ghostman: Doesn't seem to work
[15:56:03] marz_d`ghostman: I was missing the .result at the end though :)

2018-12-24

[07:25:52] marz_d`ghostman: I'm using a gem that has this line: output = `#{cmd} 2>&1` . But in my script I have redirected $stderr to a logger instance and I'm getting a uninitialized stream error. How do I fix this one so the 2>&1 will also get redirected to the logger?
[07:50:48] marz_d`ghostman: Quit: Page closed

2018-12-21

[13:14:18] marz_d`ghostman: Does Logger automatically capture stderr and stdout if you set it to FATAL?
[16:34:00] marz_d`ghostman: If a thread raises an error like TypeError: no implicit converison of nil into String, how do I capture it for logging?
[16:59:05] marz_d`ghostman: How do I capture errors from a thread. I tried: https://gist.github.com/marzdgzmn/da9c0eb69a6fa9647531e8ffbeecf2eb/edit. But it does't seem to work
[17:20:22] marz_d`ghostman: Can someone suggest a good article or book about threads in ruby like how to capture its stdout and stderr.

2018-12-20

[08:09:15] marz_d`ghostman: has joined #ruby
[08:09:50] marz_d`ghostman: Why is the job I'm passing in to concurrent-ruby doesn't seem to be registered. Tried to output completed_task_count but it's zero: https://gist.github.com/marzdgzmn/e42976cfd10a45690d29e751104d0f7a
[16:17:21] marz_d`ghostman: Ping timeout: 256 seconds
[17:47:35] marz_d`ghostman: has joined #ruby
[17:48:02] marz_d`ghostman: Why am I getting a ruby_executable_hooks: end of file reached (EOFError) when sending emails? https://gist.github.com/marzdgzmn/614969af17f74b3f6fdc2422d7c4cfae
[18:12:47] marz_d`ghostman: I have created two ruby files under /config/initializers. How do I run one when I'm testing and the other when I'm not testing?
[18:30:09] marz_d`ghostman: jordanm: I'm not using Rails though
[18:32:15] marz_d`ghostman: under /lib I have my main ruby file say main.rb then I require the initializer file under project/config/initializers/production.rb via require File.join(__dir__, '../../config/initializers/production) in main.rb
[18:33:03] marz_d`ghostman: the production.rb has this require line for Foo::Bar::Configuration but it doesn't seem to be able to find it though
[18:33:22] marz_d`ghostman: it says cannot load such file -- foo/bar/configuration
[18:35:22] marz_d`ghostman: Ohhh, I may need to add it to load_path

2018-12-19

[14:29:37] marz_d`ghostman: has joined #ruby
[14:29:58] marz_d`ghostman: Any good gem that would make testing concurrency easy? Currently using concurrent-ruby gem in my script
[22:05:23] marz_d`ghostman: Ping timeout: 256 seconds

2018-12-18

[09:08:40] marz_d`ghostman: has joined #ruby
[09:08:51] marz_d`ghostman: Is it possible to bundle a bin in your app not just gem?
[09:54:06] marz_d`ghostman: I've uninstalled a package from my OS and reinstalled it but it appears to have triggered something that causes a lot of warning now like /.bundle/ruby/2.4.0/gems/sqlite3-1.3.13/lib/sqlite3/sqlite3_native.so: warning: already initialized constant SQLite3::Constants::Open::READONLY
[09:54:09] marz_d`ghostman: How do I fix it?
[11:04:45] marz_d`ghostman: Ping timeout: 256 seconds

2018-12-17

[13:23:35] marz_d`ghostman: has joined #ruby
[13:57:25] marz_d`ghostman: I'm using the sqlite3 gem, Is it possible to like flush a statement so I could like create a table and then insert data in one SQLite3::Database.open?
[13:58:07] marz_d`ghostman: Like inside a SQLite3::Database.open(file) . .. I'm creating a table then pushing data. I'd like to push the creation of the table first. Is that possible though?
[14:01:41] marz_d`ghostman: darix: cause I when I do a get query, no records are returned, tried to manually query it via irb and sqlite3 on cli
[14:08:22] marz_d`ghostman: darix: So, I've created a initialize.rb to run first before my main script for database population: e21d499b15ddb9bf05e6030facdec7b8
[14:12:35] marz_d`ghostman: darix: what do you mean?
[14:17:28] marz_d`ghostman: darix: the INSERT line?
[14:18:07] marz_d`ghostman: darix: Oh I'm sorry: https://gist.github.com/marzdgzmn/e21d499b15ddb9bf05e6030facdec7b8
[14:19:14] marz_d`ghostman: darix: It doesn't trigger any error though
[14:20:12] marz_d`ghostman: darix: it run fine, but when my tests run it invokes an error because the inserted data aren't there. Tried to manually run a select query in `irb` and sqlite3 cli, and the records aren't there
[14:30:41] marz_d`ghostman: doesn't work on mine though, we have the same exact script. the tables are there but not the data
[15:01:34] marz_d`ghostman: darix: I'm not sure if it because of the versions, but db.commit semms to have fixed it
[15:01:41] marz_d`ghostman: db.commit before the inserts
[15:10:13] marz_d`ghostman: I'm using ruby 2.4 though, and I was wrong, it still isn't working lol
[15:35:05] marz_d`ghostman: darix: Tried running in in its own script, and it seems to work. But when I require it inside the spec_helper, it doesn't. Is there something in spec_helper or rspec that is conflicting with it?
[16:27:03] marz_d`ghostman: With sqlite3 gem, why does results_as_hash return {"pre_cmd_result"=>"Failed", 0=>"Failed"} two hashes for one result?
[16:45:57] marz_d`ghostman: Quit: Page closed

2018-12-14

[07:35:22] marz_d`ghostman: has joined #ruby
[07:37:00] marz_d`ghostman: Is using a class variable within a method a good practice? https://gist.github.com/marzdgzmn/da15a290e3ae436e69d18adf5f9bffd6
[08:07:51] marz_d`ghostman: havenwood: a constant inside a module? then I can refer to it in module methods included in an object . . . I'll try that
[08:11:37] marz_d`ghostman: havenwood: thanks
[08:17:41] marz_d`ghostman: is there a way I can refer to object on other modules in shorthand like I have two modules Foo::Bar::Configuration and Foo::Bar::Logging, I want to refer to the objects in COnfiguration from Logging.
[10:27:18] marz_d`ghostman: I'm testing a module and created a dummy class to include it. I'm getting an undefined method `update_result` method: https://gist.github.com/marzdgzmn/80c36df582ca10199a2b434cc343b676
[10:27:29] marz_d`ghostman: Tried printing the public_instance_methods, and it seems to be there though
[10:34:33] marz_d`ghostman: Ping timeout: 256 seconds

2018-12-13

[14:21:49] marz_d`ghostman: has joined #ruby
[14:26:55] marz_d`ghostman: What's the best practice when defining module variables so that I can refer to it in its methods? Am I doing this right? https://gist.github.com/marzdgzmn/c5f855eeb616c5ffff7801b99d91fdd7
[15:05:13] marz_d`ghostman: Iambchop: Even though @db will only be dealt with by the module methods?
[15:05:42] marz_d`ghostman: Iambchop: If so, can you recommend a good pattern on how to tackle this one.
[15:06:49] marz_d`ghostman: Please disregard my first question, I see that @db will not be reachable from the instance that included the module. :)
[16:34:29] marz_d`ghostman: Quit: Page closed

2018-12-12

[04:55:32] marz_d`ghostman: has joined #ruby
[04:58:27] marz_d`ghostman: Is it possible in ruby to add an attribute to OpenStruct in rspec without retaining it like only inside a context scope? https://gist.github.com/marzdgzmn/47f733d18bb8da5feac2c5db89f200ea
[05:15:33] marz_d`ghostman: smhuber: thanks. Is there any blocks I can put an `allow` statement to be shared with multiple `it`s?
[05:17:32] marz_d`ghostman: smhuber: so before blocks are local within context blocks eh?
[05:29:10] marz_d`ghostman: smhuber: Is there a book or a resource somewhere I can read to about these things? I didn't seem to ready any of it online
[05:35:09] marz_d`ghostman: smhuber: okay thanks mate. I appreciate it :)
[07:37:23] marz_d`ghostman: Ping timeout: 256 seconds
[11:32:20] marz_d`ghostman: has joined #ruby
[11:36:33] marz_d`ghostman: How do I temporarily override a variable inside a context? It seems that the `before` statement on line 98 is overriding the statement and making the succeeding tests fail as it should have the value 'true' when getting out of that context: https://gist.github.com/marzdgzmn/fe94064b777c084aa4ef0284f0a46290
[12:12:17] marz_d`ghostman: jhass: I understand before statements on the outer context gets executed first before the before statements in an inner context. However, is there like a mechanism where the overriding variable will be local to the inner context like defining a local block variable e.g. ;x?
[12:20:47] marz_d`ghostman: jhass: Uhhm, so like use let to define a new variable on every context? that was the next step I was thinking to do, just wondering if I can do it with a similar local block variable mechanism. Guess I got into it too deep though hehe
[12:31:14] marz_d`ghostman: jhass: So what I've though is to define a base object on the outer most via `let`. Then just extend that object and assign it to another variable via another `let` on inner context to preserve the base object for another inner context to use. Am I doing it right though?
[12:33:18] marz_d`ghostman: Okay, guess I'll just do that cause if I modify the variable defined by the outermost let in an inner context it seems to retain the modified value. Which seems to be what should be though now that I think of it :)
[12:37:58] marz_d`ghostman: jhass: So it would be something like this: https://gist.github.com/marzdgzmn/a4ecd1abdf985d300147d7d4848feeed?
[12:39:20] marz_d`ghostman: jhass: can you give me an example please
[12:57:20] marz_d`ghostman: jhass: thanks, kudos to the test. I'm still currently going through it :)
[12:59:56] marz_d`ghostman: jhass: what's --seed 0 or --order rand:123 for?
[13:04:03] marz_d`ghostman: I'm starting to understand it better now. So ruby evaluates the code like in two phases, once for none test-related stuff hence 'ABFJK', then second for the test-related stuff starting with the `before` statement going to the `it` while lazily evaluates any `let` definitions
[13:23:12] marz_d`ghostman: it still gives the same output though, am just gonna save this code for future reference, really appreciate you clearing me from my confusion mate. thanks

2018-12-02

[13:59:37] marz_d`ghostman: In Rspec when testing a module, like Rspec.describe Foo::Bar . . . why do I get an error with let(:bar) { Bar.new() }?
[14:02:07] marz_d`ghostman: peirama: I have let(:bar) { subject.new(args) }, but I'm getting an error saying wrong number of arguments(given 0,expected1) even if I'm passing in an argument
[14:31:47] marz_d`ghostman: Quit: Page closed

2018-12-01

[14:58:18] marz_d`ghostman: has joined #ruby
[14:58:58] marz_d`ghostman: I'm trying to test my Module methods(self.method) in rspec. However, I'm getting uninitialized constant error. How do I test it like Module::Module.method?
[16:37:42] marz_d`ghostman: phaul: https://gist.github.com/marzdgzmn/ad3e68c5a36cddaa13db3938d018d5b8 It's giving my uninitialized constant Rise::MirrorManager::Mirror
[16:46:00] marz_d`ghostman: phaul: When you require files in spec files, is the path relative to the file like you'll have to put ../../.. to reach the root dir then go inside the /lib directories where your .rb files are?
[16:56:23] marz_d`ghostman: phaul: thanks, I'll look into it
[20:03:45] marz_d`ghostman: Is it good practice to place a self.log on the top most module so that I can just call it anywhere whenever I want to log something?
[20:15:20] marz_d`ghostman: Is there a way to make sure a file gets run before anything else? Like I have a config/initializer/test.rb that popuplates config variables. I'd like that to run since the constant I'm declaring under a module is saying its nil since it depends on the config variables
[20:57:03] marz_d`ghostman: Is this considered elegant in ruby though? https://gist.github.com/marzdgzmn/9b5487ce460236f8d462cbc717a9b0f3

2018-11-28

[11:40:11] marz_d`ghostman: What design pattern can I use instead of declaring a global variable for logging?
[11:44:08] marz_d`ghostman: ah so you can just access it via MyApp::log
[11:44:39] marz_d`ghostman: oh right cause it's a class method
[11:45:26] marz_d`ghostman: Iwhat's the difference of :: and . then?
[11:50:57] marz_d`ghostman: By the way, if I have a Configuration module on my module MyApp, can I call the Configuration module directly or do I still have to prepend it with MyApp::Configuration?
[16:51:26] marz_d`ghostman: Quit: Page closed

2018-11-27

[16:09:45] marz_d`ghostman: has joined #ruby
[16:10:00] marz_d`ghostman: Isn't the 'with_options' available for activerecord in plain ruby? what's the alternative?
[16:14:54] marz_d`ghostman: is there an alternative to using orm for plain ruby?
[16:15:52] marz_d`ghostman: oh yea, I mean activerecord
[16:16:59] marz_d`ghostman: tbuehlmann: I'm trying to make this work
[16:17:00] marz_d`ghostman: http://termbin.com/oorf
[16:17:18] marz_d`ghostman: tbuehlmann: but it says with_options is an undefined method
[16:21:49] marz_d`ghostman: havenwood: Is there a module I can require to have it support everything including the stuff like allow_blank etc. etc.
[16:24:23] marz_d`ghostman: havenwood: thanks. So you leaning on sequel rather than activesupport?
[17:09:38] marz_d`ghostman: havenwood: Thanks mate

2018-11-26

[08:16:28] marz_d`ghostman: has joined #ruby
[12:56:06] marz_d`ghostman: Quit: Page closed

2018-11-22

[12:57:55] marz_d`ghostman: Quit: Page closed

2018-11-21

[06:52:27] marz_d`ghostman: Ping timeout: 256 seconds
[16:26:01] marz_d`ghostman: has joined #ruby
[16:44:44] marz_d`ghostman: is it good practice to create a singleton for database operation or create a module with a class instance for database?
[16:45:24] marz_d`ghostman: I just want to abstract it out so I could swap database all I have to do is modify the singleton class or module

2018-11-20

[04:44:15] marz_d`ghostman: has joined #ruby
[04:44:49] marz_d`ghostman: Is there an alternative for stub_const in rspec to override constants for the whole test? Like I have a constnat defined for the directory where logs are stored and I want to override that during tests
[04:54:07] marz_d`ghostman: baweaver: thanks, I'll look into it
[05:55:06] marz_d`ghostman: In plain ruby, how do I know if my script is being run in development/production/test(rspec)?
[06:01:44] marz_d`ghostman: baweaver: I created this config class:http://termbin.com/kj12 how do I populate different values based when it is run in production and in rspec though?
[06:04:00] marz_d`ghostman: Created a config/initializer/config.rb file in my project root to define the settings. e.g. App.configure do |config| log_dir = '/var/logs' end.
[06:04:07] marz_d`ghostman: but I want to set a different dir when testing
[06:04:31] marz_d`ghostman: Is there an environment variable set so I could define the corresponding values based on it is run on test or not?
[08:28:21] marz_d`ghostman: zenspider: How do you run a file like /config/initializer/test.rb in rspec_helper?
[09:00:03] marz_d`ghostman: Ping timeout: 256 seconds
[13:17:19] marz_d`ghostman: has joined #ruby
[13:18:15] marz_d`ghostman: I'm trying to test that a file is being created with File.open. However, I have two File.open statement in my script and the first File.open statement is handled first which will make my expect test fail. How do I bypass the first one
[13:40:25] marz_d`ghostman: I want to define a double and let it be the return value of a method. Like allow(SyncLog).to receive(:new).and_return(double()). How do I do it in a describe block scope instead of having to repeat it inside multiple "it".
[13:40:56] marz_d`ghostman: phaul: Oh, my script is conditional so I have to test that if this condition is met it creates the File. Thus, I'm testing if the File.open has been invoked
[13:43:46] marz_d`ghostman: phaul: I'll try the let blocks, thanks
[13:53:01] marz_d`ghostman: Ping timeout: 256 seconds
[14:20:28] marz_d`ghostman: has joined #ruby
[14:21:19] marz_d`ghostman: I'm testing every method call in isolation. So my first it block goes like it 'should create a new instance of logger' do expect(SyncLog).to receive(:new). How do I end the test with just that so that it won't continue to execute the script?

2018-11-19

[06:03:02] marz_d`ghostman: has joined #ruby
[07:20:29] marz_d`ghostman: I'm trying to test the format of logger, is there like a test specific stream I can use instead of a file?
[13:01:01] marz_d`ghostman: Iambchop: thanks I'll look into it
[13:02:42] marz_d`ghostman: Quit: Page closed

2018-11-17

[08:45:40] marz_d`ghostman: has joined #ruby
[08:47:24] marz_d`ghostman: Tried creating a config.rb on my project root to declare some application wide constants. The constants defined in it doesn't seem to be accessible by other parts of my application, specifically under /lib. https://gist.github.com/marzdgzmn/e59587818b0046c4b8911a58a5b5fce9
[08:59:42] marz_d`ghostman: How do I test File.open in rspec?
[09:02:59] marz_d`ghostman: Quit: Page closed