« Back to channel list

#ruby - 10 May 2019

« Back 1 day Forward 1 day »
[00:01:20] rhuang_: has joined #ruby
[00:03:08] ElF3rn4: has joined #ruby
[00:06:19] haengma: has joined #ruby
[00:08:19] haengma_: has joined #ruby
[00:36:05] jmcgnh: has joined #ruby
[00:39:22] AlHafoudh: has joined #ruby
[00:46:53] brool: has joined #ruby
[00:58:14] symm-: has joined #ruby
[01:01:04] carbone5: has joined #ruby
[01:02:44] fphilipe_: has joined #ruby
[01:03:31] mikeiniowa: has joined #ruby
[01:06:21] cnsvc: has joined #ruby
[01:06:27] zacts: has joined #ruby
[01:18:49] jenrzzz: has joined #ruby
[01:25:51] altigraph: has joined #ruby
[01:39:38] dsmythe: has joined #ruby
[01:49:49] duderonomy: has joined #ruby
[02:04:46] jenrzzz: has joined #ruby
[02:14:20] Swyper: has joined #ruby
[02:18:47] def_jam: has joined #ruby
[02:19:08] eb0t_: has joined #ruby
[02:30:44] cnsvc: has joined #ruby
[02:31:12] landakram: has joined #ruby
[02:34:25] pupsikov: has joined #ruby
[02:39:47] jmcgnh: has joined #ruby
[02:40:53] jenrzzz: has joined #ruby
[02:44:29] AlHafoudh: has joined #ruby
[03:07:41] weteamsteve1: has joined #ruby
[03:09:05] jenrzzz: has joined #ruby
[03:09:47] braincrash: has joined #ruby
[03:17:17] zacts: has joined #ruby
[03:22:12] jobewan: has joined #ruby
[03:32:03] kapilp: has joined #ruby
[03:33:13] fphilipe_: has joined #ruby
[03:35:47] jenrzzz: has joined #ruby
[03:55:11] sauvin: has joined #ruby
[04:00:14] mochiyoda: has left #ruby: ("Konversation terminated!")
[04:06:11] AlHafoudh: has joined #ruby
[04:08:05] mozzarella: has joined #ruby
[04:15:16] mozzarella: has joined #ruby
[04:16:54] tdy: has joined #ruby
[04:26:34] ramfjord: has joined #ruby
[04:35:38] fphilipe_: has joined #ruby
[04:45:15] ur5us: has joined #ruby
[04:50:06] AlHafoudh: has joined #ruby
[05:01:17] AlHafoudh: has joined #ruby
[05:06:53] haengma: has joined #ruby
[05:17:44] AlHafoudh: has joined #ruby
[05:19:10] jenrzzz: has joined #ruby
[05:20:10] esrse: has joined #ruby
[05:21:54] conta: has joined #ruby
[05:22:22] fphilipe_: has joined #ruby
[05:35:22] za1b1tsu: has joined #ruby
[05:39:39] fphilipe_: has joined #ruby
[05:45:21] fphilipe_: has joined #ruby
[05:45:21] AlHafoudh: has joined #ruby
[05:50:31] arup_r: has joined #ruby
[05:59:24] reber: has joined #ruby
[06:00:37] reber: has joined #ruby
[06:09:42] maryo: has joined #ruby
[06:19:46] AlHafoudh: has joined #ruby
[06:27:01] nowhereman: has joined #ruby
[06:27:55] Xiti: has joined #ruby
[06:30:02] jefffrails35: has joined #ruby
[06:30:17] fphilipe_: has joined #ruby
[06:31:32] yxhuvud: has joined #ruby
[06:39:37] andikr: has joined #ruby
[06:50:26] Puffball: has joined #ruby
[06:51:37] TomyWork: has joined #ruby
[06:54:39] Puffball: has joined #ruby
[07:01:17] dar123: has joined #ruby
[07:03:57] aupadhye: has joined #ruby
[07:05:34] dsmythe: has joined #ruby
[07:15:48] kyrylo: has joined #ruby
[07:15:48] evdubs: has joined #ruby
[07:15:54] clemens3: has joined #ruby
[07:16:50] rippa: has joined #ruby
[07:22:40] haengma: has joined #ruby
[07:24:25] lxsameer: has joined #ruby
[07:31:22] AlHafoudh: has joined #ruby
[07:34:20] vondruch: has joined #ruby
[07:37:25] dellavg_: has joined #ruby
[07:39:25] mikecmpbll: has joined #ruby
[07:43:30] tdy: has joined #ruby
[07:53:16] AlHafoudh: has joined #ruby
[08:08:44] Ai9zO5AP: has joined #ruby
[08:17:07] AlHafoudh: has joined #ruby
[08:19:24] ellcs: has joined #ruby
[08:21:10] ricer2: has joined #ruby
[08:26:53] ramfjord: has joined #ruby
[08:29:23] cnsvc: has joined #ruby
[08:42:01] DTZUZO: has joined #ruby
[08:42:20] ur5us: has joined #ruby
[09:00:40] conta: has joined #ruby
[09:06:34] laaron: has joined #ruby
[09:06:48] AlHafoudh: has joined #ruby
[09:08:09] ur5us: has joined #ruby
[09:09:30] jenrzzz: has joined #ruby
[09:10:13] waheedi: has joined #ruby
[09:24:27] laaron: has joined #ruby
[09:25:50] AlHafoudh: has joined #ruby
[09:35:59] ua: has joined #ruby
[09:38:21] haengma: has joined #ruby
[09:46:51] cnsvc: has joined #ruby
[09:58:18] LnxBil: has joined #ruby
[09:59:03] LnxBil: Hi everyone. Could someone explain why this is converted as it is?
[09:59:05] LnxBil: require 'yaml'; puts ({ 'a' => [ '22:22', '80:80' ] }.to_yaml).inspect
[09:59:15] LnxBil: "---\na:\n- '22:22'\n- 80:80\n"
[09:59:41] LnxBil: I wonder why the first element is always encapsulated
[10:01:24] LnxBil: Oh, it's the 22 that is always quoted, but why?
[10:04:42] leftylink: &>> require 'yaml'; YAML.load("22:22")
[10:04:45] rubydoc: # => 80520 (https://carc.in/#/r/6vyx)
[10:09:34] LnxBil: for octal representation (starting with 0) this is the default. The : is triggering this conversion somehow.
[10:10:13] leftylink: &>> 80520 == 22 * 3600 + 22 * 60
[10:10:13] rubydoc: # => true (https://carc.in/#/r/6vyy)
[10:10:27] LnxBil: oh, it's time.
[10:10:45] eb0t: has joined #ruby
[10:11:13] LnxBil: a little bit to intelligent for my use case here.
[10:18:11] AlHafoudh: has joined #ruby
[10:38:46] conta: has joined #ruby
[10:46:48] laaron-: has joined #ruby
[10:49:06] FrankDW: has joined #ruby
[10:50:32] d0liver: has joined #ruby
[10:50:47] sparc: has joined #ruby
[10:51:00] KnownSyntax: has joined #ruby
[10:51:39] cnsvc: has joined #ruby
[10:51:41] jhill: has joined #ruby
[10:53:02] twoone: has joined #ruby
[10:59:08] jhill: has joined #ruby
[10:59:31] mostlybadfly: has joined #ruby
[11:00:03] rafadc: has joined #ruby
[11:00:23] laaron: has joined #ruby
[11:00:36] JayDoubleu: has joined #ruby
[11:03:20] Swyper_: has joined #ruby
[11:08:52] Odalrick: has joined #ruby
[11:09:50] jenrzzz: has joined #ruby
[11:10:34] symm-: has joined #ruby
[11:12:54] truenito: has joined #ruby
[11:14:34] AJA4350: has joined #ruby
[11:20:39] AlHafoudh: has joined #ruby
[11:22:21] Nicmavr: has joined #ruby
[11:25:09] ldnunes: has joined #ruby
[11:25:56] xco: has joined #ruby
[11:26:30] xco: can someone please help me with this error? this simple ruby can’t find a method https://gist.github.com/xcobar/b3e7d17e557d02c9ddb337e5db3af015
[11:26:35] xco: but the method is there
[11:27:51] phaul: no, it's in the instances. Not in the class
[11:28:27] phaul: last token on line 11 refers to class method / local variable
[11:30:24] xco: in that case i can change ‘api_key’ to a class method using def self.api_key … i guess
[11:31:11] phaul: right. but don't let the code drive your design. Consider what it actually belongs to
[11:31:36] phaul: and implement it that way
[11:33:33] xco: ok thanks :) taking another look from a different angle
[12:02:07] cnsvc: has joined #ruby
[12:03:10] ebbflowgo: has joined #ruby
[12:07:21] Nicmavr: has joined #ruby
[12:07:43] haengma: has joined #ruby
[12:22:47] ebbflowgo: has joined #ruby
[12:22:53] ebbflowgo: has left #ruby: ()
[12:25:11] dar123: has joined #ruby
[12:26:18] laaron: has joined #ruby
[12:37:57] apparition: has joined #ruby
[12:39:39] lucasb: has joined #ruby
[12:42:14] budonyc: has joined #ruby
[12:42:26] conta: has joined #ruby
[12:45:12] laaron: has joined #ruby
[12:47:24] symm-: has joined #ruby
[12:50:18] AlHafoudh: has joined #ruby
[12:52:19] Nicmavr: has joined #ruby
[12:58:32] FrankDW: has joined #ruby
[12:58:59] dsmythe: has joined #ruby
[13:03:46] danielsju6: has joined #ruby
[13:07:03] cnsvc: has joined #ruby
[13:08:49] kyrylo: has joined #ruby
[13:10:12] jenrzzz: has joined #ruby
[13:13:17] jcalla: has joined #ruby
[13:21:16] edwardly: has joined #ruby
[13:21:16] edwardly: has joined #ruby
[13:29:12] AlHafoudh: has joined #ruby
[13:35:59] pupsikov: has joined #ruby
[13:36:09] Inline: has joined #ruby
[13:41:28] Odalrick: has joined #ruby
[13:41:51] tris: has joined #ruby
[13:48:34] gnufied: has joined #ruby
[13:51:56] Jonopoly: has joined #ruby
[13:58:42] ramfjord: has joined #ruby
[14:08:53] agent_white: has joined #ruby
[14:10:21] csrcordeiro: has joined #ruby
[14:10:38] AlHafoudh: has joined #ruby
[14:10:51] maryo: has joined #ruby
[14:11:02] Frem: has joined #ruby
[14:15:21] sh7d: has joined #ruby
[14:17:06] cthulchu: has joined #ruby
[14:18:37] cthulchu_: has joined #ruby
[14:23:23] ryouba: has left #ruby: ("WeeChat 1.6")
[14:37:13] cnsvc: has joined #ruby
[14:47:33] laaron-: has joined #ruby
[14:50:45] twoone: has left #ruby: ()
[14:52:27] Nicmavr: has joined #ruby
[14:54:01] al2o3-cr: has joined #ruby
[15:00:23] jenrzzz: has joined #ruby
[15:02:22] danielsju6: has joined #ruby
[15:04:34] robotcars: i'm trying compare to 2 hashes and log a row if h2 is missing some key of h1, but not if the value of the key in h1 is nil/null. https://dpaste.de/A55X#
[15:04:55] robotcars: im unable to exclude the 'if value is nil'
[15:05:11] tdy: has joined #ruby
[15:05:12] robotcars: i keep getting flags for missing the key, when its nil
[15:05:33] havenwood: robotcars: test is compacted keys, so nils are removed already
[15:05:50] havenwood: robotcars: you #compact on line 8
[15:06:10] havenwood: robotcars: you can remove the parens on line 8
[15:06:13] robotcars: right, so i'd expect that the value doesn't exist in either
[15:07:03] havenwood: robotcars: ah, i'm not following what the issue is
[15:07:49] robotcars: currently, it correctly logs a line if the second hash doesn't contain a key from the first hash… perfect
[15:08:06] robotcars: but it also logs a one if the value in hash 1 is nil
[15:08:26] robotcars: my first logic was to check for nil, then I tried compact
[15:08:35] robotcars: i shouldn't even be comparing keys with no value
[15:08:46] havenwood: robotcars: where are you checking for nil values in the code you linked?
[15:10:02] havenwood: gotcha, so if `md` has the key but the `em` value of the key is `nil`, you skip it
[15:10:29] havenwood: or if em doesn't have that key
[15:10:40] havenwood: (which would also return `nil`)
[15:11:39] robotcars: em should always have the key
[15:12:00] robotcars: assuming that what i'm missing is in md
[15:12:01] havenwood: robotcars: and `md` does have the key for the `em` that's `nil`?
[15:12:42] robotcars: md may be missing the key from em, but em.key.value might be null
[15:13:50] havenwood: robotcars: To enforce the assumption that `em` has the key `k`: em.fetch(k).nil?
[15:14:09] gregf_: has joined #ruby
[15:15:12] havenwood: robotcars: to clarify, you don't want to always skip when em's value is nil?: next if em.fetch(k).nil?
[15:22:22] Kestrel-029: has joined #ruby
[15:26:06] Nicmavr: has joined #ruby
[15:27:03] robotcars: havenwood: https://dpaste.de/WyA2#L8,13,29
[15:27:15] robotcars: so yes. if if its nill, i want to skip
[15:27:29] robotcars: added a couple lines of the log example..
[15:28:16] robotcars: i'm missing context_sis_source_id in my defined code, I'm looking to identify it and log that i'm missing it… session_id is getting caught, but it's null in this message, won't be in others. but I know it exists
[15:33:10] laaron: has joined #ruby
[15:36:02] laaron: has joined #ruby
[15:38:17] cnsvc: has joined #ruby
[15:42:01] laaron: has joined #ruby
[15:48:46] agent_white: has joined #ruby
[15:48:54] r29v: has joined #ruby
[15:48:59] laaron: has joined #ruby
[15:51:52] weteamsteve: has joined #ruby
[15:52:22] Nicmavr: has joined #ruby
[15:52:34] jobewan: has joined #ruby
[15:59:57] LtHummus: has joined #ruby
[16:00:15] mikecmpb_: has joined #ruby
[16:04:19] r29v: has joined #ruby
[16:04:44] Dbugger: has joined #ruby
[16:04:55] r29v: has joined #ruby
[16:06:45] stooj: has joined #ruby
[16:07:39] laaron: has joined #ruby
[16:07:54] Renich: has joined #ruby
[16:14:06] rhuang_: has joined #ruby
[16:15:40] haengma: has joined #ruby
[16:17:53] haengma: has joined #ruby
[16:32:23] SeepingN: has joined #ruby
[16:34:21] maryo_: has joined #ruby
[16:36:59] duderonomy: has joined #ruby
[16:37:04] nowhereman: has joined #ruby
[16:38:38] rhuang_: has joined #ruby
[16:39:34] polishdub: has joined #ruby
[16:43:54] rhuang_: has joined #ruby
[16:44:41] nowhere_man: has joined #ruby
[16:48:02] cnsvc: has joined #ruby
[16:52:31] Nicmavr: has joined #ruby
[17:00:04] havenwood: robotcars: can you show us an example `event_data` and `metadata` and what the desired result would be with those inputs?
[17:01:11] fphilipe_: has joined #ruby
[17:01:38] havenwood: robotcars: #select is perfect for when you want to create a new collection that only includes iterations that have a truthy return value
[17:02:23] havenwood: robotcars: I'd suggest using longer variable names. When you have a singular and plural of the same variable, use the singular and plural form of the same word!
[17:03:07] havenwood: like on line 11, `test.each do |k|` is easier to follow as `keys.each do |key|`
[17:03:26] havenwood: robotcars: keys.select do |k|
[17:03:33] havenwood: robotcars: keys.select do |key|
[17:04:24] havenwood: robotcars: then you can drop the `missing << k`
[17:04:44] havenwood: if you `next` it won't be part of the return collection
[17:04:49] robotcars: with select can I do regex matching?
[17:05:20] havenwood: you can do whatever in the block with select, it'll just only include those that have a truthy return value for the iteration
[17:05:23] robotcars: need to compare the key name with key or key?_meta
[17:07:25] Kestrel-029: has joined #ruby
[17:07:36] havenwood: &>> ['can', 'I', 'do', 'regex', 'matching'].select { |word| next if word.include?('c'); word.match?(/[aeiou]/) }
[17:07:39] rubydoc: # => ["do", "regex"] (https://carc.in/#/r/6w1f)
[17:08:13] havenwood: robotcars: #grep is a shorthand, if you _just_ want to check a Regexp or something else that responds to #===
[17:08:18] havenwood: &>> ['can', 'I', 'do', 'regex', 'matching'].grep(/[aeiou]/)
[17:08:18] rubydoc: # => ["can", "do", "regex", "matching"] (https://carc.in/#/r/6w1g)
[17:08:44] havenwood: robotcars: #select, #reject and #map are particularly handy
[17:09:25] havenwood: robotcars: https://docs.ruby-lang.org/en/2.6.0/Enumerable.html
[17:09:50] havenwood: $>> ['can', 'I', 'do', 'regex', 'matching'].all? /[aeiou]/
[17:10:08] robotcars: reading this one now, https://medium.freecodecamp.org/ruby-using-the-select-map-and-reduce-methods-together-a9b2af30804b
[17:10:17] robotcars: ty. really appreciate tips!
[17:10:43] havenwood: robotcars: https://medium.com/@baweaver/reducing-enumerable-part-one-the-journey-begins-ddc1d4108490
[17:10:43] waheedi: has joined #ruby
[17:15:39] danielsju6: has joined #ruby
[17:28:41] wilbert: has joined #ruby
[17:29:51] robotcars: havenwood: ty
[17:30:06] danielsju6: has joined #ruby
[17:31:31] ellcs: has joined #ruby
[17:37:07] AJA4350: has joined #ruby
[17:41:11] havenwood: robotcars: it's a bit nicer to use `value.nil?` instead of `value == nil`
[17:41:41] havenwood: robotcars: instead of `missing.count >= 1`, consider `missing.size.positive?`
[17:41:57] psyton: has joined #ruby
[17:42:25] havenwood: (#size often means lazy count and #count often means iterating to count, so I prefer #size for simple cases)
[17:42:44] havenwood: lazy count as in the collection knows its size, so it doesn't have to actually count
[17:43:29] havenwood: this particularly matters if the collection is infinite, since you'll be counting forever but can have a #size return: Infinity
[17:45:04] psyton: has joined #ruby
[17:46:25] s00pcan: has joined #ruby
[17:46:56] havenwood: robotcars: you can symbolize keys as you parse JSON: JSON.parse(json, symbolize_names: true)
[17:50:13] schne1der: has joined #ruby
[17:51:43] jenrzzz: has joined #ruby
[17:53:23] xco: has left #ruby: ()
[17:57:47] reber: has joined #ruby
[17:58:13] s00pcan: has joined #ruby
[18:00:50] pupsikov: has joined #ruby
[18:11:11] Nicmavr: has joined #ruby
[18:20:32] ramfjord: has joined #ruby
[18:28:11] mikecmpbll: has joined #ruby
[18:33:37] hightower2: has joined #ruby
[18:36:36] hightower2: has joined #ruby
[18:37:14] ramfjord: has joined #ruby
[18:37:55] hightower2: has joined #ruby
[18:38:18] nowhere_man: has joined #ruby
[18:38:19] hightower2: has joined #ruby
[18:59:30] Iarfen: has joined #ruby
[19:11:16] sameerynho: has joined #ruby
[19:12:04] code_zombie: has joined #ruby
[19:12:50] jmcgnh: has joined #ruby
[19:14:10] taylorrf: has joined #ruby
[19:16:11] symm-: has joined #ruby
[19:18:29] remi: has joined #ruby
[19:28:53] yokel: has joined #ruby
[19:29:46] ramfjord: has joined #ruby
[19:31:20] Jonopoly: has joined #ruby
[19:34:30] jrafanie: has joined #ruby
[19:36:27] gigetoo: has joined #ruby
[19:42:31] tdy: has joined #ruby
[19:47:47] swarley: has joined #ruby
[19:58:02] kyrylo: has joined #ruby
[20:15:26] orbyt_: has joined #ruby
[20:21:33] Jonopoly: has joined #ruby
[20:22:54] tdy: has joined #ruby
[20:25:10] govg: has joined #ruby
[20:25:50] gix: has joined #ruby
[20:30:07] cd: has joined #ruby
[20:33:11] Freshnuts: has joined #ruby
[20:38:51] dsmythe_: has joined #ruby
[20:41:15] nowhereman: has joined #ruby
[20:41:39] dsmythe_: has joined #ruby
[20:42:05] fphilipe_: has joined #ruby
[20:52:19] hightower2: has joined #ruby
[20:52:57] gigetoo: has joined #ruby
[21:02:20] za1b1tsu: has joined #ruby
[21:02:56] jmcgnh: has joined #ruby
[21:04:41] cnsvc: has joined #ruby
[21:08:17] AlHafoudh: has joined #ruby
[21:08:42] fphilipe_: has joined #ruby
[21:10:08] djellemah: has joined #ruby
[21:10:12] waheedi: has joined #ruby
[21:14:36] kapilp: has joined #ruby
[21:16:55] dsmythe: has joined #ruby
[21:17:21] robotcars: havenwood: couldn't quite get effective with select, this ok? https://dpaste.de/ctJs# - i'll have to JSON.parse(json, symbolize_names: true) in a different commit after eval.
[21:22:26] Nicmavr: has joined #ruby
[21:26:07] Kestrel-029: has joined #ruby
[21:27:10] jenrzzz: has joined #ruby
[21:27:24] ua: has joined #ruby
[21:37:35] AJA4350: has joined #ruby
[21:44:24] jenrzzz: has joined #ruby
[21:50:17] cnsvc: has joined #ruby
[21:52:30] fphilipe_: has joined #ruby
[21:57:04] jenrzzz: has joined #ruby
[22:01:23] cnsvc: has joined #ruby
[22:03:37] zapata: has joined #ruby
[22:24:28] jenrzzz: has joined #ruby
[22:26:38] hightower3: has joined #ruby
[22:30:48] jenrzzz: has joined #ruby
[22:43:10] AJA4350: has joined #ruby
[22:48:03] Swyper: has joined #ruby
[22:52:12] Renich: has joined #ruby
[22:58:39] Swyper: has joined #ruby
[23:01:29] jenrzzz: has joined #ruby
[23:02:20] orbyt_: has joined #ruby
[23:06:11] _whitelogger: has joined #ruby
[23:07:57] Swyper: has joined #ruby
[23:08:09] AlHafoudh: has joined #ruby
[23:08:25] swarley: has joined #ruby
[23:11:17] Swyper: has joined #ruby
[23:13:20] Swyper_: has joined #ruby
[23:14:29] pupsikov: has joined #ruby
[23:15:28] Swyper: has joined #ruby
[23:15:32] havenwood: missed robotocars, but much better!!
[23:17:59] Swyper: has joined #ruby
[23:23:04] fphilipe_: has joined #ruby
[23:29:26] rhuang_: has joined #ruby
[23:33:52] kyrylo: has joined #ruby
[23:45:14] i1nfusion: has joined #ruby
[23:52:21] al-damiri: has joined #ruby
[23:54:54] cold_iron: has joined #ruby
[23:57:24] cnsvc: has joined #ruby
[23:59:09] djellemah: has joined #ruby