#ruby - 10 July 2017
« Back 1 day Forward 1 day »
[01:47:46] ule: Which criteria should I considerate in order to decide of creating instance variables @foo + attr_accessor instead of just passing variables via parameters to each function?
[05:44:30] GregUK: Hi, does anyone know if this issue with Hash#freeze is known? https://pastebin.com/yYeK6v42 (or maybe not an issue?)
[05:44:31] ruby[bot]: greg__: we in #ruby do not like pastebin.com, I reposted your paste to gist for you: https://gist.github.com/1114d76e421100e67c70cbc93d77fbbb
[05:44:32] ruby[bot]: greg__: pastebin.com loads slowly for most, has ads which are distracting and has terrible formatting.
[08:50:47] zsk: Hello, does anyone have any idea about why could I get the error: "`encode': wrong number of arguments (given 1, expected 0) (ArgumentError)" once I perform the command output_data.to_json ?
[09:16:28] jimhui: hello - need some help. I installed ruby following guide in gorails. I do bundle install and get this error: Your Ruby version is 2.4.0, but your Gemfile specified 2.2.2
[10:37:40] gokul_mr[m]: Are there good documentation on "When to create private methods in ruby?" or "Best practices on creating private methods"
[10:37:57] yorickpeterse: gokul_mr[m]: typically private methods are used as "helpers" for public methods
[10:38:39] yorickpeterse: mostly because more often than not those helper methods can be incredibly useful to expose, and because there isn't really any harm in doing it either
[10:39:35] yorickpeterse: I feel it also leads to weird API design. That is, you have a public API that depends on a whole bunch of private/custom APIs _instead_ of re-using other public APIs
[10:39:54] yorickpeterse: basically you're hiding useful things from the user, with no real good reason
[10:40:48] gokul_mr[m]: I guess Making it private to avoid writing tests would be a terrible idea :)
[10:47:41] ar1a: I want to make changes to my module and run it again, but i need to restart irb every time and require the file
[11:28:50] gokul_mr[m]: ar1a: I think what you need to do is `load 'file.rb'` when you change the file
[11:55:39] ruby[bot]: Francy: we in #ruby do not like pastebin.com, I reposted your paste to gist for you: https://gist.github.com/f4750194e97075954fb4a782f4f24e64
[11:55:39] ruby[bot]: Francy: pastebin.com loads slowly for most, has ads which are distracting and has terrible formatting.
[17:20:25] ornerymoose: Hello, I’m having an issue where sometimes (not always) there are double quotes at the beginning and end of my generated txt file using CSV.open: https://gist.github.com/ornerymoose/efe6edf111cbb0036d26fe6bc89e6fff What’s the best way to enforce that there will never be quotes at the beginning or end of the generated text file? Sample of some generated output: http://i.imgur.com/hXm1wm1.png
[17:24:11] unixygir1: Curious if rails questions are asked pretty frequently here or if we have a dedicated channel for rails related content? Thanks
[19:28:37] dobs: hi, how can i "puts" directly to the terminal in a portable way EVEN if stdout has been redirected to a file with ">file.txt" ? (e.g.: my_script.rb "blah" > "test.txt", show the output to the terminal)
[20:03:38] ged: Especially if they are diagnostic messages, that's what STDERR is for. Jesse Storimer has a good post on this: https://www.jstorimer.com/blogs/workingwithcode/7766119-when-to-use-stderr-instead-of-stdout
[22:08:04] drim: ill need to monkeypatch a private singleton method but cannot find the correct way of doing it