« Back to channel list

#ruby - 26 February 2019

« Back 1 day Forward 1 day »
[00:08:23] cisco: has joined #ruby
[00:23:28] armyriad: has joined #ruby
[00:24:51] tdy2: has joined #ruby
[00:27:29] phaul: has joined #ruby
[00:30:34] mangold: has joined #ruby
[00:41:46] Renich: has joined #ruby
[00:47:33] Axsuul: has joined #ruby
[00:51:21] AJA4350: has joined #ruby
[00:54:37] AJA4350: has joined #ruby
[00:59:30] jmcgnh: has joined #ruby
[01:03:15] r3m: has joined #ruby
[01:09:10] AJA4350: has joined #ruby
[01:13:21] ramfjord: has joined #ruby
[01:23:43] wilbert: has joined #ruby
[01:27:15] doitliao: has joined #ruby
[01:40:36] Renich_: has joined #ruby
[01:44:06] agent_white: has joined #ruby
[01:52:03] spacesuitdiver: has joined #ruby
[02:02:56] bruul: has joined #ruby
[02:11:53] eb0t_: has joined #ruby
[02:27:06] T3RM1N41: has joined #ruby
[02:29:20] ramfjord: has joined #ruby
[02:35:59] blackmesa: has joined #ruby
[02:36:02] Xiti: has joined #ruby
[03:11:03] CrazyEddy: has joined #ruby
[03:20:22] darix: has joined #ruby
[03:23:22] orbyt_: has joined #ruby
[03:39:30] Swyper: has joined #ruby
[03:44:26] ramfjord: has joined #ruby
[03:53:48] SeepingN: has joined #ruby
[04:02:05] wolfshappen_: has joined #ruby
[04:08:35] bruul: has joined #ruby
[04:09:28] braincrash: has joined #ruby
[04:13:59] tdy2: has joined #ruby
[04:56:24] dellavg__: has joined #ruby
[04:58:41] salasrod: has joined #ruby
[05:00:10] cnsvc_: has joined #ruby
[05:11:35] hagebake: has joined #ruby
[05:15:38] t0xik: has joined #ruby
[05:39:24] v01d4lph4: has joined #ruby
[05:50:55] gix: has joined #ruby
[05:51:45] reber: has joined #ruby
[05:52:33] wilbert: has joined #ruby
[06:00:44] SuperLag: has joined #ruby
[06:00:49] tdy2: has joined #ruby
[06:13:35] rippa: has joined #ruby
[06:17:41] shakes: has joined #ruby
[06:18:40] conta: has joined #ruby
[06:19:15] mozzarella: has joined #ruby
[06:21:24] xrexeon: has joined #ruby
[06:46:57] ged: has joined #ruby
[07:15:05] aupadhye: has joined #ruby
[07:17:46] ByronJohnson: has joined #ruby
[07:23:11] ged: has joined #ruby
[07:30:07] ByronJohnson: has joined #ruby
[07:33:56] tdy2: has joined #ruby
[07:42:10] _whitelogger: has joined #ruby
[07:45:09] ramfjord: has joined #ruby
[07:50:56] sagax: has joined #ruby
[08:05:48] xrexeon: has joined #ruby
[08:14:24] Dbugger: has joined #ruby
[08:16:12] clemens3: has joined #ruby
[08:27:08] aufi: has joined #ruby
[08:32:52] lxsameer: has joined #ruby
[08:34:56] alem0lars: has joined #ruby
[08:35:37] aufi_: has joined #ruby
[08:36:33] blackmesa: has joined #ruby
[08:42:46] mangold: has joined #ruby
[08:57:04] mikecmpbll: has joined #ruby
[09:03:51] al2o3-cr: has joined #ruby
[09:04:56] Blaguvest: has joined #ruby
[09:07:17] blackmesa: has joined #ruby
[09:11:06] maufart__: has joined #ruby
[09:19:02] Pisuke: has joined #ruby
[09:19:12] tuor: has joined #ruby
[09:25:41] helpa-bot: has joined #ruby
[09:26:17] akem: has joined #ruby
[09:27:05] helpa: has joined #ruby
[09:27:48] irdr_: has joined #ruby
[09:28:06] th1nkpad: has joined #ruby
[09:28:19] leftylin1: has joined #ruby
[09:30:29] Nicmavr: has joined #ruby
[09:31:25] ghormoon: has joined #ruby
[09:31:52] m27frogy: has joined #ruby
[09:33:34] al2o3-cr: &>> 26 ** 8 #### so a 26 character keyspace repeated permutations of 8 ####
[09:33:36] rubydoc: # => 208827064576 (https://carc.in/#/r/6dbm)
[09:33:45] ellcs: has joined #ruby
[09:34:09] al2o3-cr: hmmm, wonder how long this will take to find my PSK lol ;)
[09:34:24] badeball_: has joined #ruby
[09:35:05] dinfuehr: has joined #ruby
[09:35:13] tdy2: has joined #ruby
[09:35:17] APK: has joined #ruby
[09:35:32] adgtl: has joined #ruby
[09:35:32] Zarthus: has joined #ruby
[09:35:37] harmaahylje: has joined #ruby
[09:35:47] cats: has joined #ruby
[09:35:58] ricer2: has joined #ruby
[09:36:01] Rudd0: has joined #ruby
[09:36:18] obiwahn: has joined #ruby
[09:37:12] spiette: has joined #ruby
[09:57:28] lxsameer: has joined #ruby
[09:57:45] blackmesa: has joined #ruby
[09:59:36] crankharder: has joined #ruby
[10:01:22] dhollin3: has joined #ruby
[10:02:22] wolfshappen: has joined #ruby
[10:05:46] Ai9zO5AP: has joined #ruby
[10:05:59] al2o3-cr: has joined #ruby
[10:09:06] volkov: has joined #ruby
[10:09:39] tdy2: has joined #ruby
[10:11:55] status402: has joined #ruby
[10:28:45] bruce_lee: has joined #ruby
[10:31:37] Inline: has joined #ruby
[10:33:18] cisco: has joined #ruby
[10:35:07] akem: has joined #ruby
[10:35:09] mikecmpb_: has joined #ruby
[10:53:27] d^sh_: has joined #ruby
[10:53:33] mangold: has joined #ruby
[10:56:35] sagax: has joined #ruby
[10:59:11] blackmesa: has joined #ruby
[11:18:07] abrausch: has joined #ruby
[11:26:41] conta: has joined #ruby
[11:37:46] mangold: has joined #ruby
[11:45:32] ramfjord: has joined #ruby
[11:59:23] blackmesa: has joined #ruby
[12:02:32] akem: has joined #ruby
[12:05:22] jmosco: has joined #ruby
[12:25:30] donofrio_: has joined #ruby
[12:25:52] shakes_: has joined #ruby
[12:25:58] Azure|dc: has joined #ruby
[12:26:16] akemot: has joined #ruby
[12:26:27] tdy3: has joined #ruby
[12:26:30] mikecmpbll: has joined #ruby
[12:26:45] clemens3_: has joined #ruby
[12:27:07] Xeago_: has joined #ruby
[12:27:13] mozzarel1: has joined #ruby
[12:27:33] MuffinPimp_: has joined #ruby
[12:27:43] stooj_: has joined #ruby
[12:27:53] duckpupp-: has joined #ruby
[12:28:08] AndroidKK: has joined #ruby
[12:28:36] tdy4: has joined #ruby
[12:29:29] wolfshappen_: has joined #ruby
[12:29:30] arooni: has joined #ruby
[12:29:43] fluxAeon: has joined #ruby
[12:30:28] sagax_: has joined #ruby
[12:30:31] Renich: has joined #ruby
[12:30:31] bairyn: has joined #ruby
[12:30:49] csaunders: has joined #ruby
[12:30:50] lghtstkr: has joined #ruby
[12:30:50] badeball: has joined #ruby
[12:31:00] b6b: has joined #ruby
[12:31:12] adgtl: has joined #ruby
[12:31:13] fribmendes: has joined #ruby
[12:31:15] Linuus: has joined #ruby
[12:31:30] Emmanuel_Chanel: has joined #ruby
[12:31:32] manakanapa1: has joined #ruby
[12:31:37] dante: has joined #ruby
[12:31:39] ua: has joined #ruby
[12:31:53] cgfbee: has joined #ruby
[12:32:07] crankharder: has joined #ruby
[12:32:07] ellcs: has joined #ruby
[12:32:26] foxxx0: has joined #ruby
[12:32:45] akosednar: has joined #ruby
[12:33:08] ujjain: has joined #ruby
[12:36:53] noobineer: has joined #ruby
[12:41:54] lucasb: has joined #ruby
[12:51:31] Cthulu201: has joined #ruby
[12:57:24] nowhere_man: has joined #ruby
[13:09:46] mikecmpbll: has joined #ruby
[13:14:25] apparition: has joined #ruby
[13:22:48] xrexeon: has joined #ruby
[13:28:12] Onwarion: has joined #ruby
[13:33:04] Ropeney: has joined #ruby
[13:35:11] Ropeney: has joined #ruby
[13:36:28] AJA4350: has joined #ruby
[13:43:46] zapata: has joined #ruby
[13:45:01] Inline: has joined #ruby
[13:51:33] ctp: has joined #ruby
[13:52:31] ctp: hi folks. I struggle a little bit with a sort of i guess easy to solve issue. i have the following array:
[13:52:43] ctp: ["{ \"type\": \"INFO_INTEGRITYCHECK_BEGIN\", \"data\": {}}\n", "{ \"type\": \"INFO_INTEGRITYCHECK_FINISHED\", \"data\": {\"conflicting\": 0}}\n\n"]
[13:53:42] ctp: and need to transform it into an array of hashmaps
[13:54:00] ctp: the other thing is to remove all the newlines
[13:54:49] ctp: which i hoped to get rid of with something like foo.each { |line| line.gsub(/\n/ !~ line) }
[13:55:43] tbuehlmann: are the array elements supposed to be json?
[13:58:27] ctp: yes, they are. the thing is, later i want to filter e.g. for specific type etc
[13:58:57] ctp: hm. you mean JSON.parse maybe?
[13:58:58] tbuehlmann: have you tried this? array.map { |element| JSON.parse(element) }
[13:59:42] blackmesa: has joined #ruby
[14:01:27] ctp: tbuehlmann: you're my hero :) i just tried to parse the entire thing in one :)
[14:02:19] laaron: has joined #ruby
[14:04:32] tbuehlmann: great. why isn't the whole thing json in the first place?
[14:26:04] blackmesa: has joined #ruby
[14:29:11] prestorium: has joined #ruby
[14:33:08] ctp: tbuehlmann: it goes through a series of transformations incl. multiline fields etc.but i managed it to be as json'ish as possible :D
[14:58:35] ramfjord: has joined #ruby
[15:08:25] mangold: has joined #ruby
[15:09:06] Rapture: has joined #ruby
[15:10:41] akemot: has joined #ruby
[15:12:01] bruul: has joined #ruby
[15:18:00] minimal_life: has joined #ruby
[15:18:26] spacesuitdiver: has joined #ruby
[15:25:38] conta: has joined #ruby
[15:31:11] donofrio_: has joined #ruby
[15:32:18] donofrio_: has joined #ruby
[15:42:33] skryking: has joined #ruby
[15:48:04] wrkrcoop: has joined #ruby
[15:48:09] crankharder: has joined #ruby
[15:48:54] wrkrcoop: what tools do you use that you wouldn’t want to dev without?
[15:49:53] DTZUZO: has joined #ruby
[15:53:52] mozzarella: my text editor
[15:54:00] aupadhye: has joined #ruby
[15:56:09] dviola: has joined #ruby
[16:02:40] wolfshappen: has joined #ruby
[16:05:54] v01d4lph4: has joined #ruby
[16:12:43] hiroaki_: has joined #ruby
[16:15:41] scapegoatee: has joined #ruby
[16:16:46] scapegoatee: Anyone alive?
[16:18:37] scapegoatee: Hi, it is my first day. I was expecting heavy ruby discussions :p
[16:19:06] scapegoatee: Overexcited I guess.
[16:19:32] tdy4: has joined #ruby
[16:19:47] Net: scapegoatee: hi :)
[16:19:57] orbyt_: has joined #ruby
[16:20:39] scapegoatee: I'm glad Ifound this place
[16:20:55] scapegoatee: love you all, if you exist :p
[16:21:11] havenwood: scapegoatee: we exist
[16:22:21] scapegoatee: hehe :) I will eventually be active here, hopefully.
[16:24:15] cisco: has joined #ruby
[16:24:41] scapegoatee: has left #ruby: ("Leaving...")
[16:31:11] prestorium: has joined #ruby
[16:44:43] nowhere_man: has joined #ruby
[16:48:45] Net: Is Random::DEFAULT seeded from /dev/urandom when Ruby starts?
[16:48:57] Net: Or should I call srand on load?
[16:50:04] mahlon: has joined #ruby
[16:51:37] elomatreb: Net: If you want high-quality random numbers, use the SecureRandom API
[16:52:18] Net: elomatreb: no crypto, just user surveying
[16:53:18] elomatreb: There isn't really a downside to it, I assume the regular rand is seeded from something like microtime (it's not a static seed at least)
[16:54:50] Net: the downside is I'd have to find somewhere to put srand
[17:00:06] [Butch]: has joined #ruby
[17:07:08] \void: has joined #ruby
[17:07:21] Net: elomatreb: I think the seed is generated in the same way as srand https://github.com/ruby/ruby/blob/c84a25e14882a356bc37647a2acf1b6a9127283b/random.c#L1468-L1479
[17:07:44] Net: could anyone with familiarity with the ruby source confirm?
[17:08:56] elomatreb: May I ask why you want to use srand in the first place? It shouldn't be necessary with either API unless you really want the repeatable results behavior, and even then the default doesn't matter to you
[17:09:43] TechIsCool: has joined #ruby
[17:09:45] Net: you're right
[17:10:29] TechIsCool: is there a way to install latest version of bundler 1
[17:10:31] TechIsCool: vs pinning a version to a specific release
[17:14:33] gnufied: has joined #ruby
[17:19:02] nowhere_man: has joined #ruby
[17:21:01] Net: I want to hash one integer to a fraction such that the hashes of an even distribution of integers will be an even distribution of fractions between 0 and 1.
[17:21:06] Net: What's the best way to do this?
[17:21:37] Net: Random.new(integer).rand?
[17:29:54] conta: has joined #ruby
[17:43:03] orbyt_: has joined #ruby
[17:49:30] orbyt_: has joined #ruby
[17:51:55] szulak_: has joined #ruby
[17:52:43] blackmesa: has joined #ruby
[18:02:08] blackmesa: has joined #ruby
[18:03:15] jcarl43: has joined #ruby
[18:05:52] wrkrcoop: has left #ruby: ()
[18:09:06] ricer2: has joined #ruby
[18:11:56] bmurt: has joined #ruby
[18:16:11] conta: has joined #ruby
[18:18:22] sameerynho: has joined #ruby
[18:31:11] NightMonkey: has joined #ruby
[18:35:47] am0123: has joined #ruby
[18:36:03] polishdub: has joined #ruby
[18:37:03] szulak_: ruby -e 'puts "hello"'
[18:37:39] szulak_: ruby[bot] puts "hello"
[18:37:46] szulak_: meh, how do I eval it?
[18:38:15] szulak_: export AA=1; ruby -e 'sleep 3; p ENV["AA"]' &; AA=2
[18:40:19] am0123: I'm learning rails, I noticed the use of expressions like "validates or assert " that are used outside methods .... are these functions calls ?
[18:42:06] Dbugger: has joined #ruby
[18:43:49] am0123: I mean How can they call a method outside other methods
[18:44:57] szulak_: during class definition init
[18:45:53] conta2: has joined #ruby
[18:53:26] zapata: has joined #ruby
[18:57:10] am0123: but how can they become available in this way ?
[18:58:42] am0123: is that the metaprogramming
[18:59:45] szulak_: https://repl.it/repls/CapitalCooperativeScripts
[18:59:47] szulak_: have a look
[18:59:54] szulak_: I could think of these ways
[18:59:58] KeyJoo: has joined #ruby
[19:00:11] szulak_: but the is_arg_valid2? throws an error
[19:00:14] Renich: has joined #ruby
[19:00:23] szulak_: it could work if it would be class method
[19:00:39] szulak_: but yea, I would also like to know how Rails does it
[19:02:41] hiroaki_: has joined #ruby
[19:03:58] am0123: thanks :)
[19:04:14] am0123: I'll try with class method
[19:06:48] am0123: https://repl.it/repls/IdealDelectableWorkspaces
[19:07:20] am0123: https://stackoverflow.com/a/4371087
[19:07:30] am0123: attr_accessor is self.attr_accessor
[19:08:07] szulak_: yeah, that's it :)
[19:09:16] cd: has joined #ruby
[19:11:26] leftylin1: note that no matter how many times `Foo.new` appear in that code (even if it's 0 times), you will still only get "validating => arg_1" once
[19:11:54] am0123: leftylin1 +1
[19:15:45] ramfjord: has joined #ruby
[19:15:55] reber: has joined #ruby
[19:16:29] reber__: has joined #ruby
[19:19:46] adgtl-: has joined #ruby
[19:20:40] b6b: has joined #ruby
[19:20:56] Linuus: has joined #ruby
[19:21:09] jcarl43: has joined #ruby
[19:22:07] ua: has joined #ruby
[19:23:29] eb0t: has joined #ruby
[19:26:06] agent_white: has joined #ruby
[19:29:15] wilbert: has joined #ruby
[19:30:14] spacesuitdiver: has joined #ruby
[19:30:25] prestorium: has joined #ruby
[19:37:24] naught-fowl: has joined #ruby
[19:37:48] conta1: has joined #ruby
[19:38:11] naught-fowl: Hi how can I replace ' in a string with \' ? I am trying str.gsub("'", "\\'") but it gives me a weird result
[19:41:19] mozzarella: describe "weird result"
[19:41:45] naught-fowl: &>> str = "foo'bar'baz"; str.gsub("'", "\\'")
[19:42:04] naught-fowl: I dont know how to eval in here
[19:42:24] naught-fowl: here I get "foobar'bazbarbazbaz"
[19:42:31] mozzarella: >> str = "foo'bar'baz"; str.gsub("'", "\\'")
[19:42:37] ruby[bot]: mozzarella: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
[19:43:56] naught-fowl: >> "foo'bar'baz".gsub("'", "\\'")
[19:44:02] ruby[bot]: naught-fowl: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
[19:44:09] naught-fowl: >> RUBY_VERSION
[19:44:15] ruby[bot]: naught-fowl: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
[19:45:27] SeepingN: has joined #ruby
[19:46:34] Tempesta: has joined #ruby
[19:47:03] naught-fowl: the bot must be broken
[19:49:09] havenwood: &>> str = "foo'bar'baz"; str.gsub("'", "\\'")
[19:49:42] mozzarella: you need 4 slashes
[19:49:58] mozzarella: "foo'bar'baz".gsub("'", "\\\\'")
[19:50:16] naught-fowl: thank you very much, cheese
[19:51:37] leftylink: well, today I learned about https://ruby-doc.org/core-2.5.1/Regexp.html#class-Regexp-label-Special+global+variables . so thanks for that
[19:52:26] mozzarella: when in doubt, always add more slashes
[19:52:38] havenwood: leftylink: #match? is so fast because it doesn't set those. I tend to avoid them since these days there are usually explicit alternatives.
[19:53:45] havenwood: why have 4 when you can have 5!?: '\\\\\''
[19:55:55] rubydoc: has joined #ruby
[21:29:34] helpa: has joined #ruby
[21:41:30] am0123: has joined #ruby
[21:51:37] Xiti: has joined #ruby
[21:59:18] nowhere_man: has joined #ruby
[22:02:00] wolfshappen_: has joined #ruby
[22:04:26] yokel: has joined #ruby
[22:04:45] cnsvc_: has joined #ruby
[22:09:42] tdy: has joined #ruby
[22:13:20] naught-fowl: has joined #ruby
[22:30:10] am0123: has joined #ruby
[22:32:42] Dbugger: has joined #ruby
[22:43:03] vdl: what is the bash equivalent of ruby's ARGF ?
[22:49:52] havenwood: vdl: a `|` for piping or a `$(<FILENAME)` for reading a file into a command. You might want to ask #bash, telling them which part you care about.
[22:49:58] havenwood: vdl: Show what you have so far?
[22:50:06] havenwood: vdl: Which part do you care about?
[22:57:08] hightower3: has joined #ruby
[22:57:29] hightower3: Hey what's a preferred gem for splitting strings on whitespace but honoring quotes? shellwords, or?
[22:57:46] baweaver: Probably shellwords.
[22:58:12] am0123_: has joined #ruby
[22:58:57] lupine: hard problems #3, after cache invalidation and naming things
[23:00:36] vdl: havenwood: hum nevermind. ARGF reads the content of the given filenames as arguments, or, the content of a file piped through stdin. I was looking for simply merging words from either $@ or stdin.
[23:00:50] ruby[bot]: has joined #ruby
[23:00:50] ChanServ: +o ruby[bot]
[23:02:27] orbyt_: has joined #ruby
[23:03:42] hightower3: thank baweaver
[23:03:44] hightower3: has left #ruby: ("Leaving")
[23:09:56] AndroidKitKat: has joined #ruby
[23:26:31] def_jam: has joined #ruby
[23:33:41] blackmesa: has joined #ruby
[23:43:59] jyaworski: has joined #ruby
[23:53:32] spacesuitdiver: has joined #ruby