« Back to channel list

#ruby - 31 May 2019

« Back 1 day Forward 1 day »
[00:00:22] cliluw: has joined #ruby
[00:02:30] pelegreno: has joined #ruby
[00:10:36] skryking: has joined #ruby
[00:13:52] matti: has joined #ruby
[00:15:21] comet23: has joined #ruby
[00:15:47] comet23: how do you pass in multiple procs into a function?
[00:16:04] havenwood: comet23: you just do!
[00:16:11] comet23: i'm trying def my_func(val, &prc1, &prc2) end
[00:16:22] comet23: it's raising an error
[00:16:32] havenwood: comet23: you can only pass one block
[00:16:51] havenwood: comet23: you can pass multiple procs as arguments
[00:16:55] havenwood: comet23: my_func(val, prc1, prc2)
[00:17:15] comet23: thank you so much!! :D
[00:17:24] havenwood: comet23: if it makes sense, you could pass *one* as the block
[00:17:29] havenwood: comet23: no prob!
[00:19:23] pelegreno: has joined #ruby
[00:22:21] graft: has joined #ruby
[00:31:19] orbyt_: has joined #ruby
[00:39:47] matheusmoreira: has joined #ruby
[00:42:06] esp32_prog: has joined #ruby
[00:47:55] shortCircuit__: has joined #ruby
[01:01:33] bambanx: has joined #ruby
[01:04:52] comet23: hey havenwood i'm a bit confused why &prc is even an option
[01:05:04] comet23: passing it as a normal param seems better?
[01:05:22] havenwood: comet23: a proc is an object, which takes space in memory
[01:05:36] comet23: aren't parameters objects too?
[01:05:41] havenwood: comet23: you're right that procs alone would suffice
[01:05:51] havenwood: comet23: blocks have various efficiencies, and the common pattern of one important proc justifies the savings
[01:06:21] brandoncc: has joined #ruby
[01:06:21] comet23: what's the "correct" use case for the ampersand?
[01:06:50] havenwood: comet23: it's for passing a block. the block doesn't get an object allocated. it's an efficiency.
[01:07:05] havenwood: comet23: & calls #to_proc and passes that proc as a block
[01:07:06] comet23: so can it be thought of as an expression?
[01:07:21] comet23: like 2 + 2
[01:07:33] comet23: it gets executed and immediately discarded
[01:07:46] havenwood: comet23: yeah, i think that's fair
[01:07:58] comet23: that clears things up, thank you for your time :)
[01:08:11] havenwood: comet23: if it weren't for optimizations, we could just use a single proc as an additional argument in place of a block
[01:08:30] havenwood: comet23: there's no case where you couldn't substitute a proc argument for a block
[01:10:25] arahael1: has joined #ruby
[01:11:08] Leopere: has joined #ruby
[01:11:14] pebble2016: has joined #ruby
[01:12:36] octos: has joined #ruby
[01:13:01] comet23: ruby is really cool... i'm going to try to build a simple 2 player chess game for a challenge
[01:13:43] havenwood: comet23: that's good fun
[01:15:15] al2o3-cr: comet23: blocks are just closures
[01:15:28] baweaver: comet23: What exactly are you trying to do that a function needs two blocks?
[01:17:59] comet23: i'm just learning ruby by doing coding challenges baweaver
[01:18:25] baweaver: I get that, but what problem and why do you want to do that specifically to solve it?
[01:18:38] al2o3-cr: say lua e.g: function foo(n) return function() n * 2 end
[01:18:40] havenwood: comet23: i had that same question, and also implemented a chess game as a challenge :)
[01:20:17] al2o3-cr: say lua e.g: function foo(n) return function() return * 2 end end; foo(42)()
[01:21:24] comet23: because of your wonderful explanation i got the test cases to pass :)
[01:21:25] comet23: https://repl.it/repls/UltimateVariableMainframe
[01:22:18] al2o3-cr: comet23: it stops execution of the current thread
[01:23:15] comet23: al2o3-cr: that's way over my head at this point haha, but i'll try to memorize that phrase and hopefully it will click when i finally make that mistake and it will be an AHA! moment
[01:25:33] baweaver: comet23: closures
[01:25:46] baweaver: Do you know what those are yet?
[01:25:57] baweaver: A function remembers the context in which it was defined
[01:26:33] baweaver: &>> def adds(n) -> v { n + v } end; (1..5).map(&adds(5))
[01:26:43] rubydoc: stderr: playpen: timeout triggered! (https://carc.in/#/r/70ij)
[01:26:44] comet23: i think so (but i'm not very confident at this point), i think a closure is a function within a function where the code is "hidden" from the global scope
[01:26:56] baweaver: How does `adds` remember what `n` is?
[01:27:12] baweaver: because of the context it was defined in, which was when the `adds` function was called
[01:27:28] baweaver: So it sees `n` when it creates that proc, and remembers that value
[01:27:31] baweaver: &>> def adds(n) -> v { n + v } end; (1..5).map(&adds(5))
[01:27:32] rubydoc: # => [6, 7, 8, 9, 10] (https://carc.in/#/r/70ik)
[01:27:35] baweaver: There it goes
[01:27:40] comet23: really cool!
[01:28:15] comet23: you're opening my brain, i'm feeling elated right now :D
[01:28:56] graft: has joined #ruby
[01:28:56] graft: has joined #ruby
[01:29:12] baweaver: Read through this series - https://medium.com/@baweaver/functional-programming-in-ruby-state-5e55d40b4e67
[01:30:14] al2o3-cr: ruby as block/proc/lambdas because it's not a functional ... what baweaver said.
[01:30:34] baweaver: Eh, depends on what people mean by functional
[01:31:12] baweaver: If you have a lambda or function construct that you can pass as an argument a language is sufficiently functional in a manner of speaking
[01:31:31] baweaver: Doesn't mean it'll necessarily be pleasant though, which is where languages like Haskell tend to win out for having first class language-level support for functional pattersn
[01:31:47] baweaver: namely things like Functors, Applicatives, Monoids, Groups, and other concepts in that vein
[01:31:59] Eiam: whats with the stabby operater there
[01:32:01] baweaver: Like it has operators defined explicitly for interacting with those
[01:32:21] baweaver: -> x { x } == lambda { |x| x }
[01:32:27] comet23: you guys are awesome, like all of you :D
[01:33:01] al2o3-cr: baweaver: that's why constucts exist
[01:33:23] Eiam: oh cause you wanted it to be callable via &adds later on
[01:33:28] baweaver: Just saying it depends on how pedantic one wants to be on the terminology
[01:33:35] baweaver: bingo, closures
[01:34:15] baweaver: If I went into a Haskell channel and said Java is a functional language because it has lambdas they'd lose their minds
[01:34:39] al2o3-cr: blocks are closures. nothing more, nothing less.
[01:34:42] comet23: how is that not a true statement baweaver?
[01:34:49] baweaver: I suppose a more apt term would be ability to express concepts native to functional programming
[01:35:28] baweaver: In terms of actual support for high-level functional expressions Java is low on the list, whereas languages like Haskell and OCaml are high
[01:36:20] baweaver: Eiam: the second article on closures should explain more on that: https://medium.com/@baweaver/functional-programming-in-ruby-closures-ac80547eb40d
[01:36:53] budonyc: has joined #ruby
[01:37:36] orbyt_: has joined #ruby
[01:38:02] al2o3-cr: baweaver: what a closure in python|lua|php etc...
[01:38:43] baweaver: Not entirely sure we're tracking on the same discussion
[01:39:12] baweaver: My vantage was that you'd mentioned Ruby wasn't functional
[01:39:24] al2o3-cr: are blocks closures?
[01:40:21] al2o3-cr: baweaver: are blocks closures?
[01:40:28] Eiam: javascript is a functional language, change my mind!
[01:40:31] brool: i'd call blocks anonymous functions
[01:40:50] al2o3-cr: brool: they're closures
[01:41:09] Eiam: baweaver: I understand the nuance you are drawing bu tonly cause I used to be in #haskell =)
[01:41:17] al2o3-cr: like any other language
[01:42:19] brool: eiam: i tried dropping the java line in #haskell just now but they must be on to me, nobody took the bait
[01:45:31] al2o3-cr: function add(a, b) return function(a,b) return a+b end end; is the same as def add(a, b) yield/&block.call
[01:46:37] brool: well it was fun while it lasted
[01:48:35] al2o3-cr: [1,2,3].select { |n| n.even? }
[01:50:00] baweaver: al2o3-cr: (+ 1 1)
[01:50:43] al2o3-cr: baweaver: :P
[01:51:37] al2o3-cr: blocks are the shit of ruby
[01:52:00] al2o3-cr: but many people don't understand them
[01:54:30] ixti: has joined #ruby
[01:55:13] al2o3-cr: all they are is closures
[01:59:22] comet23: have a great night everyone!
[01:59:42] al2o3-cr: comet23: u 2
[02:00:12] al2o3-cr: good band that
[02:00:55] al2o3-cr: trust ruby is shit hot
[02:06:06] al2o3-cr: brool: exactly that
[02:09:40] al2o3-cr: you can't return a symbol or nil
[02:10:46] al2o3-cr: method -> closure -> end of method
[02:18:04] al2o3-cr: &>> def foo(n) yield(n * 2) end; foo(42) { |n| n }
[02:18:08] rubydoc: # => 84 (https://carc.in/#/r/70im)
[02:18:49] al2o3-cr: fuck blocks
[02:19:51] al2o3-cr: use &blocks if need to pass around; otherwise use yield
[02:29:08] al2o3-cr: b.call(n * 2) that's where people get confused
[02:29:33] al2o3-cr: passing &b in the method
[02:30:19] esp32_prog: has joined #ruby
[02:30:35] duderonomy: has joined #ruby
[02:39:11] _whitelogger: has joined #ruby
[02:46:34] joast: has joined #ruby
[03:10:54] braincrash: has joined #ruby
[04:05:34] jenrzzz: has joined #ruby
[04:18:02] brandoncc: has joined #ruby
[04:18:34] esp32_prog: has joined #ruby
[04:20:55] nowhere_man: has joined #ruby
[04:23:19] weteamsteve1: has joined #ruby
[04:37:46] KramerC: has joined #ruby
[04:37:53] MuffinPimp_: has joined #ruby
[04:38:22] haxx0r: has joined #ruby
[04:43:47] jcalla: has joined #ruby
[04:48:25] shortCircuit__: has joined #ruby
[04:50:31] weteamsteve2: has joined #ruby
[04:50:44] salerace: has joined #ruby
[04:54:22] weteamsteve: has joined #ruby
[04:59:55] dellavg_: has joined #ruby
[05:06:40] weteamsteve1: has joined #ruby
[05:08:11] weteamsteve2: has joined #ruby
[05:09:00] kyrylo: has joined #ruby
[05:34:23] fphilipe: has joined #ruby
[05:44:20] duderonomy: has joined #ruby
[05:46:35] duderonomy: has joined #ruby
[05:49:16] ur5us: has joined #ruby
[05:50:38] shortCircuit__: has joined #ruby
[05:52:29] nwradio878887987: has joined #ruby
[06:06:50] esp32_prog: has joined #ruby
[06:27:10] andikr: has joined #ruby
[06:36:36] jenrzzz: has joined #ruby
[06:45:43] Net: How should I handle creating private helper methods in a subclass that don't override private methods of the same name in the parent class?
[07:01:20] Dbugger: has joined #ruby
[07:02:10] phaul: Net do you have a code example?
[07:02:34] jefffrails35: has joined #ruby
[07:03:09] phaul: I dont fully understand what is the aim here
[07:04:42] Net: phaul: I have running into naming collisions with a subclass' parent
[07:04:46] Net: *I am running into
[07:05:27] Net: where the parent has some private methods defined with a common name
[07:05:49] Net: I could just name the subclass's methods something else
[07:05:54] Net: but the parent class has a lot of methods
[07:06:07] Net: and I would rather just have a more reliable solution
[07:06:15] Net: to what seems like should be a fairly common problem
[07:06:53] xco: has joined #ruby
[07:07:06] phaul: well.. good designs tend to have small classes with few methods which seems to be violated by the superclass
[07:07:21] Net: phaul: agreed
[07:07:31] jenrzzz: has joined #ruby
[07:07:50] ruby[bot]: xco: I don't know anything about log
[07:07:56] Net: phaul: unfortunately, "good design" is not the description I would use for this project :)
[07:08:09] phaul: if you don't own/want to touch the superclass, everything in the subclass will have a hacky feel to it
[07:08:14] xco: phaul: how do you get the log of the convos? :D
[07:08:51] phaul: xco https://freenode.irclog.whitequark.org/ruby/
[07:11:16] phaul: Net: for methods that are not instance methods in the sense that they dont reference instance variables I would move them into a Module maybe nested in the class. for methods that touch instance variables, it's a bit tricky
[07:12:32] schne1der: has joined #ruby
[07:16:33] phaul: another thing to try is not to inherit, but delegate to an instance var of the superclass type
[07:17:53] phaul: that way you don't inherit the large interface, so your (subclass's) clients wont see any of it, so it stops the propagation of badness
[07:18:06] Net: phaul: thanks!
[07:18:40] Net: phaul: what do you think of just prefixing method names?
[07:19:37] phaul: Im not big fan.
[07:19:54] Net: I can imagine why
[07:19:56] Net: thank you'
[07:32:14] xco: General question: Are there any methods in Ruby that were “copied” from Rails? I’m very curious.
[07:35:03] leftylink: I know that https://github.com/rails/rails/issues/32070 exists. perhaps there are other.
[07:35:16] dionysus69: has joined #ruby
[07:35:21] leftylink: I don't know if &. was also in this category
[07:35:39] conta: has joined #ruby
[07:42:23] bougyman_: has joined #ruby
[07:45:28] esp32_prog: has joined #ruby
[07:48:50] ur5us: has joined #ruby
[07:56:02] sameerynho: has joined #ruby
[07:56:25] marz_d`ghostman: has joined #ruby
[07:56:52] marz_d`ghostman: In minitest, is there a like after(:all) testwide function? like I want to invoke a method after all tests/* is run
[08:13:03] fphilipe: has joined #ruby
[08:13:09] jenrzzz: has joined #ruby
[08:14:05] alem0lars: has joined #ruby
[08:15:40] deepreds1: has joined #ruby
[08:45:56] Jonopoly: has joined #ruby
[08:50:58] ngw: has joined #ruby
[08:55:48] blackmesa: has joined #ruby
[08:58:15] fphilipe: has joined #ruby
[09:00:35] planigan: has joined #ruby
[09:01:24] dhollin3: has joined #ruby
[09:04:52] evdubs: has joined #ruby
[09:13:54] jenrzzz: has joined #ruby
[09:20:28] mikecmpbll: has joined #ruby
[09:37:19] alem0lars_: has joined #ruby
[09:39:54] esp32_prog: has joined #ruby
[09:39:57] r3m_: has joined #ruby
[09:55:38] chichou: has joined #ruby
[10:04:13] Paraxial: has joined #ruby
[10:07:57] blackmesa: has joined #ruby
[10:08:00] ams__: has joined #ruby
[10:14:14] jenrzzz: has joined #ruby
[10:18:03] shortCircuit__: has joined #ruby
[10:33:05] deathwishdave: has joined #ruby
[10:35:59] gregf_: has joined #ruby
[10:43:25] nowhere_man: has joined #ruby
[10:45:39] ur5us: has joined #ruby
[10:51:42] ur5us: has joined #ruby
[10:53:57] ur5us: has joined #ruby
[10:54:50] ur5us: has joined #ruby
[10:55:44] ur5us: has joined #ruby
[11:05:55] ur5us: has joined #ruby
[11:08:59] ur5us: has joined #ruby
[11:09:29] ur5us: has joined #ruby
[11:19:55] ur5us: has joined #ruby
[11:20:37] ur5us: has joined #ruby
[11:21:25] Ai9zO5AP: has joined #ruby
[11:22:22] AJA4350: has joined #ruby
[11:22:40] jenrzzz: has joined #ruby
[11:23:53] ur5us: has joined #ruby
[11:24:23] ur5us: has joined #ruby
[11:24:29] kyrylo: has joined #ruby
[11:24:45] wald0: has joined #ruby
[11:33:18] esp32_prog: has joined #ruby
[11:34:03] ur5us: has joined #ruby
[11:39:53] ur5us: has joined #ruby
[11:40:37] ur5us: has joined #ruby
[11:41:21] ur5us: has joined #ruby
[11:45:01] laaron: has joined #ruby
[11:46:06] ur5us: has joined #ruby
[11:46:51] ur5us: has joined #ruby
[11:48:56] Jonopoly: has joined #ruby
[11:50:44] conta: has joined #ruby
[11:51:46] ur5us: has joined #ruby
[11:51:49] havenwood: xco: Yes, more than a few.
[11:52:02] xco: any comes to mind?
[11:52:09] bijan_: has joined #ruby
[11:52:23] havenwood: xco: #transform_keys, #transform_values
[11:52:59] havenwood: xco: activesupport features make it into Ruby from time to time
[11:53:40] xco: yeah i know that. just wanted to create a list of those and observe them, turn them to a blog post for my futureself
[11:54:41] havenwood: marz_d`ghostman: after_run
[11:54:52] havenwood: marz_d`ghostman: https://www.rubydoc.info/github/seattlerb/minitest/Minitest.after_run
[11:55:59] ur5us: has joined #ruby
[11:56:34] ur5us: has joined #ruby
[11:57:17] ur5us: has joined #ruby
[11:57:48] havenwood: xco: #try is another example
[11:58:12] alotofnoodles: has joined #ruby
[11:58:15] xco: Ruby has try? I thought that version was changed ti &.
[11:58:18] ngw: has joined #ruby
[11:58:30] xco: safe navigation
[11:58:44] havenwood: xco: yeah, you're right
[11:59:34] xco: didn’t know “sum” was stolen
[11:59:50] xco: “stolen”
[12:00:13] alotofnoodles: has joined #ruby
[12:01:40] fphilipe: has joined #ruby
[12:01:52] marz_d`ghostman: havenwood: yeah thanks, I just needed to place it under test_helper. I was using it but was placing it under a specific test file, silly me. :)
[12:07:28] ur5us: has joined #ruby
[12:10:12] ur5us: has joined #ruby
[12:10:27] Sylario: has joined #ruby
[12:10:33] ur5us: has joined #ruby
[12:10:43] Guest42: has joined #ruby
[12:11:23] ur5us: has joined #ruby
[12:11:41] blackmesa: has joined #ruby
[12:13:12] kookoop: has joined #ruby
[12:15:52] kookoop: has left #ruby: ()
[12:21:34] kk: has joined #ruby
[12:21:42] bijan_: has joined #ruby
[12:21:43] ur5us: has joined #ruby
[12:21:44] kk: https://www.fiverr.com/s2/8cc1b91d71?utm_source=com.google.android.apps.docs_Mobile
[12:22:28] mkaito: has joined #ruby
[12:22:28] mkaito: has joined #ruby
[12:23:26] KevinSjoberg_: has joined #ruby
[12:23:39] raggi__: has joined #ruby
[12:23:39] catsed: has joined #ruby
[12:23:43] laaron-: has joined #ruby
[12:23:45] peteretep_: has joined #ruby
[12:23:50] rann_: has joined #ruby
[12:23:50] pwillard_: has joined #ruby
[12:23:54] gajus_: has joined #ruby
[12:24:13] timeless_: has joined #ruby
[12:24:24] arooni: has joined #ruby
[12:24:30] nixy0: has joined #ruby
[12:24:55] Junaos: has joined #ruby
[12:25:03] kookoop: has joined #ruby
[12:25:10] alem0lars: has joined #ruby
[12:25:20] haylon_: has joined #ruby
[12:25:34] mclee: has joined #ruby
[12:25:40] ammar: has joined #ruby
[12:26:04] jp: has joined #ruby
[12:26:09] mahlon_: has joined #ruby
[12:26:10] EvilJStoker: has joined #ruby
[12:26:11] EvilJStoker: has joined #ruby
[12:26:12] lucas: has joined #ruby
[12:26:16] gmcintire: has joined #ruby
[12:26:18] bijan_: has joined #ruby
[12:26:22] [spoiler]: has joined #ruby
[12:26:22] russt: has joined #ruby
[12:26:27] canton7: has joined #ruby
[12:26:31] Jello_Raptor: has joined #ruby
[12:26:36] Guest50634: has joined #ruby
[12:26:37] jnix: has joined #ruby
[12:26:52] soulcutter: has joined #ruby
[12:26:52] Alison`8: has joined #ruby
[12:26:55] kenichi: has joined #ruby
[12:27:16] kk: has joined #ruby
[12:27:33] cjohnson: has joined #ruby
[12:27:42] Mon_Ouie: has joined #ruby
[12:27:55] jtperreault: has joined #ruby
[12:28:33] AJA4350: has joined #ruby
[12:28:50] kookoop: has left #ruby: ("ERC (IRC client for Emacs 26.2)")
[12:29:35] jhill: has joined #ruby
[12:30:56] bijan_: has joined #ruby
[12:31:29] rprimus: has joined #ruby
[12:31:32] miah: has joined #ruby
[12:34:53] bijan__: has joined #ruby
[12:36:56] haxx0r: has joined #ruby
[12:38:52] bijan_: has joined #ruby
[12:40:44] bijan_: has joined #ruby
[12:48:39] jenrzzz: has joined #ruby
[12:53:01] go|dfish: has joined #ruby
[12:59:13] deathwishdave: has joined #ruby
[13:00:49] SolarAquarion: has joined #ruby
[13:07:35] Guest7: has joined #ruby
[13:08:07] Jitterbug: puts 'greetings, #ruby'
[13:08:49] havenwood: &>> 'helloooooo'.squeeze 'o'
[13:08:53] rubydoc: # => "hello" (https://carc.in/#/r/70mc)
[13:11:12] Spitfire: has joined #ruby
[13:11:12] Spitfire: has joined #ruby
[13:11:50] Jitterbug: jitterbug has created a monster w/ kafka + racecar --- any others into event streaming?
[13:14:16] mkaito: has joined #ruby
[13:14:16] mkaito: has joined #ruby
[13:18:58] mkaito: has joined #ruby
[13:18:59] mkaito: has joined #ruby
[13:20:11] ngw: has joined #ruby
[13:21:38] esp32_prog: has joined #ruby
[13:25:03] RedSnarf: has joined #ruby
[13:25:26] Swyper: has joined #ruby
[13:31:13] octos: has joined #ruby
[13:45:48] reber: has joined #ruby
[13:46:40] Swyper: has joined #ruby
[13:50:50] sina: has joined #ruby
[13:50:56] jenrzzz: has joined #ruby
[14:04:41] TimApple: has joined #ruby
[14:14:18] rippa: has joined #ruby
[14:16:47] TimApple: has joined #ruby
[14:19:33] brandoncc: has joined #ruby
[14:20:03] brandoncc: has joined #ruby
[14:39:37] FrankDW2: has joined #ruby
[14:59:41] s3nd1v0g1us: has joined #ruby
[15:00:24] salerace: has joined #ruby
[15:10:06] esp32_prog: has joined #ruby
[15:16:11] jeremycw: has joined #ruby
[15:28:04] sphenxes: has joined #ruby
[15:30:24] cthulchu_: has joined #ruby
[15:31:23] yasumi2136: has joined #ruby
[15:34:16] polishdub: has joined #ruby
[15:35:08] doodlebug: has joined #ruby
[15:35:38] AndreYuhai: has joined #ruby
[15:37:21] moei: has joined #ruby
[15:42:20] bijan_: has joined #ruby
[15:43:05] kyrylo: has joined #ruby
[15:50:34] laaron: has joined #ruby
[15:52:32] yqt: has joined #ruby
[15:52:33] sagax: has joined #ruby
[15:52:39] bijan_: has joined #ruby
[15:55:27] graft: has joined #ruby
[15:55:38] fphilipe: has joined #ruby
[15:56:30] bijan__: has joined #ruby
[15:56:39] mikecmpbll: has joined #ruby
[16:00:19] bijan_: has joined #ruby
[16:00:56] tdy: has joined #ruby
[16:01:12] weteamsteve: has joined #ruby
[16:04:40] bijan__: has joined #ruby
[16:09:34] bijan_: has joined #ruby
[16:11:16] codefriar: has joined #ruby
[16:13:33] bijan__: has joined #ruby
[16:18:02] bijan_: has joined #ruby
[16:19:03] weteamsteve1: has joined #ruby
[16:21:55] weteamsteve2: has joined #ruby
[16:22:40] bijan__: has joined #ruby
[16:26:24] bijan_: has joined #ruby
[16:30:35] bijan__: has joined #ruby
[16:34:21] Swyper: has joined #ruby
[16:34:27] bijan_: has joined #ruby
[16:37:13] brandoncc: has joined #ruby
[16:38:34] bijan_: has joined #ruby
[16:39:16] weteamsteve: has joined #ruby
[16:40:12] bijan_: has joined #ruby
[16:44:47] bijan_: has joined #ruby
[16:45:01] weteamsteve1: has joined #ruby
[16:47:15] jenrzzz: has joined #ruby
[16:48:42] bijan_: has joined #ruby
[16:51:06] weteamsteve: has joined #ruby
[16:52:40] bijan__: has joined #ruby
[16:54:59] jenrzzz: has joined #ruby
[16:56:27] Nikhil_Singhal: has joined #ruby
[16:56:46] bijan_: has joined #ruby
[16:58:07] esp32_prog: has joined #ruby
[16:58:46] Iarfen: has joined #ruby
[17:00:44] bijan_: has joined #ruby
[17:02:37] glik22: has joined #ruby
[17:03:12] glik22: i get a LoadError when trying to run bundle install. i'm pretty sure i installed ruby via homebrew
[17:04:54] bijan_: has joined #ruby
[17:05:15] havenwood: glik22: On the current Ruby, have you run? gem install bundler
[17:05:39] havenwood: glik22: check the Ruby and Bundler that you're using.
[17:05:45] havenwood: glik22: which ruby
[17:05:47] havenwood: glik22: which bundle
[17:06:12] havenwood: glik22: gem which bundler
[17:06:45] glik22: havenwood: both are /usr/local/bin
[17:06:51] ltem: has joined #ruby
[17:07:15] havenwood: glik22: and? gem which bundler
[17:08:04] glik22: oh sorry, missed that. /usr/local/Cellar/ruby/2.6.3/lib/ruby/2.6.0/bundler.rb
[17:08:15] havenwood: glik22: yeah, looks like Homebrew Ruby
[17:08:32] havenwood: glik22: show the error you're getting?
[17:09:26] glik22: /usr/local/bin/bundle:23:in `load': cannot load such file -- /usr/local/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/exe/bundle (LoadError)
[17:09:29] bijan_: has joined #ruby
[17:09:37] havenwood: glik22: sanity check one more thing? head -n1 "$(which bundle)"
[17:10:16] glik22: havenwood: actually i think i got it. instead of running "bundle install" i tried "bundler install"
[17:10:24] glik22: which errored but gave a command to update bundle
[17:10:59] glik22: havenwood: #!/usr/local/opt/ruby/bin/ruby
[17:12:15] oz: has joined #ruby
[17:12:53] duderonomy: has joined #ruby
[17:13:24] bijan_: has joined #ruby
[17:14:29] xco: hi! i need help with this https://gist.github.com/xcobar/6195a9596f00d17d35b7e1b966802e9f I’m not sure what to use. Closest thing that comes to mind is #inject but don’t know how to do #inject on strings
[17:17:31] leftylink: I guess I understand why you'd say that if you're combining two things, but if you're combining two things into one (as opposed to many things into one) it doesn't seem to buy a lot to use inject/reduce. how about if I say that as a human, the way I would do that is "first I have monday. I look at _from and _to for monday. next I have tuesday. I look at _from and _to for tuesday, and so on for the other
[17:18:04] bijan_: has joined #ruby
[17:21:15] havenwood: &>> >> {"mon_from"=>"14:00", "mon_to"=>"16:00", "tue_from"=>"12:00", "tue_to"=>"19:00"}.group_by { |day_range, _| day_range[0..2] }.map { |day, a| "#{day} #{a.map(&:last).join('-')}" }
[17:21:16] havenwood: #=> ["mon 14:00-16:00", "tue 12:00-19:00"]
[17:21:16] rubydoc: stderr: -e:2: syntax error, unexpected >> (https://carc.in/#/r/70np)
[17:21:22] havenwood: xco: that's ^ one way
[17:22:09] bijan_: has joined #ruby
[17:22:44] havenwood: &>> {"mon_from"=>"14:00", "mon_to"=>"16:00", "tue_from"=>"12:00", "tue_to"=>"19:00"}.each_slice(2).map { |from, to| "#{from.first[0..2]} #{from.last}-#{to.last}" }
[17:22:45] rubydoc: # => ["mon 14:00-16:00", "tue 12:00-19:00"] (https://carc.in/#/r/70nq)
[17:22:50] havenwood: xco: or another ^
[17:24:53] kaleido: has joined #ruby
[17:24:55] ams__: has joined #ruby
[17:26:14] bijan_: has joined #ruby
[17:26:45] xco: havenwood: oh thanks. from this i can learn that anything i do each_slice(n) the number of variable should match “n” so it’ll be like naming the elements, correct?
[17:27:31] havenwood: xco: each_slice(2) just groups by two, which works since your keys are in order
[17:27:57] havenwood: xco: group_by or chomp are other options
[17:29:17] xco: awesome! thanks :)
[17:29:59] havenwood: xco: Hashes are ordered by key insertion in Ruby. Some folk consider it an anti-pattern to rely on that. I think it's actually fine.
[17:30:18] havenwood: xco: group_by is one that doesn't rely on that order
[17:30:23] havenwood: xco: chomp or each_slice do
[17:30:43] bijan_: has joined #ruby
[17:30:54] xco: so a safer bet would be group_by i guess
[17:31:06] xco: but it’s fine if i trust the order of my hash
[17:31:26] xco: or even the keys in them are unique
[17:32:28] Dbugger: has joined #ruby
[17:34:38] bijan__: has joined #ruby
[17:36:56] doodleb83: has joined #ruby
[17:37:25] havenwood: xco: you might consider changing the structure of the Hash
[17:37:26] gix: has joined #ruby
[17:37:48] xco: hmm, what does that mean?
[17:38:13] havenwood: xco: {mon: "14:00".."16:00", tue: "12:00".."19:00"}
[17:38:14] xco: by that do you mean the “strings” as keys?
[17:38:23] Nikhil_Singhal: has joined #ruby
[17:38:53] bijan_: has joined #ruby
[17:39:09] xco: isn’t that a range as values?
[17:39:15] xco: range on strings?
[17:39:53] havenwood: &>> {mon: "14:00".."16:00", tue: "12:00".."19:00"}.map { |k, v| "#{k} #{v.min}-#{v.max}" }
[17:40:00] rubydoc: # => ["mon 14:00-16:00", "tue 12:00-19:00"] (https://carc.in/#/r/70nr)
[17:40:01] havenwood: xco: I showed Symbol keys with Range values.
[17:40:11] jenrzzz: has joined #ruby
[17:40:32] xco: oh interesting and cool!
[17:40:50] xco: that’s way easier to deal with!
[17:41:56] xco: havenwood: BUT is there any added advantage to make the values a range?
[17:42:15] xco: i’m guessing just so we could check if some time falls withing the range
[17:43:20] bijan__: has joined #ruby
[17:44:45] havenwood: xco: when you model it as simply as possible, with aligned meaning, it just tends to be much easier to use
[17:45:24] havenwood: xco: it's also easy to read: mon: '14:00'..'16:00'
[17:46:09] xco: you’re right, makes sense
[17:46:13] havenwood: &>> {mon: '14:00'..'16:00', tue: '12:00'..'19:00'}[:mon].cover? '15:00'
[17:46:14] rubydoc: # => true (https://carc.in/#/r/70ns)
[17:46:46] xco: yeah and that too, that’s what i thought for the first benefit of making the values a range
[17:46:46] havenwood: &>> {mon: '14:00'..'16:00', tue: '12:00'..'19:00'}[:mon].begin
[17:46:47] rubydoc: # => "14:00" (https://carc.in/#/r/70nt)
[17:47:01] havenwood: xco: it also just reads nice ^
[17:47:13] xco: agree :)
[17:47:17] havenwood: &>> {mon: '14:00'..'16:00', tue: '12:00'..'19:00'}[:mon].end
[17:47:18] rubydoc: # => "16:00" (https://carc.in/#/r/70nu)
[17:47:54] leftylink: ACTION looks for a time-of-day in ruby stdlib
[17:48:17] leftylink: hmmmmmmmmmmmmm
[17:48:22] leftylink: guess it is not in stdlib
[17:49:38] leftylink: because then the unfortunate thing is then I might have shit like
[17:49:40] leftylink: &>> ("14:00".."23:00").cover?("1:33")
[17:49:41] rubydoc: # => true (https://carc.in/#/r/70nv)
[17:50:09] havenwood: leftylink: gotta use leading zeros :P
[17:50:16] havenwood: &>> ("14:00".."23:00").cover?("01:33")
[17:50:17] rubydoc: # => false (https://carc.in/#/r/70nw)
[17:50:34] leftylink: better hope so
[17:51:52] jenrzzz: has joined #ruby
[17:52:45] budonyc: has joined #ruby
[17:55:30] xco: is it fair to say Enumerable is the most valuable module in Ruby? by that i mean it’s ubiquitous in almost every useful application!
[17:56:09] fphilipe: has joined #ruby
[17:56:58] Nikhil_Singhal: has left #ruby: ("Leaving")
[17:58:02] havenwood: xco: There are so many important modules, it's hard to say. It's certainly one of the most commonly mixed in modules.
[18:00:39] Nikhil_Singhal: has joined #ruby
[18:00:39] havenwood: xco: Kernel is pretty important :P
[18:00:50] baweaver: havenwood: There's a Kernel of truth to that
[18:01:01] baweaver: IO is pretty high up there as well
[18:01:06] xco: also i guess it depends on the application at hand
[18:01:29] Nikhil_Singhal: Guys? I strated learning ruby 10-15 days but i m not able to the things in ruby way
[18:01:34] Nikhil_Singhal: How can i improve?
[18:01:56] havenwood: Nikhil_Singhal: show us some code you've been writing, and we can suggest improvement
[18:02:08] havenwood: Nikhil_Singhal: reading code is a good way to get ideas too
[18:04:13] xco: Nikhil_Singhal: you can also work your way up codewars, best part of that is after you solve a problem, they show you yet a better way to do it, that way you learn more and discover more “ruby ways”
[18:06:52] havenwood: baweaver: Ah shucks, it's a-maize-ing hominy corn puns you ear cobbled around this channel.
[18:07:18] ricekrispie: has joined #ruby
[18:07:59] havenwood: https://youtu.be/rhjiQHjNkV0?t=5
[18:10:28] Nikhil_Singhal: havenwood: i don't have any cide right now as im on phone but im sure i always chose a long way to a task instead of doing in in small way
[18:15:30] weteamsteve1: has joined #ruby
[18:18:31] ravenous_: has joined #ruby
[18:19:23] weteamsteve2: has joined #ruby
[18:19:23] kyrylo: has joined #ruby
[18:23:41] Eiam: has joined #ruby
[18:28:25] glik22: has joined #ruby
[18:34:04] VeryBewitching: has joined #ruby
[18:34:08] glik22: has joined #ruby
[18:36:53] exmortus: has joined #ruby
[18:46:22] esp32_prog: has joined #ruby
[18:48:16] glik22: has left #ruby: ("WeeChat 2.4")
[19:03:29] jenrzzz: has joined #ruby
[19:03:51] tdy1: has joined #ruby
[19:16:13] cd: has joined #ruby
[19:20:24] codefriar: has joined #ruby
[19:24:00] shortCircuit__: has joined #ruby
[19:31:11] bijan_: has joined #ruby
[19:34:03] gix-: has joined #ruby
[19:47:02] SeepingN: has joined #ruby
[19:47:57] graft: has joined #ruby
[19:47:57] graft: has joined #ruby
[19:52:27] salerace: has joined #ruby
[19:55:44] AlHafoudh: has joined #ruby
[19:56:29] fphilipe: has joined #ruby
[20:01:30] doodlebug: has joined #ruby
[20:07:48] deepreds1: has joined #ruby
[20:10:40] budonyc: has joined #ruby
[20:24:11] _whitelogger: has joined #ruby
[20:25:30] doodlebug: has joined #ruby
[20:34:41] esp32_prog: has joined #ruby
[20:38:21] havenwood: leftylink: almost forgot to post this, but here's a TimeOfDay class for ya: https://gist.github.com/havenwood/ae64b281cb05d4aa15799e5c354252d8
[20:38:39] deepredsky: has joined #ruby
[20:43:21] houhoulis: has joined #ruby
[20:46:13] ltem: has joined #ruby
[20:48:55] ravenousmoose: has joined #ruby
[20:48:58] deepredsky: has joined #ruby
[20:50:37] sagax: has joined #ruby
[20:53:06] Swyper: has joined #ruby
[20:56:33] teardown: i want to master fp but i think i need to dig into oo
[20:57:34] teardown: i mean, oo first
[20:59:15] nowhere_man: has joined #ruby
[21:00:53] laaron: has joined #ruby
[21:04:38] phaul: I disagree. you can master each paradigm for their own sake. the mantra of this decade seems to be that fp is the real deal, and ppl start believing that it's something more that the other paradigm are building simply up to. Actually fp was first, and for a long time ppl were thinking the exact reverse. Imho the comparison or the merges of these paradigms are not that useful. Spending time in each is
[21:05:12] phaul: but each decade bring it own new set of buzzwords and craze
[21:05:56] teardown: I see what your point. Yes I just feel i could be missing out on useful parts of the language, since i lack a good grasp on oo concepts, while i'm using a lot of fp
[21:06:40] teardown: i think you nailed it when you said 'spending time with each is'
[21:06:47] phaul: for oo I recommend look into smalltalk
[21:07:01] phaul: or these days pharo
[21:07:09] phaul: which is smalltalk relly
[21:07:12] teardown: nice. i have the smalltalk book
[21:07:27] laaron: has joined #ruby
[21:07:27] teardown: maybe i spend a few weeks working through it
[21:07:42] phaul: ruby is good too but way too much fluff to see the concepts
[21:09:08] phaul: beauty of pharo/smalltalk is that the language itself fits on a postcard
[21:09:37] teardown: that is appealing af
[21:09:56] teardown: does it have a massive std library then
[21:10:20] phaul: it's a bit weird, unique in terms of environment
[21:10:40] teardown: it seems like ruby will be most useful after spending some time in c, scheme, and i guess also smalltalk
[21:11:39] phaul: it's a graphical integrated ui that you "boot into" and then you can start programm it
[21:12:48] phaul: ruby is nice but massively multi paradigm. you can do literally everything in any way in ruby
[21:15:35] Swyper: has joined #ruby
[21:24:50] jeremycw: has joined #ruby
[21:31:41] weteamsteve: has joined #ruby
[21:45:49] jenrzzz: has joined #ruby
[21:51:55] salerace: has joined #ruby
[21:55:24] weteamsteve: has joined #ruby
[21:56:56] fphilipe: has joined #ruby
[22:00:33] laaron: has joined #ruby
[22:01:04] agent_white: has joined #ruby
[22:01:06] agent_white: has joined #ruby
[22:01:53] megalul: has joined #ruby
[22:03:36] jeremycw: has joined #ruby
[22:04:55] agent_white: has joined #ruby
[22:07:14] AJA4350: has joined #ruby
[22:14:26] schne1der: has joined #ruby
[22:17:57] weteamsteve: has joined #ruby
[22:20:55] jenrzzz: has joined #ruby
[22:21:06] Guest7: has joined #ruby
[22:22:56] esp32_prog: has joined #ruby
[22:23:54] shortCircuit__: has joined #ruby
[22:31:45] weteamsteve1: has joined #ruby
[22:31:55] fphilipe: has joined #ruby
[22:37:10] dostoyevsky: has joined #ruby
[22:37:17] jeremycw: has joined #ruby
[22:44:04] codefriar: has joined #ruby
[22:49:07] jenrzzz: has joined #ruby
[22:56:57] zapata: has joined #ruby
[23:05:58] salerace: has joined #ruby
[23:11:48] weteamsteve: has joined #ruby
[23:19:43] weteamsteve1: has joined #ruby
[23:27:32] bambanx: has joined #ruby
[23:37:56] salerace: has joined #ruby
[23:39:32] jeremycw: has joined #ruby
[23:41:38] nwradio878887987: has joined #ruby
[23:47:05] brool: has joined #ruby
[23:50:36] doodleb4: has joined #ruby
[23:58:38] comet23: has joined #ruby