« Back to channel list

#ruby - 28 April 2019

« Back 1 day Forward 1 day »
[00:06:54] skryking_: has joined #ruby
[00:22:39] fphilipe: has joined #ruby
[00:25:39] jelera: has joined #ruby
[00:56:07] weteamsteve1: has joined #ruby
[01:02:29] jottr: has joined #ruby
[01:04:14] dar123: has joined #ruby
[01:24:17] anesthesia: has joined #ruby
[01:29:47] anesthesia: has left #ruby: ("WeeChat 2.4")
[01:35:54] jenrzzz: has joined #ruby
[01:40:15] houhoulis: has joined #ruby
[02:30:21] laaron: has joined #ruby
[02:46:17] jelera: has joined #ruby
[02:47:05] jelera: has joined #ruby
[02:47:34] znz_jp: has joined #ruby
[02:47:49] jelera: has joined #ruby
[02:48:42] jelera: has joined #ruby
[02:49:24] jelera: has joined #ruby
[02:50:27] dviola: has joined #ruby
[02:53:06] fphilipe: has joined #ruby
[02:56:15] pupsikov: has joined #ruby
[03:03:37] jottr: has joined #ruby
[03:10:25] braincrash: has joined #ruby
[03:25:14] laaron: has joined #ruby
[03:37:48] gix: has joined #ruby
[03:39:00] sleetdrop: has joined #ruby
[03:42:34] laaron: has joined #ruby
[03:50:00] jenrzzz: has joined #ruby
[03:52:50] weteamsteve2: has joined #ruby
[03:55:06] fphilipe: has joined #ruby
[03:58:06] quarters: hello. I have a file "foo.txt" in the same folder as "foo.rb" where I have a line "foo = File.new("foo.txt","r")" but am getting an error saying that such a file doesn't exist. The documentation here https://ruby-doc.org/core-2.1.4/File.html#method-c-open doesn't really clarify for me.
[04:02:05] cow[moo]: has joined #ruby
[04:47:09] iMadper: has joined #ruby
[04:47:18] quarters: I found that I would need to check Dir.pwd
[04:47:25] ruby[bot]: has joined #ruby
[04:47:25] ChanServ: +o ruby[bot]
[04:48:04] quarters: I was wondering how to check whether or not a key in a hash starts with a particular string
[04:48:12] laaron: has joined #ruby
[04:48:45] suryc: has joined #ruby
[04:58:50] suryc: has left #ruby: ()
[05:04:46] jottr: has joined #ruby
[05:18:10] _whitelogger: has joined #ruby
[05:23:22] woodruffw: quarters: `find` and `find_all` both work on hashes: `foo.find_all { |k, _| k.start_with? "prefix" }` should work
[05:23:28] edwardly: has joined #ruby
[05:23:28] edwardly: has joined #ruby
[05:25:32] woodruffw: (you can use `to_h` to turn the result of `find_all` back into a hash`
[05:26:03] PuercoPop: has left #ruby: ("rcirc on GNU Emacs 26.1")
[05:26:52] woodruffw: alternatively, `filter`/`filter!` will work just fine and the latter will return the modified hash
[05:31:17] reber: has joined #ruby
[05:42:10] _whitelogger: has joined #ruby
[05:50:53] fphilipe: has joined #ruby
[05:55:15] jenrzzz: has joined #ruby
[05:59:27] afisher: has joined #ruby
[06:01:54] fanta1: has joined #ruby
[06:06:10] _whitelogger: has joined #ruby
[06:06:16] Mutsuhito: has joined #ruby
[06:09:16] mattwc: has joined #ruby
[06:10:16] ctp: has joined #ruby
[06:15:55] manveru: has joined #ruby
[06:17:09] hightower3: has joined #ruby
[06:17:55] Liothen: has joined #ruby
[06:18:10] _whitelogger: has joined #ruby
[06:18:41] pwillard: has joined #ruby
[06:18:50] tdy1: has joined #ruby
[06:23:07] Liothen: has joined #ruby
[06:23:42] hightower3: has joined #ruby
[06:25:53] ricekrispie2: has joined #ruby
[06:26:29] Liothen: has joined #ruby
[06:26:56] fphilipe: has joined #ruby
[06:43:27] dellavg_: has joined #ruby
[06:47:12] kapil____: has joined #ruby
[06:54:21] shtirlic: has joined #ruby
[06:57:18] shtirlic: has joined #ruby
[06:59:21] shtirlic: has joined #ruby
[07:05:58] shtirlic_: has joined #ruby
[07:06:34] Swyper: has joined #ruby
[07:13:16] sameerynho: has joined #ruby
[07:13:34] fphilipe: has joined #ruby
[07:30:10] _whitelogger: has joined #ruby
[07:32:26] laaron: has joined #ruby
[07:36:07] laaron: has joined #ruby
[07:44:03] ricekrispie: has joined #ruby
[08:14:01] fanta1: has joined #ruby
[08:20:02] queip: has joined #ruby
[08:22:47] waheedi: has joined #ruby
[08:34:01] dionysus69: has joined #ruby
[08:55:14] wildermind: has joined #ruby
[08:55:54] jenrzzz: has joined #ruby
[09:01:52] dionysus69: has joined #ruby
[09:04:12] jottr: has joined #ruby
[09:07:28] ricekrispie2: has joined #ruby
[09:18:09] _whitelogger: has joined #ruby
[09:27:26] TomyLobo: has joined #ruby
[09:28:42] jottr: has joined #ruby
[09:32:14] kyrylo: has joined #ruby
[09:36:24] jenrzzz: has joined #ruby
[09:39:55] shtirlic: has joined #ruby
[09:42:04] jottr: has joined #ruby
[09:43:16] jottr_: has joined #ruby
[09:45:53] jottr__: has joined #ruby
[09:49:42] jottr: has joined #ruby
[10:01:23] dsmythe: has joined #ruby
[10:04:21] jefffrails35: has joined #ruby
[10:17:07] laaron: has joined #ruby
[10:18:47] dsmythe: has joined #ruby
[10:26:16] Fernando-Basso: has joined #ruby
[10:32:21] laaron: has joined #ruby
[10:58:21] AJA4350: has joined #ruby
[10:58:27] dsmythe: has joined #ruby
[11:03:37] zleap: has joined #ruby
[11:03:37] zleap: has joined #ruby
[11:04:55] vyrus001: has joined #ruby
[11:12:32] ruby[bot]: Next question, please!
[11:13:47] Zarthus: you nailed that one, my friend
[11:28:34] jottr: has joined #ruby
[11:31:04] zleap: has left #ruby: ("WeeChat 1.6")
[11:31:34] zleap: has joined #ruby
[11:32:45] zleap: has left #ruby: ()
[11:40:18] zleap: has joined #ruby
[11:43:01] jenrzzz: has joined #ruby
[11:43:44] Azure: has joined #ruby
[11:48:31] dsmythe: has joined #ruby
[11:49:28] jottr: has joined #ruby
[12:03:22] BTRE: has joined #ruby
[12:10:23] jottr: has joined #ruby
[12:18:45] galaxie: has joined #ruby
[12:22:40] BTRE: has joined #ruby
[12:31:28] jottr: has joined #ruby
[12:34:33] fphilipe: has joined #ruby
[12:41:35] Dbugger: has joined #ruby
[12:41:42] BTRE: has joined #ruby
[12:43:03] jenrzzz: has joined #ruby
[12:51:46] nowhere_man: has joined #ruby
[12:52:12] jottr: has joined #ruby
[12:59:19] conta: has joined #ruby
[13:04:03] kyrylo: has joined #ruby
[13:13:12] jottr: has joined #ruby
[13:15:27] agent_white: has joined #ruby
[13:29:10] dsmythe: has joined #ruby
[13:34:06] jottr: has joined #ruby
[13:36:40] rippa: has joined #ruby
[13:46:05] jelera: has joined #ruby
[14:00:12] jelera: has joined #ruby
[14:00:41] jottr: has joined #ruby
[14:01:17] jelera: has joined #ruby
[14:01:50] jelera: has joined #ruby
[14:02:14] dsmythe: has joined #ruby
[14:02:35] jelera: has joined #ruby
[14:03:56] lypsis: has joined #ruby
[14:07:32] dionysus69: has joined #ruby
[14:10:31] lypsis: has joined #ruby
[14:14:11] lypsis: has joined #ruby
[14:19:13] lypsis: has joined #ruby
[14:21:00] lypsis: has joined #ruby
[14:21:23] marmotini_: has joined #ruby
[14:21:35] jottr: has joined #ruby
[14:23:00] marmotini_: has joined #ruby
[14:24:35] lypsis: has joined #ruby
[14:26:53] lypsis: has joined #ruby
[14:28:54] fphilipe: has joined #ruby
[14:35:49] nowhere_man: has joined #ruby
[14:42:31] jottr: has joined #ruby
[14:43:21] jenrzzz: has joined #ruby
[15:03:07] dsmythe: has joined #ruby
[15:03:26] jottr: has joined #ruby
[15:11:06] thebigj: has joined #ruby
[15:12:11] thebigj: I am trying to install "aruba" using gem, but it is failing with this traceback https://dpaste.de/qaVJ/raw
[15:12:24] thebigj: I am on Gentoo GNU/Linux distribution.
[15:12:32] thebigj: Ruby version is 2.4.0
[15:12:44] thebigj: I don't have any experience with Ruby.
[15:12:54] thebigj: Can anyone guide me about the error?
[15:14:34] phaul: it's rake24 not found, do you have rake? execute: which rake
[15:14:54] dar123: has joined #ruby
[15:15:18] thebigj: phaul: It is giving "/usr/bin/rake
[15:15:21] thebigj: * /usr/bin/rake
[15:15:30] thebigj: phaul: I think the rake is installed
[15:15:36] phaul: tryo ln -s /usr/bin/rake /usr/bin/rake24
[15:15:54] thebigj: phaul: okay. Trying
[15:16:28] phaul: and see where that takes you, this probably would be considered a hack by many, but.. if it works..
[15:20:03] nowhere_man: has joined #ruby
[15:20:08] thebigj: phaul: It worked!
[15:20:11] thebigj: phaul: Thanks :)
[15:24:24] jottr: has joined #ruby
[15:41:32] nowhereman: has joined #ruby
[15:49:42] RiPuk: has joined #ruby
[15:52:03] jottr: has joined #ruby
[15:52:13] dionysus69: has joined #ruby
[15:52:39] buckworst: has joined #ruby
[16:04:00] dsmythe: has joined #ruby
[16:12:58] jottr: has joined #ruby
[16:14:07] jelera: has joined #ruby
[16:15:25] laaron: has joined #ruby
[16:33:50] jottr: has joined #ruby
[16:35:02] donst: I have a ruby loop which reads from serial
[16:35:16] donst: and i want to expose "current status" to another machine
[16:35:45] donst: I thought of using TCPServer
[16:36:05] donst: but not sure how to keep both socket loop and serial loop work simultaneously
[16:36:08] donst: without breaking each other
[16:36:19] donst: is there a quick workaround?
[16:36:24] donst: I need to share only single variable
[16:36:27] weteamsteve: has joined #ruby
[16:36:51] donst: I guess if socket gets stuck on write, it will stall serial loop , right?
[16:38:24] strmpnk: Threads + a queue would work, alternatively IO.select.
[16:38:58] strmpnk: And if this is just a simple project, you could check out DRb, which might be easier than hand-rolling a TCP setup.
[16:39:59] donst: it's a really small ruby script with loop that reads and writes to serial
[16:40:19] dar123: has joined #ruby
[16:41:11] donst: unfortunately on the other side i'm going to catch it with node
[16:41:17] donst: so drb is no go
[16:41:27] strmpnk: I'd use a thread to do the TCP stuff then and a queue to shuttle commands to the socket then.
[16:42:56] Swyper: has joined #ruby
[16:43:46] jenrzzz: has joined #ruby
[16:46:34] suukim: has joined #ruby
[16:52:21] donst: strmpnk: would it pick up @variables if I follow this approach? https://stackoverflow.com/questions/25280521/ruby-http-server-in-separate-thread
[16:53:52] strmpnk: It could, it depends what lexical context you run the thread's block in.
[16:54:09] strmpnk: Better to not use instane variables for the interoperation though.
[16:54:46] jottr: has joined #ruby
[16:56:54] donst: strmpnk: heeey it works
[16:56:55] strmpnk: I'd create two objects, one that reads serial and the other which does TCP communication and provide a shared queue instance to the constructors of both. They could then run their own thread and use the queue. On the main thread I'd add a join method to both which calls Thread#join. This keeps the top-level clean and allows the classes to keep their own concerns with jus the queues for shuttling things between the two.
[16:57:29] donst: thank you!
[17:04:54] dsmythe: has joined #ruby
[17:06:26] waheedi: has joined #ruby
[17:13:27] tdy1: has joined #ruby
[17:19:29] fphilipe: has joined #ruby
[17:23:16] jottr: has joined #ruby
[17:42:25] kenichi: has joined #ruby
[17:42:46] Swyper: has joined #ruby
[17:50:09] Swyper_: has joined #ruby
[17:51:39] jottr: has joined #ruby
[18:05:43] dsmythe: has joined #ruby
[18:10:57] ivanskie: has joined #ruby
[18:12:33] jottr: has joined #ruby
[18:13:05] fphilipe: has joined #ruby
[18:21:32] hightower2: has joined #ruby
[18:28:48] marmotini_: has joined #ruby
[18:31:12] dellavg_: has joined #ruby
[18:31:26] dsmythe: has joined #ruby
[18:33:31] jottr: has joined #ruby
[18:33:32] jelera: has joined #ruby
[18:34:19] jelera: has joined #ruby
[18:35:04] jelera: has joined #ruby
[18:35:55] jelera: has joined #ruby
[18:36:41] jelera: has joined #ruby
[18:44:09] jenrzzz: has joined #ruby
[18:51:46] ivanskie: has joined #ruby
[18:56:39] jottr: has joined #ruby
[19:05:49] russellx: has joined #ruby
[19:07:13] fphilipe: has joined #ruby
[19:10:01] dsmythe: has joined #ruby
[19:17:29] jottr: has joined #ruby
[19:20:24] houhoulis: has joined #ruby
[19:34:36] comet23: has joined #ruby
[19:35:01] comet23: what's a good way to ensure that i will always iterate through an array without comparing to out of bounds "nil" comparisons?
[19:35:04] armyriad: has joined #ruby
[19:35:24] comet23: "comparison of integer with nil failed"
[19:37:19] m_antis: has joined #ruby
[19:47:33] nowhereman: has joined #ruby
[19:49:37] siaw23: has joined #ruby
[19:49:52] xco: has joined #ruby
[19:50:01] siaw23: has left #ruby: ()
[19:51:13] xco: I wrote a blog post I’d like to share. I’m new to blogging and so far I know if only two place I can share my blog post: reddit and http://www.rubyflow.com/ are there any Ruby groups online that I can share my blog with?
[19:54:25] jottr: has joined #ruby
[19:59:50] RiPuk: has joined #ruby
[20:01:17] orbyt_: has joined #ruby
[20:01:23] fphilipe: has joined #ruby
[20:04:54] lypsis: has joined #ruby
[20:08:18] suryc: has joined #ruby
[20:12:00] violentE: has joined #ruby
[20:15:23] jottr: has joined #ruby
[20:31:24] fphilipe: has joined #ruby
[20:31:47] dinfuehr_: has joined #ruby
[20:33:25] clemens3: has joined #ruby
[20:33:59] khalella: has joined #ruby
[20:36:19] jottr: has joined #ruby
[20:44:35] jenrzzz: has joined #ruby
[20:47:13] miah: nice little microblogging site about software dev
[20:57:14] jottr: has joined #ruby
[20:57:52] uranoss: has joined #ruby
[21:01:26] dar123: has joined #ruby
[21:03:37] prestorium: has joined #ruby
[21:14:37] ule: miah: neat
[21:23:51] ua_: has joined #ruby
[21:28:56] AndreYuhai: has joined #ruby
[21:31:58] AndreYuhai: Hello there, I have this example string "J & M AUTO BODY" that I need to add to my query string for making requests. But using CGI.escape or URI.escape does not work as expected. CGI.escape gives me "J+%26+M+AUTO+BODY", URI.escape gives me "J%20&%20M%20AUTO%20BODY". Is there a way to escape '&' instead of gsub and etc.?
[21:34:43] havenwood: AndreYuhai: what all do you want to escape beyond &?
[21:35:01] havenwood: &>> 'J & M AUTO BODY'.gsub('&') { '\&' }
[21:35:08] rubydoc: # => "J \\& M AUTO BODY" (https://carc.in/#/r/6sye)
[21:35:38] jottr: has joined #ruby
[21:38:28] AndreYuhai: havenwood: I just want to escape ampersand properly as it should be. & => %26
[21:38:55] AndreYuhai: I mean gsub works as well but I was wondering whether there is any other way.
[21:39:46] ur5us: has joined #ruby
[21:40:07] havenwood: &>> URI.escape 'J & M AUTO BODY', '&'
[21:40:08] rubydoc: # => "J %26 M AUTO BODY" (https://carc.in/#/r/6syf)
[21:40:25] havenwood: AndreYuhai: ^
[21:41:52] AndreYuhai: &>> URI.escape 'J & M AUTO BODY', '& '
[21:41:54] rubydoc: # => "J%20%26%20M%20AUTO%20BODY" (https://carc.in/#/r/6syg)
[21:42:20] AndreYuhai: havenwood: This worked as expected but I didn't know about that second parameter. Thanks I will check out the docs.
[21:44:01] jenrzzz: has joined #ruby
[21:51:13] weteamsteve: has joined #ruby
[21:51:17] ur5us: has joined #ruby
[21:59:42] jottr: has joined #ruby
[22:01:25] fphilipe: has joined #ruby
[22:01:32] dinfuehr: has joined #ruby
[22:18:51] m_antis: has joined #ruby
[22:20:34] jottr: has joined #ruby
[22:41:31] jottr: has joined #ruby
[22:46:23] clemens3: has joined #ruby
[22:55:03] lucasb: has joined #ruby
[22:55:57] jottr: has joined #ruby
[23:15:00] E3lit3h4XX0r666: has joined #ruby
[23:16:33] jelera: has joined #ruby
[23:17:35] RyanMcCoskrie: has joined #ruby
[23:18:00] queip: has joined #ruby
[23:19:20] Swyper: has joined #ruby
[23:21:50] Swyper: has joined #ruby
[23:23:03] jottr: has joined #ruby
[23:23:09] segy: has joined #ruby
[23:28:35] Swyper: has joined #ruby
[23:43:58] jottr: has joined #ruby
[23:47:09] agent_white: has joined #ruby
[23:50:45] landakram: has joined #ruby
[23:59:00] chaus: has joined #ruby