« Back to channel list

#ruby - 17 June 2019

« Back 1 day Forward 1 day »
[00:00:42] orbyt_: has joined #ruby
[00:02:35] doodlebug: has joined #ruby
[00:08:35] doodlebug: has joined #ruby
[00:12:16] bradleyprice: has joined #ruby
[00:14:36] doodlebug: has joined #ruby
[00:15:13] TheBetrayer: has joined #ruby
[00:20:36] doodlebug: has joined #ruby
[00:22:05] TheBetrayer: has joined #ruby
[00:26:36] doodlebug: has joined #ruby
[00:29:11] bambanx: has joined #ruby
[00:30:24] jenrzzz: has joined #ruby
[00:32:37] doodlebug: has joined #ruby
[00:35:39] dar123: has joined #ruby
[00:37:02] chromis: has left #ruby: ()
[00:37:52] dviola: has joined #ruby
[00:38:37] doodlebug: has joined #ruby
[00:44:37] doodlebug: has joined #ruby
[00:49:58] tdy: has joined #ruby
[00:50:37] doodlebug: has joined #ruby
[00:56:38] doodlebug: has joined #ruby
[01:02:37] doodlebug: has joined #ruby
[01:08:38] doodlebug: has joined #ruby
[01:14:38] doodlebug: has joined #ruby
[01:19:03] nolanv: has joined #ruby
[01:20:38] doodlebug: has joined #ruby
[01:24:21] doodlebug: has joined #ruby
[01:24:50] doodlebug: has joined #ruby
[01:25:20] doodlebug: has joined #ruby
[01:25:46] doodlebug: has joined #ruby
[01:26:17] doodlebug: has joined #ruby
[01:28:11] codefriar: has joined #ruby
[01:49:55] ur5us: has joined #ruby
[02:00:42] dviola: has joined #ruby
[02:20:22] skyikot: has joined #ruby
[02:27:51] ellcs: has joined #ruby
[02:29:48] fphilipe_: has joined #ruby
[02:34:33] chens: has joined #ruby
[02:57:21] tdy: has joined #ruby
[03:00:20] AJA4351: has joined #ruby
[03:10:38] braincrash: has joined #ruby
[03:21:41] jenrzzz: has joined #ruby
[03:27:52] sarink: has joined #ruby
[03:45:15] iffraff: has joined #ruby
[03:46:56] fphilipe_: has joined #ruby
[03:47:00] bradleyprice: has joined #ruby
[04:00:22] Freshnuts: has joined #ruby
[04:12:11] _whitelogger: has joined #ruby
[04:19:56] r3m: has joined #ruby
[04:25:05] Blue^NeXuS: has joined #ruby
[04:26:04] regedit: has joined #ruby
[04:30:12] _whitelogger: has joined #ruby
[04:34:21] Freshnuts: has joined #ruby
[04:36:12] doodlebug: has joined #ruby
[04:37:16] Freshnuts: has joined #ruby
[04:37:41] queip: has joined #ruby
[04:42:05] Blue^NeXuS: has joined #ruby
[04:42:12] doodlebug: has joined #ruby
[04:48:12] doodlebug: has joined #ruby
[05:00:32] Blue^NeXuS: has joined #ruby
[05:08:26] kyrylo: has joined #ruby
[05:10:39] duckpuppy: has joined #ruby
[05:11:14] bradleyprice: has joined #ruby
[05:11:50] bradleyprice: has joined #ruby
[05:13:15] kyrylo: has joined #ruby
[05:15:45] conta: has joined #ruby
[05:19:16] cthulchu: has joined #ruby
[05:22:00] jenrzzz: has joined #ruby
[05:23:51] skyikot: has joined #ruby
[05:30:13] doodlebug: has joined #ruby
[05:36:14] doodlebug: has joined #ruby
[05:39:03] jenrzzz: has joined #ruby
[05:42:14] doodlebug: has joined #ruby
[05:42:48] bradleyprice: has joined #ruby
[05:45:10] Paraxial: has joined #ruby
[05:45:59] salvor: has joined #ruby
[05:48:14] doodlebug: has joined #ruby
[05:54:14] doodlebug: has joined #ruby
[05:56:02] doodlebug: has joined #ruby
[05:56:30] doodlebug: has joined #ruby
[06:04:19] jenrzzz: has joined #ruby
[06:10:45] bradleyprice: has joined #ruby
[06:17:10] bradleyprice: has joined #ruby
[06:21:38] esrse: has joined #ruby
[06:31:03] andikr: has joined #ruby
[06:37:15] nnddcc: has joined #ruby
[06:40:06] nolanv: has joined #ruby
[06:49:00] aupadhye: has joined #ruby
[06:55:51] fphilipe_: has joined #ruby
[06:58:04] schne1der: has joined #ruby
[07:00:35] Tempesta: has joined #ruby
[07:01:17] jenrzzz: has joined #ruby
[07:06:52] bradleyprice: has joined #ruby
[07:11:53] cthulchu: has joined #ruby
[07:12:32] ellcs1: has joined #ruby
[07:14:00] drale2k_: has joined #ruby
[07:15:52] ua: has joined #ruby
[07:18:28] armyriad: has joined #ruby
[07:20:40] clemens3: has joined #ruby
[07:21:18] mayurvpatil: has joined #ruby
[07:21:53] mikecmpbll: has joined #ruby
[07:26:55] lxsameer: has joined #ruby
[07:38:58] Sneaker: has joined #ruby
[07:43:56] jefffrails35: has joined #ruby
[07:45:13] bradleyprice: has joined #ruby
[07:45:15] jenrzzz: has joined #ruby
[07:45:45] tranch: has joined #ruby
[07:52:51] tranch: has joined #ruby
[07:53:58] vondruch: has joined #ruby
[08:07:47] deepreds1: has joined #ruby
[08:15:03] conta: has joined #ruby
[08:24:23] staticx: has joined #ruby
[08:24:52] queip: has joined #ruby
[08:26:14] Freshnuts: has joined #ruby
[08:26:55] molly: has joined #ruby
[08:28:04] drale2k_: has joined #ruby
[08:32:35] themsay: has joined #ruby
[08:44:41] queip: has joined #ruby
[08:50:03] mayurvpatil: has joined #ruby
[08:50:45] drale2k_: has joined #ruby
[08:59:18] andikr: has joined #ruby
[09:02:16] jenrzzz: has joined #ruby
[09:07:43] jenrzzz: has joined #ruby
[09:13:19] drale2k_: has joined #ruby
[09:15:21] themsay: has joined #ruby
[09:19:46] queip: has joined #ruby
[09:19:58] jefffrails35_: has joined #ruby
[09:21:40] themsay: has joined #ruby
[09:32:48] dviola: has joined #ruby
[09:35:05] Aloy: has joined #ruby
[09:39:17] aupadhye: has joined #ruby
[09:41:14] themsay: has joined #ruby
[09:50:24] themsay: has joined #ruby
[09:51:27] jefffrails35: has joined #ruby
[09:59:18] jenrzzz: has joined #ruby
[10:20:19] drale2k_: has joined #ruby
[10:22:06] conta: has joined #ruby
[10:23:01] DTZUZO: has joined #ruby
[10:25:12] tranch: has joined #ruby
[10:33:04] Jonopoly: has joined #ruby
[10:39:19] conta: has joined #ruby
[10:42:08] morozovm: has joined #ruby
[11:10:13] doodlebug: has joined #ruby
[11:16:23] mayurvpatil: has joined #ruby
[11:17:40] AJA4350: has joined #ruby
[11:20:08] crankharder: has joined #ruby
[11:20:56] queip: has joined #ruby
[11:24:02] Swyper: has joined #ruby
[11:24:47] mcspud: has joined #ruby
[11:25:48] apparition: has joined #ruby
[11:26:29] Dysp: has joined #ruby
[11:27:09] Jonopoly: has joined #ruby
[11:34:08] doodlebug: has joined #ruby
[11:40:08] doodlebug: has joined #ruby
[11:46:07] doodlebug: has joined #ruby
[11:46:44] drale2k_: has joined #ruby
[11:52:08] doodlebug: has joined #ruby
[11:54:32] yasumi2136: has joined #ruby
[11:55:19] Cork: has joined #ruby
[11:58:08] doodlebug: has joined #ruby
[11:59:15] tranch: has joined #ruby
[11:59:36] jenrzzz: has joined #ruby
[12:00:55] reber: has joined #ruby
[12:04:08] doodlebug: has joined #ruby
[12:06:13] GarethAdams: has joined #ruby
[12:07:35] GarethAdams: has joined #ruby
[12:10:09] doodlebug: has joined #ruby
[12:13:02] regedit: has joined #ruby
[12:13:35] griffindy: has joined #ruby
[12:16:09] doodlebug: has joined #ruby
[12:19:03] AntoineLp: has joined #ruby
[12:21:55] al2o3-cr: &>> (1..10).map { |n| n.even? ? n * 2 : n }.sum / 2
[12:21:56] rubydoc: # => 42 (https://carc.in/#/r/731f)
[12:22:09] doodlebug: has joined #ruby
[12:22:32] al2o3-cr: it's quiet in here lately
[12:28:09] doodlebug: has joined #ruby
[12:33:10] _whitelogger: has joined #ruby
[12:34:09] doodlebug: has joined #ruby
[12:34:44] queip: has joined #ruby
[12:35:59] meinside: has joined #ruby
[12:38:29] aef: has joined #ruby
[12:39:12] haxx0r: has joined #ruby
[12:40:10] doodlebug: has joined #ruby
[12:46:09] doodlebug: has joined #ruby
[12:46:24] ellcs1: &>> 1 + 1
[12:46:25] rubydoc: # => 2 (https://carc.in/#/r/731g)
[12:48:31] donofrio: has joined #ruby
[12:52:09] doodlebug: has joined #ruby
[12:54:52] doodlebug: has joined #ruby
[12:55:20] doodlebug: has joined #ruby
[12:55:46] doodlebug: has joined #ruby
[12:56:16] doodlebug: has joined #ruby
[12:56:42] doodlebug: has joined #ruby
[12:57:11] doodlebug: has joined #ruby
[12:58:57] deathwishdave: has joined #ruby
[13:02:35] AntoineLp: has joined #ruby
[13:03:22] doodlebug: has joined #ruby
[13:03:42] doodlebug: has joined #ruby
[13:04:08] doodlebug: has joined #ruby
[13:04:11] kyrylo: has joined #ruby
[13:04:34] Iarfen: has joined #ruby
[13:04:39] doodlebug: has joined #ruby
[13:05:26] doodlebug: has joined #ruby
[13:08:31] doodlebug: has joined #ruby
[13:08:32] AntoineLp: has joined #ruby
[13:08:51] doodlebug: has joined #ruby
[13:09:11] doodlebug: has joined #ruby
[13:09:32] doodlebug: has joined #ruby
[13:09:58] doodlebug: has joined #ruby
[13:10:04] bradleyprice: has joined #ruby
[13:10:28] doodlebug: has joined #ruby
[13:10:58] doodlebug: has joined #ruby
[13:11:26] doodlebug: has joined #ruby
[13:11:29] jefffrails35: has joined #ruby
[13:11:55] doodlebug: has joined #ruby
[13:12:13] doodlebug: has joined #ruby
[13:12:33] doodlebug: has joined #ruby
[13:12:54] doodlebug: has joined #ruby
[13:14:40] doodlebug: has joined #ruby
[13:17:36] AntoineLp: has joined #ruby
[13:19:02] rubydoc: has joined #ruby
[13:19:18] CU_miles: has joined #ruby
[13:20:13] teclator: has joined #ruby
[13:20:23] ruby[bot]: Next question, please!
[13:21:16] lucasb: has joined #ruby
[13:26:13] SigizMG: has joined #ruby
[13:31:30] jcalla: has joined #ruby
[13:42:30] CU_miles: has left #ruby: ()
[13:49:34] doodlebug: has joined #ruby
[13:49:54] doodlebug: has joined #ruby
[13:50:14] doodlebug: has joined #ruby
[13:50:35] doodlebug: has joined #ruby
[13:51:00] doodlebug: has joined #ruby
[13:51:23] mayurvpatil: has joined #ruby
[13:51:26] doodlebug: has joined #ruby
[13:51:54] doodlebug: has joined #ruby
[13:52:22] doodlebug: has joined #ruby
[13:53:02] doodlebug: has joined #ruby
[13:53:22] doodlebug: has joined #ruby
[13:54:51] kyrylo: has joined #ruby
[13:55:52] NL3limin4t0r: has joined #ruby
[13:55:52] Inline: has joined #ruby
[13:58:10] conta: has joined #ruby
[13:58:10] BH23: has joined #ruby
[13:58:49] _joes_: has joined #ruby
[13:59:50] jenrzzz: has joined #ruby
[14:01:08] doodlebug: has joined #ruby
[14:04:55] Esa_: has joined #ruby
[14:07:08] doodlebug: has joined #ruby
[14:10:27] queip: has joined #ruby
[14:13:18] doodlebug: has joined #ruby
[14:14:46] Esa: has joined #ruby
[14:19:07] doodleb13: has joined #ruby
[14:19:39] gregf_: has joined #ruby
[14:20:40] jrafanie: has joined #ruby
[14:21:03] CCDelivery: has joined #ruby
[14:22:14] Esa_: has joined #ruby
[14:23:06] codefriar: has joined #ruby
[14:24:04] codefriar: has joined #ruby
[14:24:27] matheusmoreira: has joined #ruby
[14:29:32] clemens3: has joined #ruby
[14:38:26] bradleyprice: has joined #ruby
[14:38:49] doodlebug: has joined #ruby
[14:39:01] bradleyprice: has joined #ruby
[14:40:23] al2o3-cr: &>> (->(n){})::(?\")
[14:40:26] rubydoc: # => nil (https://carc.in/#/r/7322)
[14:40:34] bradleyprice: has joined #ruby
[14:41:04] kalib: has joined #ruby
[14:41:23] fphilipe_: has joined #ruby
[14:42:22] bradleyprice: has joined #ruby
[14:42:42] al2o3-cr: and 'n' is nosey bastards
[14:43:56] kalib: Hi everyone, I am still trying to learn Ruby and am a bit confused. I have this .rb file that works and one of the `def` that I have is responsible for checking from my list of servers and will return me a list of `missing_roles` IF any of my regions is without any servers based on a few parameters. How can I change that, so my return brings me `missing_roles` IF ny of my regions has less than 2 servers running with the given parameters?
[14:43:57] kalib: https://dpaste.de/05x0
[14:44:26] kalib: Any help would be appreciated since I am still lost with Ruby.. :/
[14:47:09] haxx0r: NoMethodError: undefined method `pseudo_bytes' for OpenSSL::Random:Module
[14:47:11] haxx0r: ruby 2.6.3
[14:48:15] tranch: has joined #ruby
[14:49:50] joshuacronemeyer: has joined #ruby
[14:50:36] yxhuvud: has joined #ruby
[14:55:08] jeremycw: has joined #ruby
[14:56:20] galaxie: has joined #ruby
[14:56:27] al2o3-cr: haxx0r: there's no pseudo_bytes method on OpenSSL::Random
[14:57:02] haxx0r: https://docs.ruby-lang.org/en/2.4.0/OpenSSL/Random.html
[14:57:49] haxx0r: https://github.com/sreekanthgs/bip_mnemonic/blob/5c74f8621e5696b65e6ad93071ef7beadcfc95c9/lib/bip_mnemonic.rb#L9
[14:58:09] haxx0r: here they call it and since this Gem seems to be used quite a bit, i wonder why it's failing for me
[14:58:56] haxx0r: wait, wrong line.
[15:01:51] tranch: has joined #ruby
[15:02:27] al2o3-cr: haxx0r: FUGAZI
[15:02:56] haxx0r: hm. i don't get ti. it's actually the LOC where the exception is coming
[15:03:21] geospeck: has joined #ruby
[15:03:46] haxx0r: BipMnemonic.to_mnemonic(bits: 128)
[15:04:04] rubydoc: parser error at position 0 around ` '
[15:04:17] haxx0r: so the LoC i linked is the one that is called. this is weired. especailly since ruby docs says there is method like that
[15:04:19] al2o3-cr: &list pseudo
[15:04:19] rubydoc: Found no entry that matches method pseudo
[15:04:39] al2o3-cr: &list pseudo_bytes
[15:04:39] rubydoc: OpenSSL::Random.pseudo_bytes
[15:05:08] haxx0r: yeah.... lol
[15:05:56] kalib: Anyone able to help with this? https://dpaste.de/05x0
[15:06:17] kalib: I have this .rb file that works and one of the `def` that I have is responsible for checking from my list of servers and will return me a list of `missing_roles` IF any of my regions is without any servers based on a few parameters. How can I change that, so my return brings me `missing_roles` IF ny of my regions has less than 2 servers running with the given parameters?
[15:10:29] al2o3-cr: haxx0r: ruby 2.4 +?
[15:10:45] haxx0r: yeah 2.6.3
[15:10:59] al2o3-cr: haxx0r: yeah it's gone
[15:11:25] haxx0r: so it only works on lower versions?
[15:12:39] deathwishdave: has joined #ruby
[15:13:07] al2o3-cr: &>> require 'openssl'; OpenSSL::Random.method(:pseudo_bytes)
[15:13:10] rubydoc: stderr: playpen: application terminated abnormally with signal 31 (Bad system call) (https://carc.in/#/r/732f)
[15:14:34] Wolland: has joined #ruby
[15:15:10] al2o3-cr: haxx0r: i think it was replaced with urandom
[15:15:44] dionysus69: has joined #ruby
[15:16:12] havenwood: kalib: We call the `def` thingies "methods."
[15:16:38] al2o3-cr: &>> require 'openssl'; OpenSSL::Random.singleton_methods
[15:16:39] rubydoc: stderr: playpen: application terminated abnormally with signal 31 (Bad system call) (https://carc.in/#/r/732i)
[15:17:14] kalib: havenwood: yes. ;] my bad for not saying methods.
[15:17:49] havenwood: kalib: you might even consider an auto-self-vivifying hash here (or whatever that's called)
[15:18:25] havenwood: kalib: i don't follow the "2 servers running" with parameters part
[15:19:39] TomyWork: has joined #ruby
[15:20:01] rippa: has joined #ruby
[15:21:54] kalib: havenwood: this is a method that I use to call from an api, which is used by my monitoring system. The way I have it now, (the code I showed there) makes my monitoring system alarm whenever I do not have at least one server for each of the specific roles I have on each region. Meaning, I should always have at least one server for each role on each region.
[15:22:22] kalib: The problem is, as you can imagine, once I get that alarm, is already too late, since it already means that I have a region without one of the server roles running there. So, I want to change it..
[15:23:04] kalib: to alert me once I have less than 2 server for that specific role on each region. Just so my monitoring system can get that result and alert me before I end up without servers for that role on that region.
[15:24:19] al2o3-cr: haxx0r: that is puzzling me!
[15:24:46] kalib: In short, fill the `missing_roles` not only when it finds an empty one, but when it finds any with less than 2 servers.
[15:24:47] haxx0r: it's weired
[15:24:51] haxx0r: some gems not working and nobody noticed
[15:25:31] dar123: has joined #ruby
[15:26:26] Wolland: Just out of curiosity, why would the server be missing or down in the first place?
[15:27:06] kalib: Exactly, it shouldn't.. but sometimes problems happens during deployments, and the server may end up not responding properly..
[15:28:16] kalib: that's exactly what I need to avoid. We usually have at least 3 of them for each of the regions, depending on how many clients we have there.. but would like to be alerted before I have no servers on that region.. :p
[15:28:52] al2o3-cr: haxx0r: just reading the source
[15:28:58] al2o3-cr: #if defined(HAVE_RAND_PSEUDO_BYTES)
[15:29:15] havenwood: &>> missing_roles = Hash.new { |h, k| h[k] = Hash.new &h.default_proc }; missing_roles[:a][:b][:c] = 42; missing_roles
[15:29:16] rubydoc: # => {:a=>{:b=>{:c=>42}}} (https://carc.in/#/r/732j)
[15:29:49] skyikot: has joined #ruby
[15:33:57] jrafanie_: has joined #ruby
[15:35:00] bradleyprice: has joined #ruby
[15:37:13] iffraff: has joined #ruby
[15:41:32] johnjoseph____: has joined #ruby
[15:42:40] bradleyprice: has joined #ruby
[15:43:39] kalib: havenwood: thanks for your help.. but I'm afraid I didn't understand what you sugested. I'll check if I find anyone in my team available. Thanks though.
[15:45:22] johnjoseph: has joined #ruby
[15:46:23] johnjoseph: has joined #ruby
[15:49:10] AntoineLp: has joined #ruby
[15:51:48] codefriar: has joined #ruby
[15:54:54] solars: has joined #ruby
[15:55:39] orbyt_: has joined #ruby
[15:57:14] englishm: has joined #ruby
[15:58:35] doodlebug: has joined #ruby
[16:01:06] NL3limin4t0r: kalib: What variable name correspond to what you call "servers". There is no mention of any "server" in your code sample. Since you're adding the `role` to the `regions` array can I assume that's what you mean?
[16:01:25] charon77: has joined #ruby
[16:02:22] Wolland: has joined #ruby
[16:03:54] kalib: NL3limin4t0r: I found what I am looking for in my models, under server.rb. ;]
[16:04:16] mnemon: has joined #ruby
[16:04:35] doodlebug: has joined #ruby
[16:05:24] joshuacronemeyer: has joined #ruby
[16:10:37] doodlebug: has joined #ruby
[16:11:49] al2o3-cr: &>> class X def initialize(x) @x = x end end; X.new(42).instance_exec(99) { |n| @x = n << 1}
[16:11:50] rubydoc: # => 198 (https://carc.in/#/r/732p)
[16:15:36] al2o3-cr: no one going to find, a fine language like ruby!
[16:21:43] tranch: has joined #ruby
[16:25:30] deepredsky: has joined #ruby
[16:30:56] w1zeman1p: has left #ruby: ()
[16:31:12] tranch: has joined #ruby
[16:31:59] bradleyprice: has joined #ruby
[16:34:41] doodlebug: has joined #ruby
[16:34:42] bradleyprice: has joined #ruby
[16:35:11] agent_white: has joined #ruby
[16:36:18] cschneid: has joined #ruby
[16:37:08] queip: has joined #ruby
[16:47:41] jeremycw: has joined #ruby
[16:51:46] Wolland: has joined #ruby
[16:53:26] orbyt_: has joined #ruby
[17:00:13] duderonomy: has joined #ruby
[17:03:33] cschneid: has joined #ruby
[17:03:56] dar123: has joined #ruby
[17:07:26] ebbflowgo: has joined #ruby
[17:11:50] sameerynho: has joined #ruby
[17:13:15] duderonomy: has joined #ruby
[17:14:54] orbyt_: has joined #ruby
[17:24:29] Eiam: has joined #ruby
[17:27:18] orbyt_: has joined #ruby
[17:30:16] fphilipe_: has joined #ruby
[17:30:52] NL3limin4t0r: &>> require 'ostruct'; module Enumerable; def _map(&block); map { |obj| obj.instance_eval(&block) }; end; end; [{name: 'Jarmen Kell', age: 36}, {name: 'Black Lotus', age: 25}, {name: 'Colonel Burton', age: 29}].map(&OpenStruct.method(:new))._map{ "#{name} is #{age} years old"}
[17:30:53] rubydoc: # => ["Jarmen Kell is 36 years old", "Black Lotus is 25 years old", "Colonel Burton is 29 years old"] (https://carc.in/#/r/7331)
[17:40:53] s3nd1v0g1us: has joined #ruby
[17:42:09] hiroaki: has joined #ruby
[17:46:02] duderonomy: has joined #ruby
[17:55:30] lucasb: has joined #ruby
[17:57:26] tdy: has joined #ruby
[18:04:01] Dbugger: has joined #ruby
[18:06:00] Exuma: has joined #ruby
[18:07:11] bradleyprice: has joined #ruby
[18:07:46] Exuma: if i do an early return in a function simply by saying "return"
[18:07:49] Exuma: is that returning true or false
[18:08:01] havenwood: Exuma: it's returning `nil`, which is falsey
[18:08:07] Exuma: havenwood ok thank you
[18:08:21] havenwood: &>> def Exuma; return end; Exuma
[18:08:22] rubydoc: stderr: -e:2:in `<main>': uninitialized constant Exuma (NameError) (https://carc.in/#/r/733g)
[18:08:41] Exuma: &>> def exuma; return end; exuma
[18:08:42] rubydoc: # => nil (https://carc.in/#/r/733h)
[18:08:44] Exuma: interesting
[18:09:49] Exuma: &>> def exuma; return end; exuma()
[18:09:55] rubydoc: # => nil (https://carc.in/#/r/733i)
[18:10:37] havenwood: Exuma: In the lowercase version, you're right to omit the parens! With an uppercase method (fairly rare), you need parens to disambiguate.
[18:10:50] Exuma: i didnt know methods could even be capitalized
[18:11:44] havenwood: &>> defined? Integer()
[18:11:50] rubydoc: # => "method" (https://carc.in/#/r/733j)
[18:11:58] havenwood: &>> method(:Integer).owner
[18:11:59] rubydoc: # => Kernel (https://carc.in/#/r/733k)
[18:12:20] havenwood: &>> module Kernel; def OK; :ok end end; OK()
[18:12:25] rubydoc: # => :ok (https://carc.in/#/r/733l)
[18:13:40] Exuma: ah, i suppose i did as i use BigDecimal
[18:13:48] Exuma: BigDecimal('100')
[18:13:55] Exuma: ============* the more you know
[18:14:52] havenwood: &>> require 'bigdecimal'; require 'bigdecimal/util'; '100'.to_d
[18:14:53] rubydoc: # => 0.1e3 (https://carc.in/#/r/733m)
[18:18:54] themsay: has joined #ruby
[18:22:24] AJA4350: has joined #ruby
[18:23:41] schne1der: has joined #ruby
[18:26:21] podman: has joined #ruby
[18:27:06] discopatrick: has joined #ruby
[18:28:20] kapilp: has joined #ruby
[18:32:54] GarethAdams: has joined #ruby
[18:39:51] queip: has joined #ruby
[18:44:16] GodFather: has joined #ruby
[18:49:09] fphilipe_: has joined #ruby
[18:50:48] bradleyprice: has joined #ruby
[18:50:59] skyikot: has joined #ruby
[18:59:37] orbyt_: has joined #ruby
[19:05:36] reber_: has joined #ruby
[19:07:27] bradleyprice: has joined #ruby
[19:07:54] bradleyprice: has joined #ruby
[19:11:28] themsay: has joined #ruby
[19:34:51] bradleyprice: has joined #ruby
[19:35:17] bradleyprice: has joined #ruby
[19:35:56] violentE: has joined #ruby
[19:40:20] Exuma: has joined #ruby
[19:51:17] bradleyprice: has joined #ruby
[19:54:57] xco: has joined #ruby
[19:56:37] xco: Hi is there a way i can have this %w(Some Brand Ferrari Toyota) come out as an array of [“Some Branhd”, “Ferrari”, “Toyota”]?
[19:57:02] xco: I believe I saw a method about a week ago but can’t remember if it’s from rails or Ruby itself
[19:59:24] adam12: xco: Pretty sure the %w sigil splits on whitespace, so "Some Brand" as an array element would be impossible. I might be wrong.
[19:59:50] adam12: xco: Rather, it _only_ splits on whitespace. It definitely does split on whitespace.
[20:00:43] rainer_tm: has joined #ruby
[20:02:02] xco: i think there’s an option to split (with some arg) to achieve that
[20:02:06] xco: i blieve i saw that somewhere
[20:02:08] xco: i’m looking
[20:09:08] bradleyprice: has joined #ruby
[20:09:44] xco: adam12: this is what i was looking for
[20:09:44] xco: "Toyota Ferrari Aston Marton".split(' ',3)
[20:09:57] xco: => ["Toyota", "Ferrari", "Aston Marton"]
[20:11:14] AJA4350: has joined #ruby
[20:11:55] nyana: has joined #ruby
[20:12:43] adam12: xco: Not sure if you were just using this for an example but this is brittle and I wouldn't rely on split with length in this _specific_ case.
[20:14:07] xco: Agree it’s brittle in fact i haven’t seen anyone use it like this before
[20:14:09] leftylink: ugh, might have to do something ugly like %w(these_two go_together but these don't).map { |x| x.replace(?_, ?\s) |
[20:14:25] leftylink: &>> %w(these_two go_together but these don't).map { |x| x.replace(?_, ?\s) }
[20:14:26] rubydoc: stderr: -e:2:in `replace': wrong number of arguments (given 2, expected 1) (ArgumentError) (https://carc.in/#/r/733w)
[20:14:40] leftylink: &>> %w(these_two go_together but these don't).map { |x| x.tr(?_, ?\s) }
[20:14:41] rubydoc: # => ["these two", "go together", "but", "these", "don't"] (https://carc.in/#/r/733x)
[20:14:48] leftylink: I obviously meant tr :)
[20:15:30] leftylink: we've got it
[20:15:41] leftylink: https://docs.ruby-lang.org/en/2.6.0/syntax/literals_rdoc.html
[20:15:45] leftylink: For the two array forms of percent string, if you wish to include a space in one of the array entries you must escape it with a “\” character:
[20:16:02] leftylink: &>> %w[these\ two go\ together but these don't]
[20:16:03] rubydoc: # => ["these two", "go together", "but", "these", "don't"] (https://carc.in/#/r/733y)
[20:16:44] xco: leftylink: let me think about this a bit
[20:16:47] leftylink: it may nevertheless be difficult to visually tell the difference at a glance
[20:16:49] queip: has joined #ruby
[20:17:03] leftylink: I might still prefer the _ and tr if I wanted to make it easier on the reader.... not sure
[20:18:27] leftylink: if I put every element on its own line, then I'd be ok with inline \ to escape the spaces
[20:22:18] GarethAdams: xco: how were you thinking that Ruby would know that %w(Some Brand Ferrari Toyota) would be [“Some Brand”, “Ferrari”, “Toyota”] and not [“Some”, “Brand Ferrari”, “Toyota”] ?
[20:23:28] xco: GarethAdams: my vain efforts trying to remember #split(‘ ‘, 3)
[20:24:20] xco: by showing what i was i had hopes that someone could remind me of #split(‘ ‘, 3) which i actually learned about about a week or two ago
[20:26:06] GarethAdams: xco: ok, but you’re happy that split(‘ ‘, 3) probably *isn’t* what you want, right?
[20:26:28] cthulchu: has joined #ruby
[20:27:00] GarethAdams: Because that means the answer to “How would Ruby know?” is “Every word from the 3rd word is part of the same brand name” which is almost certainly not useful to you in any real sense
[20:27:18] xco: "Toyota Ferrari Aston Martin".split(' ',3) IS what i wanted
[20:27:53] jeremycw: has joined #ruby
[20:27:56] GarethAdams: Ok right. So you’re not asking for a general solution to do this in other scenarios, gotcha
[20:28:20] xco: if you have something i don’t know about i’d be happy to know through
[20:28:27] xco: is there anything better than "Toyota Ferrari Aston Martin".split(' ', 3)
[20:28:41] xco: in the end i want to see this ["Toyota", "Ferrari", "Aston Martin"]
[20:28:47] GarethAdams: Are you happy with this?
[20:28:51] xco: no i’m not
[20:28:54] GarethAdams: &>> "Toyota Ferrari Aston Martin Jaguar”.split(' ',3)
[20:28:56] rubydoc: stderr: -e:2: invalid multibyte char (US-ASCII) (https://carc.in/#/r/7342)
[20:29:18] xco: ok i know what you mean
[20:29:35] GarethAdams: &>> “Toyota Ferrari Aston Martin Jaguar”.split(‘ ‘,3)
[20:29:36] rubydoc: stderr: -e:2: invalid multibyte char (US-ASCII) (https://carc.in/#/r/7344)
[20:29:40] GarethAdams: Stupid IRC client
[20:29:50] xco: but i always know that i’ll be sending #split to this "Toyota Ferrari Aston Martin"
[20:29:57] xco: it’s NOT going to change
[20:30:09] xco: how about that?
[20:30:34] GarethAdams: This is some kind of exercise I take it
[20:31:33] GarethAdams: to be honest, if this was in real code I’d just use BRANDS = [“Toyota”, “Ferrari”, “Aston Martin”]
[20:31:40] xco: you think it’s weird the the collection of cars is fixed? :D
[20:32:01] GarethAdams: No, but if it’s fixed I think it’s weird you’re transforming a literal dynamically
[20:32:34] xco: yes i ended up doing BRANDS = [“Toyota”, “Ferrari”, “Aston Martin”] since GarethAdams said it’s brittle to which i agree
[20:32:59] xco: which brings up another question
[20:33:14] GarethAdams: your tab-completion failed you there, but I got who you meant
[20:33:23] xco: how else can #split(‘ ‘, N) be used and not be considered brittle? 🤔
[20:33:39] bradleyprice: has joined #ruby
[20:34:21] xco: does it mean that signature is useless?
[20:35:12] bradleyprice: has joined #ruby
[20:35:40] GarethAdams: Maybe you have a custom text file that’s like “2019-06-15 12:00:14 progname user-335 A bunch of text that the user typed in a chat”
[20:35:53] code_zombie: has joined #ruby
[20:36:07] GarethAdams: date, time, prog, user, text = row.split(‘ ‘, 5) would get you that
[20:36:08] IGnorAND: Sigh, I have uninitialized constant RSpec in my docker. I'm quite sure rspec-rails is installed. which has the rspec gem as a dependancy
[20:36:40] GarethAdams: xco: it’s a pretty niche use case and there are probably better ways. I’ve only seen it very rarely
[20:36:43] adam12: xco: If you know you always have X args, then it's actually safer than leaving N args off.
[20:38:25] adam12: xco: ie, in key=value type strings, I split with 2 arguments to ensure that value never gets truncated if it included an = sign.
[20:38:41] nyana: has joined #ruby
[20:39:25] xco: ok, thanks for the input gentlemen! appreciated
[20:51:03] fphilipe_: has joined #ruby
[20:51:08] houhoulis: has joined #ruby
[20:52:12] cschneid: has joined #ruby
[20:57:21] cliluw: has joined #ruby
[21:00:55] yokel: has joined #ruby
[21:08:24] matchaw: has joined #ruby
[21:08:33] agent_white: has joined #ruby
[21:09:40] matchaw_: has joined #ruby
[21:10:50] cschneid: has joined #ruby
[21:10:56] altious: has joined #ruby
[21:13:29] ur5us: has joined #ruby
[21:14:38] teardown: has joined #ruby
[21:17:09] bradleyprice: has joined #ruby
[21:18:12] doodlebug: has joined #ruby
[21:18:59] cschneid: has joined #ruby
[21:20:11] bradleyprice: has joined #ruby
[21:22:28] bradleyprice: has joined #ruby
[21:29:29] agent_white: has joined #ruby
[21:35:58] bradleyprice: has joined #ruby
[21:37:18] doodlebug: has joined #ruby
[21:39:40] nyana: has joined #ruby
[21:41:02] AJA4350: has joined #ruby
[21:50:11] cschneid: has joined #ruby
[21:50:51] armyriad: has joined #ruby
[22:07:17] ellcs: has joined #ruby
[22:15:13] bradleyprice: has joined #ruby
[22:19:31] queip: has joined #ruby
[22:24:36] doodlebug: has joined #ruby
[22:30:37] doodlebug: has joined #ruby
[22:31:07] Swyper: has joined #ruby
[22:31:27] cschneid: has joined #ruby
[22:32:12] orbyt_: has joined #ruby
[22:36:04] dviola: has joined #ruby
[22:36:38] doodlebug: has joined #ruby
[22:40:36] lamawithonel: has joined #ruby
[22:41:35] queip: has joined #ruby
[22:42:39] doodlebug: has joined #ruby
[22:45:37] Pillus: has joined #ruby
[22:48:38] doodlebug: has joined #ruby
[22:52:36] ebbflowgo: has joined #ruby
[22:54:39] doodlebug: has joined #ruby
[23:00:39] doodlebug: has joined #ruby
[23:02:46] bradleyprice: has joined #ruby
[23:06:05] crankharder: has joined #ruby
[23:06:07] mochiyoda: has left #ruby: ("Konversation terminated!")
[23:06:40] doodlebug: has joined #ruby
[23:09:39] mochiyoda: has joined #ruby
[23:12:40] doodlebug: has joined #ruby
[23:16:04] fphilipe_: has joined #ruby
[23:18:41] doodlebug: has joined #ruby
[23:24:42] doodlebug: has joined #ruby
[23:24:58] LandShark1488: has joined #ruby
[23:24:58] ChanServ: +b *1488*!*@*
[23:24:58] ChanServ: ChanServ kicked LandShark1488: Unacceptable nick - http://ruby-community.com/pages/user_rules#rule_2_10
[23:29:02] GarethAdams: has joined #ruby
[23:29:21] r3m: has joined #ruby
[23:30:42] doodlebug: has joined #ruby
[23:36:43] doodlebug: has joined #ruby
[23:42:23] Swyper: has joined #ruby
[23:42:44] doodlebug: has joined #ruby
[23:48:45] doodlebug: has joined #ruby
[23:56:07] bradleyprice: has joined #ruby
[23:57:33] nyana: has joined #ruby