« Back to channel list

#ruby - 11 June 2019

« Back 1 day Forward 1 day »
[00:04:46] Nicmavr: has joined #ruby
[00:05:29] rbanffy: has joined #ruby
[00:08:45] arahael2: has joined #ruby
[00:09:50] houhoulis: has joined #ruby
[00:17:32] arahael2: has joined #ruby
[00:19:46] houhoulis: has joined #ruby
[00:24:26] lele: has joined #ruby
[00:25:19] arahael3: has joined #ruby
[00:28:13] lele: has joined #ruby
[00:28:23] rsh: has joined #ruby
[00:29:51] houhoulis: has joined #ruby
[00:31:41] mochiyoda: has left #ruby: ("Konversation terminated!")
[00:35:16] teclator: has joined #ruby
[00:35:51] houhoulis: has joined #ruby
[00:36:46] lele: has joined #ruby
[00:40:18] jeremycw: has joined #ruby
[00:44:30] cliluw: has joined #ruby
[00:48:34] lele: has joined #ruby
[00:52:45] fphilipe_: has joined #ruby
[00:54:50] lele: has joined #ruby
[00:59:15] bradleyprice: has joined #ruby
[01:07:19] rafadc: has joined #ruby
[01:07:26] dbugger__: has joined #ruby
[01:11:31] codefriar: has joined #ruby
[01:17:08] arahael3: has joined #ruby
[01:30:26] bradleyprice: has joined #ruby
[01:33:19] rgrant: has joined #ruby
[01:36:33] bga57: has joined #ruby
[01:45:32] havenwood: has joined #ruby
[01:45:32] havenwood: has joined #ruby
[01:49:57] duderonomy: has joined #ruby
[01:52:31] hutch: has joined #ruby
[01:52:56] Exuma: has joined #ruby
[01:53:40] cerulean: has joined #ruby
[01:55:39] fphilipe_: has joined #ruby
[02:06:05] bradleyprice: has joined #ruby
[02:12:49] hutch: has joined #ruby
[02:20:46] arahael3: has joined #ruby
[02:24:26] queip: has joined #ruby
[02:27:00] Swyper: has joined #ruby
[02:28:38] esrse: has joined #ruby
[02:32:37] weteamsteve: has joined #ruby
[02:43:18] arahael3: has joined #ruby
[02:44:53] bradleyprice: has joined #ruby
[02:52:23] Tempesta: has joined #ruby
[02:52:55] rsh: has joined #ruby
[03:06:20] bradleyprice: has joined #ruby
[03:09:10] Swyper: has joined #ruby
[03:09:10] braincrash: has joined #ruby
[03:18:48] bradleyprice: has joined #ruby
[03:19:13] hutch: has joined #ruby
[03:26:01] fphilipe_: has joined #ruby
[03:36:12] rsh: has joined #ruby
[03:39:55] Ai9zO5AP: has joined #ruby
[03:40:00] rafadc: has joined #ruby
[03:44:39] bradleyprice: has joined #ruby
[03:53:57] arahael4: has joined #ruby
[03:59:27] bradleyprice: has joined #ruby
[03:59:48] Arahael: has joined #ruby
[04:09:13] jenrzzz: has joined #ruby
[04:12:22] Arahael: has joined #ruby
[04:15:20] fphilipe_: has joined #ruby
[04:16:22] hutch: has joined #ruby
[04:21:33] leah2: has joined #ruby
[04:35:35] bradleyprice: has joined #ruby
[04:36:49] joshuacronemeyer: has joined #ruby
[04:37:05] kyrylo: has joined #ruby
[04:42:08] tdy: has joined #ruby
[04:47:24] icarus: has joined #ruby
[04:48:05] cadeskywalker: has joined #ruby
[04:48:06] syndikate: One of the codebase that am working on has a case statement where the `when` condition has multiple (more than 5) values against it. What is a better way to write this?
[04:49:30] matheusmoreira: has joined #ruby
[05:05:39] pr0ton: has joined #ruby
[05:09:34] evdubs: has joined #ruby
[05:11:15] bradleyprice: has joined #ruby
[05:11:59] Arahael: has joined #ruby
[05:14:56] cthu|: has joined #ruby
[05:15:22] conta: has joined #ruby
[05:21:37] zlogan2003: has joined #ruby
[05:22:22] bradleyprice: has joined #ruby
[05:25:41] jefffrails35: has joined #ruby
[05:35:19] Arahael: has joined #ruby
[05:43:18] ur5us: has joined #ruby
[05:43:28] bradleyprice: has joined #ruby
[05:49:04] schne1der: has joined #ruby
[05:52:58] jenrzzz: has joined #ruby
[05:53:06] lele: has joined #ruby
[05:53:08] vondruch: has joined #ruby
[05:53:50] havenwood: syndikate: Can you show the code or extract a similar example?
[05:56:30] bradleyprice: has joined #ruby
[05:56:58] conta1: has joined #ruby
[05:57:40] cerulean: has joined #ruby
[06:13:26] fphilipe_: has joined #ruby
[06:17:18] bradleyprice: has joined #ruby
[06:19:24] ua: has joined #ruby
[06:26:44] lxsameer: has joined #ruby
[06:37:56] bradleyprice: has joined #ruby
[06:38:37] dionysus69: has joined #ruby
[06:44:30] andikr: has joined #ruby
[06:45:43] mcspud: syndikate write it in Haskell, Ocaml, or any language with pattern matching :)
[06:46:07] syndikate: Haha I wish mcspud :D
[06:46:25] syndikate: I took it out into an array and used splat to compare
[06:48:21] iMadper: has joined #ruby
[06:52:06] mcspud: I feel like case would have been better :P
[06:53:15] Arahael: has joined #ruby
[06:59:04] bradleyprice: has joined #ruby
[07:00:55] moei: has joined #ruby
[07:03:14] aupadhye: has joined #ruby
[07:05:13] fphilipe_: has joined #ruby
[07:09:12] mayurvpatil: has joined #ruby
[07:12:21] Arahael: has joined #ruby
[07:12:29] baweaver: mcspud: Y'know Ruby has pattern matching right?
[07:12:51] baweaver: syndikate: If you share some of the code we'd be a lot more able to tell you if a better solution exists.
[07:13:29] mcspud: baweaver - obviously not
[07:13:36] mcspud: But does it really?
[07:14:32] mcspud: https://medium.com/@baweaver/ruby-2-7-pattern-matching-first-impressions-cdb93c6246e6
[07:14:46] baweaver: Now who wrote that article?
[07:14:50] mcspud: I know right
[07:15:00] mcspud: I wouldn't call that pattern matching though
[07:15:02] syndikate: baweaver, sure will do. I closed that work for now :D
[07:15:07] mcspud: Its just some nice predicates
[07:15:14] baweaver: Right-hand at least
[07:15:15] syndikate: Hey baweaver, are you this person -> https://www.youtube.com/watch?v=tmJlos2CST4
[07:15:41] baweaver: That was a nice wig
[07:15:43] baweaver: I like that wig
[07:15:47] mcspud: Proper pattern matching gives me union and sum ADTs :P
[07:15:52] baweaver: I go by either keystonelemur or baweaver
[07:16:03] baweaver: baweaver being short for BA Weaver
[07:16:15] syndikate: Haha nice. Good to know :D I was watching that video yesterday, gotta finish it
[07:16:15] ua: has joined #ruby
[07:16:29] baweaver: mostly because that sounds fancier and more professional
[07:16:30] baweaver: syndikate: Have you seen the video before that one?
[07:16:33] baweaver: Reducing Enumerable
[07:16:36] baweaver: Quite a fun talk
[07:16:40] baweaver: Took forever to make though
[07:16:59] ryez: has joined #ruby
[07:17:00] baweaver: Also have another talk accepted to Southeast Ruby to basically go through as much black magic as I can fit in 40m
[07:17:00] syndikate: Yes, I think I didn't finish that too, not because I didn't like it coz I haven't had much time recently
[07:17:11] baweaver: Eh, ti happens
[07:17:26] baweaver: https://southeastruby.com/
[07:17:29] syndikate: Yeah I try to squeeze them in during lunch breaks and stuff
[07:17:33] baweaver: Tales from the Ruby Grimoire
[07:17:50] baweaver: https://twitter.com/keystonelemur/status/1137483374988128256
[07:18:00] baweaver: Characters are about ready for it
[07:18:35] baweaver: It even has a quick intro chapter to it: https://gist.github.com/baweaver/1ae6761dbc121a860597acdf053433f8
[07:18:41] syndikate: I really like the way how you put so much effort, like literally making a play :D
[07:18:45] syndikate: I already follow you in twitter :D
[07:18:59] baweaver: Ah, what was your name on there?
[07:19:06] baweaver: I can never remember who I follow or don't
[07:19:29] baweaver: Would you believe me if I said I have 10 years of talks queued up already?
[07:19:30] ryez: `puts(Integer(ARGV[0]) rescue 3)` causes a syntax error, but works with an extra space after `puts`, or an extra pair of parenthesis around the argument of `puts`, do you think this is a bug?
[07:19:56] bradleyprice: has joined #ruby
[07:20:02] baweaver: ryez inline rescue requires parens around it
[07:20:42] ryez: baweaver: doesn't the existing one count?
[07:20:57] baweaver: Though I'd probably use the 2.6+ exception clause instead
[07:21:18] baweaver: Integer("x", exception: false)
[07:21:26] baweaver: Integer("x", exception: false) || default_value
[07:21:41] baweaver: Na, that one gets parsed as being parens for puts
[07:21:45] ryez: to me it's "requires extra parens" rather than "requires parens"
[07:21:47] baweaver: Ruby parser is a bit touchy
[07:21:55] dminuoso: ryez: Ruby is a big mess of syntax.
[07:22:05] dminuoso: ryez: Most of it is just iterative retrofitting features without much design. If you ask Matz & Co. they'll probably even tell you it's a feature.
[07:22:05] baweaver: dminuoso: YOU"RE ALIVE!
[07:22:29] baweaver: Welcome back from Haskell land
[07:22:30] baweaver: We made more syntax to make you mad :D
[07:22:44] dminuoso: Nah being mad is no longer necessary. I don't write Ruby anymore.
[07:22:50] DaniG2k: has joined #ruby
[07:22:50] baweaver: Did you know Ruby just added Algebraic Data Types too dminuoso?
[07:23:02] syndikate: baweaver, it's quite funny - beardonomics
[07:23:43] baweaver: dminuoso: Na, just screwing with ya. Got your hopes up though, no? How many pages of Google did you just get through?
[07:24:25] syndikate: baweaver, wow 10 years of talk. I have lot of questions
[07:24:36] baweaver: I limit it to 2-3 talks a year
[07:24:46] baweaver: and I have about 32 talk ideas drafted
[07:25:02] queip: has joined #ruby
[07:25:15] baweaver: If I really really want to go to a conference I submit 5-10 of them at once
[07:25:23] ryez: dminuoso: got it, nice feature, so I need to shut up instead of yelling loud with a bug report :-(
[07:25:37] baweaver: Then whichever talk gets accepted I tend to submit to every other conference
[07:25:54] syndikate: How do you pick up so many topics? I have been trying to much figure about something to talk at local meetups
[07:26:04] syndikate: I could use a tip or two
[07:26:04] baweaver: Whereabouts?
[07:26:08] mcspud: dminuoso fell haskell brother
[07:26:21] mcspud: Have you seen the light
[07:26:45] baweaver: Feel free to whack me on Twitter any time in DMs if I don't answer on here
[07:27:09] syndikate: Oh, okay sure. Do you prefer twitter or some other media?
[07:27:19] baweaver: I tend to check all of them in any case
[07:27:40] dminuoso: baweaver: Nope.
[07:27:40] dminuoso: baweaver: And honestly without a type system Im not interested in ADTs.
[07:27:40] dminuoso: baweaver: None, honestly. :)
[07:27:43] baweaver: Some exceptionally rarely, but Twitter isn't one of them
[07:28:02] syndikate: Alright, I will drop a message on twitter then
[07:28:29] DaRock: has joined #ruby
[07:28:53] prestorium: has joined #ruby
[07:29:46] baweaver: dminuoso: You see anything on Steep and Sorbet yet?
[07:29:51] baweaver: Ruby 3.x has static types.
[07:30:02] baweaver: As far as how exactly those get implemented, we'll see
[07:30:16] syndikate: I had read your post on pattern matching although it didn't feel natural to me initially, I will give it a go again.
[07:30:29] baweaver: I rather doubt HM though
[07:30:35] baweaver: Honestly I don't entirely understand that post
[07:30:40] dminuoso: baweaver: Ive went deep enough into type theory and language design to understand why retrofitting a type system is a really bad idea in general.
[07:30:43] syndikate: I had done some elixir before, maybe that has influenced me as well
[07:30:50] baweaver: tried to transcribe what all I saw when reading it.
[07:31:24] baweaver: It definitely needs some cleanup
[07:32:05] dminuoso: baweaver: In general you should start out with a type system, include all properties and feautres you want into it - and then carefully design the language around the type system.
[07:32:47] syndikate: What's the ADT that you guys are talking about? (Type system noob here)
[07:32:54] duderonomy: has joined #ruby
[07:32:58] baweaver: Algebraic Data Types
[07:33:05] baweaver: I'll probably write up on them some time later
[07:33:15] syndikate: Oh, somehow that reminds me of haskell
[07:33:15] dminuoso: syndikate: In principle its the idea of being able to "add" and "multiply" types together.
[07:33:17] baweaver: I have an entire talk based in Category Theory and Alice in Wonderland
[07:33:39] baweaver: That's pretty accurate, as Haskell leans heavily on them and Category Theory for abstractions
[07:33:50] dminuoso: baweaver: I wish people would stop believing that.
[07:34:00] dminuoso: But we cant be able to get rid off that myth.
[07:34:06] syndikate: dminuoso, Oh. Okay. What all did you go through to learn more about these stuff?
[07:34:07] dminuoso: *seem to be unable
[07:34:13] dminuoso: syndikate: Which stuff exactly?
[07:34:27] syndikate: Type theory and language design
[07:34:37] syndikate: I mean it's a pretty vast subject on it's own right?
[07:34:39] baweaver: Functor and Monoid are about as common as anything in Haskell, though to be fair in most any languages
[07:34:42] dminuoso: syndikate: Pierce's book Types and Programming Languages is probably the best book to read.
[07:34:48] dminuoso: (To get into)
[07:35:48] dminuoso: syndikate: To give you a quick idea of what ADTs are, it's the idea of being able to combine "union" and "struct" together in a nice fashion
[07:36:13] dminuoso: syndikate: So for example you might have the need to express `this thing is either an Int or a String`, or you might want to say "this thing has both an Int and a String"
[07:37:21] baweaver: What's funny is Reducing Enumerable is literally an introduction to Monoids without ever mentioning them
[07:37:34] syndikate: Oh, okay. They just opened a whole new perspective for me
[07:37:38] syndikate: dminuoso, thanks
[07:37:44] baweaver: Well, that, transducers, and bifunctors among others
[07:38:00] baweaver: This was a fairly good overview - http://www.tomharding.me/2017/03/03/fantas-eel-and-specification/
[07:38:02] syndikate: baweaver, that's another magic word I want to understand - monoids
[07:38:29] baweaver: syndikate: Do you know how reduce works?
[07:38:39] syndikate: I believe so atleast
[07:38:42] baweaver: &>> [1,2,3].reduce(0) { |a, i| a + i }
[07:38:48] baweaver: What's the 0 for?
[07:38:48] rubydoc: # => 6 (https://carc.in/#/r/722a)
[07:38:51] syndikate: accumulator
[07:39:00] syndikate: The initial value
[07:39:13] baweaver: True, but as an init\al value what significance does it have?
[07:39:21] syndikate: Sets the type of result?
[07:39:33] baweaver: Anything plus 0 is that number
[07:39:45] baweaver: so 0 doesn't really do anything, it's "empty"
[07:40:29] baweaver: + is how you join numbers together to get a new number
[07:40:53] baweaver: Those two properties are called Identity (empty) and Closure (binary operation to join, returns same type)
[07:40:55] bradleyprice: has joined #ruby
[07:41:20] baweaver: Add one more property, Associativity, and you have a Monoid. Associativity is being able to group them as long as the order stays the same
[07:41:39] baweaver: a + b + c == (a + b) + c == a + (b + c)
[07:42:29] baweaver: So Integers with the operation + behave like a Monoid
[07:42:30] baweaver: Mono - one, oid - like
[07:42:35] baweaver: Like one, or in other words, reducible
[07:43:10] baweaver: Granted that Integer addition has a few more properties to it that make it into something entirely different called an Abelian Group
[07:43:25] baweaver: Inversion - any operation can be inverted, like + 1 by + -1
[07:43:47] baweaver: Commutativity - You can combine elements in any order and get the same result
[07:44:03] mayurvpatil: has joined #ruby
[07:44:25] dminuoso: ACTION is not convinced that free monoids are the best way to introduce what a monoid is..
[07:44:25] dminuoso: syndikate: The term Monoid captures the raw idea of "combining two things together into one" in a way that makes sense. Integer multiplication, integer addition, array concatenation, string concatenation, picking the lesser of two natural numbres..
[07:45:23] dminuoso: syndikate: Anything more is just overwhelming and requires studying many examples in a setting where you can actually make use of what monoid captures
[07:45:32] syndikate: baweaver, Thanks a lot! Man those re some good stuff in simple words. Saved it
[07:45:46] syndikate: dminuoso, Oh okay! Thanks that makes it more clear
[07:45:51] syndikate: So in programming where does it hold value?
[07:45:57] baweaver: Monoids are super common
[07:46:19] dminuoso: syndikate: The monoid abstraction does not hold value in languages that dont employ polymorphism.
[07:46:27] dminuoso: syndikate: Its main use is deferring the choice of a monoid to someone else.
[07:46:29] baweaver: Mostly recognizing patterns. If data behaves a certain way we can work with it in predefined methods
[07:46:43] dminuoso: syndikate: For example my API might say "Im gonna squish things together, but *you* decide using what monoid"
[07:47:05] dminuoso: syndikate: In Ruby you would generally encode this by returning a list (such that the consumer of your API can squish it together)
[07:48:05] dminuoso: syndikate: Its very general and not easy to spot unless you are in the habit of writing highly polymorphic code.
[07:48:52] dminuoso: And in languages that are very non-principled like Ruby it falls extremely short.
[07:49:49] syndikate: dminuoso, oh okay. The only polymorphism I know is from OOP.
[07:50:09] syndikate: So monois is essentially a property
[07:50:14] syndikate: Or behavior
[07:50:20] drale2k_: has joined #ruby
[07:50:24] dminuoso: syndikate: Its one way to think about it.
[07:50:26] arahael1: has joined #ruby
[07:51:33] claudiuinberlin: has joined #ruby
[07:51:51] syndikate: Okay I will go a bit more through it now that I have some understanding
[07:52:56] baweaver: Abstractions take a while to really get
[07:54:17] syndikate: What do you guys practice to understand it?
[07:54:29] baweaver: dminuoso is a better source on that
[07:54:39] baweaver: though the answer is probably playing with Haskell for a bit
[07:55:03] syndikate: Ah okay, I may not have enough time for another language atm :(
[07:59:11] dminuoso: syndikate: A motivating example might be the notion of a log.
[07:59:25] dminuoso: syndikate: Imagine you have some area of code that wants to "append to a log"
[08:00:06] dminuoso: So you'd start by thinking of a log as just string concatenation. You concatenate new entries onto the existing log.
[08:00:28] dminuoso: And if, for symmetry reasons, you were forced to emit log entries even if you didn't have anything to say you could still emit an empty string.
[08:00:45] dminuoso: Which is fine, because concatenating an empty string to some string A yields that same string A back.
[08:01:45] dminuoso: But perhaps we are not interested in a string log. Perhaps our log is just a "number of actions taken". So instead of emitting strings that get concatenating, you could emit numbers that get added.
[08:01:53] bradleyprice: has joined #ruby
[08:02:28] dminuoso: Now remember since we said, we might be forced to emit a log entry even if no action is taken. We could emit 0 in those cases, which is fine because adding 0 to a number does not change it.
[08:04:46] dminuoso: Or perhaps you have some software processing personal data, and the log is keeping track of the "oldest person" seen. If at some point you are not processing any person but were forced to produce a log entry, you could produce "0 years".
[08:07:32] syndikate: Oh okay, yeah it's starting to make some sense now
[08:09:02] dminuoso: syndikate: Now you might begin to see that in all cases you are somehow "combining/smashing" 2 into 1, and you always have a special element you can throw into the binary operation to produce a noop
[08:10:39] syndikate: Yeah like a reducer, has an accumulator with initial value.
[08:11:47] syndikate: A noob doubt here - so if am writing a moonoid function it would have a local value inside (closure like) which has the default starting value?
[08:11:47] mikecmpbll: has joined #ruby
[08:14:17] brendan-: has joined #ruby
[08:15:03] Mike11: has joined #ruby
[08:17:47] dminuoso: syndikate: Well the ergonomics become an important topic.
[08:18:09] Jonopoly: has joined #ruby
[08:18:33] dminuoso: syndikate: we could consider a module called Monoid, sort of like an interface, that you can include into a class.
[08:19:25] dminuoso: syndikate: One would be `def mappend(other); ... implement here; end` and the other would be `def mempty; ... implement here; end`
[08:19:44] dminuoso: Or rather `def self.mempty` in Ruby I guess.
[08:20:58] syndikate: Okay gotcha, you are talking as monoid as on object, I was talking monoid as function
[08:22:32] dminuoso: syndikate: well the method mappend captures that function.
[08:22:43] dminuoso: syndikate: Ruby just doesnt have any tools to write polymorphic code.
[08:23:20] syndikate: Okay, I will have to not think it from ruby then.
[08:26:21] ur5us: has joined #ruby
[08:28:11] ur5us: has joined #ruby
[08:33:49] arahael2: has joined #ruby
[08:38:03] Fischmiep: has joined #ruby
[08:39:14] mayurvpatil_: has joined #ruby
[08:39:41] RougeR: has joined #ruby
[08:41:45] mayurvpatil_: has joined #ruby
[08:44:28] rsh: has joined #ruby
[08:45:22] dostoyevsky: has joined #ruby
[08:47:10] dostoyevsky: has joined #ruby
[08:51:34] arahael3: has joined #ruby
[08:52:43] dminuoso: has left #ruby: ("WeeChat 2.2")
[08:57:53] dostoyevsky: has joined #ruby
[08:58:29] dionysus69_: has joined #ruby
[09:04:18] arahael4: has joined #ruby
[09:08:30] xfbs: has joined #ruby
[09:12:55] cd: has joined #ruby
[09:16:10] m04ftKK: has joined #ruby
[09:19:48] queip: has joined #ruby
[09:24:25] DaniG2k: has joined #ruby
[09:24:48] DaniG2k: hello all. I'm trying to set up webpacker in my Rails 4 app. However, I cant seem to get it working with CircleCI
[09:25:06] DaniG2k: I've explained the actual error in this SO thread: https://stackoverflow.com/questions/55570569/rails-4-getting-webpacker-to-work-with-circleci/56521522
[09:26:11] DaniG2k: but basically the error I'm seeing in CircleCI is: ActionView::Template::Error: Webpacker can't find application in /home/circleci/octopi/public/packs-test/manifest.json
[09:39:40] DaniG2k: oops sorry, thought I was in the Rails channel. Will ask there
[09:46:51] vondruch_: has joined #ruby
[09:49:22] arahael4: has joined #ruby
[09:52:11] mayurvpatil_: has joined #ruby
[09:55:48] mayurvpatil: has joined #ruby
[10:01:07] claudiuinberlin: has joined #ruby
[10:05:18] cerulean: has joined #ruby
[10:06:47] vondruch: has joined #ruby
[10:07:10] fphilipe_: has joined #ruby
[10:15:53] schne1der: has joined #ruby
[10:18:02] Swyper: has joined #ruby
[10:20:39] drale2k_: has joined #ruby
[10:21:42] conta: has joined #ruby
[10:27:53] bradleyprice: has joined #ruby
[10:43:50] queip: has joined #ruby
[10:44:31] Nicmavr: has joined #ruby
[10:44:37] ur5us: has joined #ruby
[10:44:39] rsh: has joined #ruby
[10:45:40] apparition: has joined #ruby
[10:48:46] bradleyprice: has joined #ruby
[10:50:35] kyrylo: has joined #ruby
[10:51:37] xco: has joined #ruby
[10:57:18] xco: hi! just to be sure are these equivalent?
[10:57:27] arahael4: has joined #ruby
[10:57:31] xco: do_something & return
[10:57:35] xco: do_something and return
[10:57:46] rsh: has joined #ruby
[10:57:59] phaul: did you mean &&?
[10:58:25] xco: well then i’m confused. what i want to achieve is, i want to return, but before return do_something
[10:58:40] xco: and thought the best way to do this would be to use &
[10:58:43] xco: as opposed to &&
[10:58:58] xco: which is logic AND
[10:59:15] phaul: & is the bitwise and operator. && is the logic and. "and" is the control flow and
[10:59:15] rubydoc: parser error at position 0 around ` '
[10:59:18] xco: so no, i meant & not &&
[10:59:39] xco: so in this cause it’d be
[10:59:46] phaul: & typically used to and bitwise
[10:59:46] xco: do_something && return
[11:00:01] xco: do_something and return
[11:00:18] leftylink: maybe I can suggest `tap`
[11:00:31] xco: leftylink: what?! :D
[11:00:58] phaul: tap can be used for that, but also "and" is inherited from perl for the use case you described
[11:01:16] phaul: ppl usually don't like it because it might have surprising precedence
[11:01:33] xco: which means && is best practice i’d assume
[11:02:10] phaul: well if do something is assign a variable then no.
[11:02:22] xco: it’s a method
[11:02:25] leftylink: I seem not to understand though. if I want to do_something and then return, then it'd be `do_something\nreturn`. so there must be some context I am missing
[11:02:54] phaul: https://github.com/phaul/ruby_101/blob/master/content/book.md#and-or--
[11:03:09] xco: `do_something\nreturn` makes sense but i find it a bit weird to have the return all by itself like that
[11:04:48] phaul: so what's there under the link is that a = true and false is (a = true) and false whereas a = true && false is a = (true && false)
[11:04:54] leftylink: how about a semicolon.
[11:04:57] clemens3: has joined #ruby
[11:05:01] leftylink: if you must put it on a same line
[11:05:19] alotofnoodles: has joined #ruby
[11:05:21] leftylink: but I will be sad as a reader of the code if I have to look for `return` in places where I not expecting it
[11:05:33] leftylink: ... so that depends on setting the reader's expectations
[11:06:18] phaul: I have never written code in ruby with and myself. but my undesrtanding of the intention behind it is this flow control
[11:06:31] phaul: inherited from perl
[11:07:26] GodFather: has joined #ruby
[11:07:43] phaul: it's the dual of the perlism : do stuff or die
[11:07:56] leftylink: I must be frustrating, making alternative suggestions instead of answer the question. I will recuse myself
[11:08:17] leftylink: see you all in the next question
[11:08:37] queip: has joined #ruby
[11:09:11] phaul: leftylink: I agree with your suggestion, but I wanted to give a bit of background
[11:09:42] bradleyprice: has joined #ruby
[11:10:02] leftylink: oh hmm, I realised, the fact that my suggestion of newline was accepted without complaint implies that the returning may not have been conditional on do_something. making it conditional is when I would have considered using some of the original questioned things
[11:10:08] leftylink: better make it clear
[11:10:27] leftylink: whether returning is conditional on do_something's truthiness
[11:11:12] arahael4: has joined #ruby
[11:12:51] teclator: has joined #ruby
[11:17:25] phaul: xco did this clear up things?
[11:17:53] xco: phaul: i only understood it as do_something \nreturn is the best way to go
[11:18:21] phaul: that's actually different not the same program.
[11:18:45] xco: so i got more confused then
[11:18:50] xco: better questin would be
[11:19:05] phaul: that doesn't depend on the truthiness of the do_something whereas the versions with and do
[11:19:19] xco: aaaah ok
[11:19:37] xco: but executing a method is almost always true? no?
[11:22:49] xco: phaul: this is what i’m talking about https://gist.github.com/xcobar/23d919440b2779cf10c7c88a87a0076f
[11:23:10] xco: i want something? to be check first, once it’s satisfied, the whole method should stop
[11:23:43] xco: and not even check for another_thing?
[11:24:23] phaul: ok. so I think the way it's been done there is the best, because you don't care about the return value of do_something
[11:24:41] xco: no i don’t, i just want it to be done
[11:24:45] aupadhye: has joined #ruby
[11:24:56] phaul: line 7-9 could be reduced to do_something_else if another_thing?
[11:25:43] Arahael: has joined #ruby
[11:26:07] m04ftKK: has joined #ruby
[11:30:33] bradleyprice: has joined #ruby
[11:31:41] reber: has joined #ruby
[11:45:01] Arahael: has joined #ruby
[11:45:24] fphilipe_: has joined #ruby
[11:47:16] AJA4350: has joined #ruby
[11:56:45] TQBFJOTLD: has joined #ruby
[11:56:49] Arahael: has joined #ruby
[11:57:30] DaRock: has joined #ruby
[11:59:26] aupadhye: has joined #ruby
[12:04:33] conta1: has joined #ruby
[12:06:20] bradleyprice: has joined #ruby
[12:14:16] Arahael: has joined #ruby
[12:22:57] m04ftKK: has joined #ruby
[12:27:47] bradleyprice: has joined #ruby
[12:36:55] ljarvis: has joined #ruby
[12:40:25] jinie: has joined #ruby
[12:46:45] AJA4351: has joined #ruby
[12:48:41] bradleyprice: has joined #ruby
[13:03:45] Arahael: has joined #ruby
[13:06:18] DarthGandalf: has joined #ruby
[13:06:49] bradleyprice: has joined #ruby
[13:07:01] silviu: has joined #ruby
[13:08:26] exmortus: has joined #ruby
[13:10:48] exmortus: has joined #ruby
[13:11:51] staticx: has joined #ruby
[13:12:29] cthulchu_: has joined #ruby
[13:17:20] Arahael: has joined #ruby
[13:19:13] silviu8: has joined #ruby
[13:21:55] deathwishdave: has joined #ruby
[13:24:43] xco: has joined #ruby
[13:28:09] bradleyprice: has joined #ruby
[13:34:37] drale2k_: has joined #ruby
[13:36:07] dviola: has joined #ruby
[13:36:41] Rapture: has joined #ruby
[13:38:31] hutch: has joined #ruby
[13:49:02] bradleyprice: has joined #ruby
[13:53:09] Arahael: has joined #ruby
[13:59:12] arahael1: has joined #ruby
[13:59:30] AJA4350: has joined #ruby
[14:01:24] bradleyprice: has joined #ruby
[14:01:38] Inline: has joined #ruby
[14:01:45] brool: has joined #ruby
[14:04:53] jeremycw: has joined #ruby
[14:07:09] Inline: has joined #ruby
[14:09:27] cerulean: has joined #ruby
[14:10:39] GodFather: has joined #ruby
[14:16:23] rippa: has joined #ruby
[14:30:26] arahael1: has joined #ruby
[14:30:56] conta1: has joined #ruby
[14:32:06] teclator: has joined #ruby
[14:38:29] duderonomy: has joined #ruby
[14:40:42] dar123: has joined #ruby
[14:43:59] franklinyu: has joined #ruby
[14:44:52] franklinyu: Hi everyone. I raised a bug https://bugs.ruby-lang.org/issues/15665 but it was changed to "Feature". How to change it back to bug?
[14:45:59] mayurvpatil: has joined #ruby
[14:46:02] franklinyu: It is labeled as feature so it will only be in 2.7 branch, but I want it to be in 2.6 branch as well.
[14:50:41] mayurvpatil: has joined #ruby
[14:53:33] bradleyprice: has joined #ruby
[14:55:40] silviu: has joined #ruby
[14:58:01] ryez: has joined #ruby
[14:58:08] havenwood: franklinyu: Your comment should be sufficient for nobu to get the heads up. I might ping again on that thread after a week or so.
[15:00:00] franklinyu: havenwood: Thanks for the confirmation!
[15:00:20] arahael2: has joined #ruby
[15:03:20] mayurvpatil: has joined #ruby
[15:04:32] AJA4351: has joined #ruby
[15:11:46] arahael2: has joined #ruby
[15:29:39] Dbugger: has joined #ruby
[15:30:19] queip: has joined #ruby
[15:33:46] schne1der: has joined #ruby
[15:37:46] orbyt_: has joined #ruby
[15:43:47] rbanffy: has joined #ruby
[15:46:51] pr0ton: has joined #ruby
[15:49:38] joshuacronemeyer: has joined #ruby
[15:52:42] arahael2: has joined #ruby
[15:55:04] mayurvpatil: has joined #ruby
[15:57:32] fphilipe_: has joined #ruby
[16:01:08] arahael3: has joined #ruby
[16:03:41] znz_jp: has joined #ruby
[16:04:20] code_zombie: has joined #ruby
[16:09:45] AJA4351: has joined #ruby
[16:13:10] octos: has joined #ruby
[16:13:34] GodFather: has joined #ruby
[16:20:03] arahael3: has joined #ruby
[16:27:19] tdy: has joined #ruby
[16:30:17] r29v: has joined #ruby
[16:33:39] arahael4: has joined #ruby
[16:38:13] hiroaki: has joined #ruby
[16:39:27] Renich: has joined #ruby
[16:42:10] Arahael: has joined #ruby
[16:43:41] Harlin: has joined #ruby
[16:46:33] sputnik13: has joined #ruby
[16:48:09] AndreYuhai: has joined #ruby
[16:49:36] AndreYuhai: Hello there, I have a script and I want it to run everyday. And the script needs user input. Can I do it without using cronjob or sleep?
[16:50:44] schne1der: has joined #ruby
[16:54:40] sameerynho: has joined #ruby
[16:54:43] havenwood: AndreYuhai: Why don't you want to use a cronjob or sleep? How are users providing input?
[16:58:27] havenwood: AndreYuhai: For periodic timers in general, check out the timers gem: https://github.com/socketry/timers
[17:00:54] AndreYuhai: havenwood: Well, I don't know if there is any pros or cons to sleep so I wanted to ask whether there are other ways to do it. The input would either be two dates or one date (that day's date). So I also do not know whether I can also get the date automatically for the cronjob. But I am searching and I will also check that gem. Thank you :)
[17:01:38] duderonomy: has joined #ruby
[17:03:24] greypack: has joined #ruby
[17:04:05] havenwood: AndreYuhai: A con of sleep is that it'll slip forward a little bit every day.
[17:04:28] havenwood: AndreYuhai: The task itself takes some time, so sleeping 24 hours will always sleep a little later each day.
[17:06:15] AndreYuhai: havenwood: But would it still do that if we specify an exact date? Instead of saying 24 hours. I mean by checking the actual date and etc.
[17:14:29] Renich: has joined #ruby
[17:14:46] arahael1: has joined #ruby
[17:15:50] SeepingN: has joined #ruby
[17:17:53] rbanffy: has joined #ruby
[17:23:28] salerace: has joined #ruby
[17:31:47] nowhere_man: has joined #ruby
[17:35:44] arahael1: has joined #ruby
[17:38:43] havenwood: AndreYuhai: You can't specify a date for Kernel#sleep, just seconds.
[17:39:41] havenwood: AndreYuhai: Cronjobs on the other hand can run on a date, no prob.
[17:39:44] queip: has joined #ruby
[17:40:08] havenwood: AndreYuhai: Or you mean you're sleeping for a shorter duration, and checking the date?
[17:40:22] russt: has joined #ruby
[17:44:50] _dbugger: has joined #ruby
[17:50:39] arahael1: has joined #ruby
[17:53:01] xco: has joined #ruby
[17:53:20] orbyt_: has joined #ruby
[17:54:38] AJA4350: has joined #ruby
[18:00:33] arahael2: has joined #ruby
[18:00:42] queip: has joined #ruby
[18:09:02] arahael2: has joined #ruby
[18:19:44] AndreYuhai: havenwood: Yes, for example sleeping for a period of time and checking the date constantly, for example sleeping for a few hours instead of 24. Sorry for the delay by the way.
[18:23:45] havenwood: AndreYuhai: You can run a cronjob daily, and each day have it check the day. Alternatively you can user the timers gem and do the same.
[18:25:41] AndreYuhai: havenwood: Oh that is a good idea as well. I guess I will go with the cronjob but I will also check the timer gem. Thank you. By the way would there be any consequence of using 'sleep' on the server side compared to cronjobs?
[18:27:14] havenwood: AndreYuhai: With sleep, the time it runs just slips over and over. You need to do at least twice a day, to make sure it doesn't line up and slip so it doesn't skip a day. The timers gem keeps a separate thread so it can track the time without slipping.
[18:27:26] faitswulff: has joined #ruby
[18:27:43] havenwood: AndreYuhai: Cronjobs tend to work!
[18:27:50] kaleido: has joined #ruby
[18:28:03] havenwood: AndreYuhai: As long as your logic allows for it, sleep should do the trick.
[18:28:26] havenwood: AndreYuhai: If you don't want to have time slip between sleeps, the timers gem handles that for you.
[18:28:44] AndreYuhai: havenwood: Okay, thanks for the help. :) I will also check the timers gem and then decide which one to use.
[18:31:12] havenwood: AndreYuhai: You might want to look at the whenever gem too, for your crontab.
[18:31:17] havenwood: AndreYuhai: You're welcome!
[18:31:35] havenwood: https://github.com/javan/whenever#example-schedulerb-file
[18:31:49] havenwood: Or just use a crontab ¯\_(ツ)_/¯
[18:33:54] octos: has joined #ruby
[18:34:42] arahael2: has joined #ruby
[18:43:06] infernix: has joined #ruby
[18:44:52] GodFather: has joined #ruby
[18:45:14] arahael2: has joined #ruby
[18:45:45] salerace: has joined #ruby
[18:50:34] x0F_: has joined #ruby
[18:51:19] arahael2: has joined #ruby
[18:55:56] x0F: has joined #ruby
[19:04:05] arahael2: has joined #ruby
[19:08:35] Nahra: has joined #ruby
[19:12:41] Darsoma: has joined #ruby
[19:15:29] arahael2: has joined #ruby
[19:24:51] AJA4350: has joined #ruby
[19:26:55] salerace: has joined #ruby
[19:27:46] Ai9zO5AP: has joined #ruby
[19:29:35] bradleyprice: has joined #ruby
[19:31:06] infernix: has joined #ruby
[19:35:36] arahael2: has joined #ruby
[19:40:07] deathwishdave: has joined #ruby
[19:40:09] Ai9zO5AP: has joined #ruby
[19:46:01] arahael2: has joined #ruby
[19:46:31] i9zO5AP: has joined #ruby
[19:52:20] prestorium: has joined #ruby
[19:59:24] gix: has joined #ruby
[20:06:31] sgen: has joined #ruby
[20:14:27] kyrylo: has joined #ruby
[20:16:28] ricekrispie: has joined #ruby
[20:17:38] bradleyprice: has joined #ruby
[20:24:20] bradleyprice: has joined #ruby
[20:24:47] sputnik13: havenwood: thanks, I guess it's an app thing then, I'll explore further, thanks again
[20:30:28] Eiam: has joined #ruby
[20:34:58] _dbugger: has joined #ruby
[20:35:23] dviola: has joined #ruby
[20:36:49] arahael2: has joined #ruby
[20:39:28] snosk8r: has joined #ruby
[20:46:09] arahael2: has joined #ruby
[20:51:05] arahael3: has joined #ruby
[20:56:30] theRoUS: has joined #ruby
[20:57:24] theRoUS: I'm upgrading an old laptop; right now it's at Fedora 29. The ruby `gem` command is varfing as shown here: https://pastebin.com/Kjv263aB
[20:57:24] ruby[bot]: theRoUS: we in #ruby do not like pastebin.com, it loads slowly for most, has ads which are distracting and has terrible formatting. Please use https://gist.github.com
[20:58:41] theRoUS: geez. what happened to minswan? :-/
[21:00:06] Paraxial: has joined #ruby
[21:01:00] arahael4: has joined #ruby
[21:01:11] xco: has joined #ruby
[21:04:23] prestorium: has joined #ruby
[21:05:45] rbanffy: has joined #ruby
[21:06:39] phaul: the bot is a bit picky but ppl usually check whatever you paste on
[21:08:48] octos: has joined #ruby
[21:10:02] theRoUS: phaul: maybe pastebin is a pain to read for some, but gist is (IMHO) a royal PITA to paste *to*. https://gist.github.com/RoUS/3c4ca47a971ed0bd4d2b86d501eb1dbf
[21:11:03] theRoUS: any road, the `gem` command is broken, and reinstalling ruby, libyaml, rubygems, and ruby-libs has no effect. just typing `gem` fails, much less the `gem pristine bundler` i need to do. :-(
[21:11:11] phaul: i did look at your pastebin but unfortunately I don't have a suggestion.
[21:11:35] gnufied: has joined #ruby
[21:12:53] phaul: ACTION said "ignore the bot for now" way too many times
[21:17:46] queip: has joined #ruby
[21:18:35] hiroaki: has joined #ruby
[21:19:09] faitswulff: has joined #ruby
[21:19:49] leftylink: it seems it is being ignored a lot. WHAT IF!!! something automatically took the content and put it on another paste service..!!!!!!!!!!!!!!
[21:20:45] leftylink: would that get complaints of "I didn't consent for you to take my content and put it elsewhere"
[21:21:02] theRoUS: phaul: foo: `cd /usr/lib64 ; ln -s libruby.so.2.5.5 libruby.so.2.4` worked around it. the fedora-supplied rubygem-psych wants libruby.so.2.4; faking it out seems to make it wonky-work
[21:22:49] tdy: has joined #ruby
[21:24:17] Nicmavr: has joined #ruby
[21:26:07] ur5us: has joined #ruby
[21:28:29] phaul: leftylink: maybe. it feels very specific to copy pastebin pastes (because that's the only thing rubybot cares about) to anywehere else. Imho that thing should just not be said any more. But I know the issues with this. rubybot is our legacy, and we are waiting for apeiros to return and decide how to move forward... And when rubydoc was born I didn't just put it into rubybot because its all in ruby2.3 I think
[21:29:34] phaul: and you dont really want to code ruby 2.3 in 2028/19 for fun
[21:30:36] phaul: I mean rubybot is 2.3
[21:39:56] bradleyprice: has joined #ruby
[21:46:38] Net: What's the idiomatic way to return the status of a method call?
[21:46:58] Net: e.g. :email_sent, :email_blocked, :no_connection, etc.
[21:51:08] hightower2: has joined #ruby
[21:51:26] hightower2: has joined #ruby
[21:55:02] Paraxial: has joined #ruby
[21:55:20] Swyper: has joined #ruby
[22:07:13] queip: has joined #ruby
[22:11:03] sgen: has joined #ruby
[22:11:58] matheusmoreira: has joined #ruby
[22:12:01] rgrant: has joined #ruby
[22:13:11] nowhere_man: has joined #ruby
[22:13:39] Swyper: has joined #ruby
[22:17:07] arahael4: has joined #ruby
[22:20:04] bradleyprice: has joined #ruby
[22:21:03] cerulean: has joined #ruby
[22:21:58] tdy: has joined #ruby
[22:24:06] adam12: Net: If those are exceptional cases, maybe you want to raise an exception.
[22:25:00] adam12: Net: If they are flow control, don't raise the exception. You could use a struct called Result that has a reason being one of those symbols. Or you can just return the symbol.. I am not sure there's any real common idiom.
[22:25:23] adam12: Net: As a third option, you could look at using a result monad. There's a bunch around: Resonad or Dry-monads being 2 gems.
[22:25:47] exmortus: has joined #ruby
[22:27:39] arahael4: has joined #ruby
[22:31:40] hutch: has joined #ruby
[22:38:24] arahael4: has joined #ruby
[22:40:50] galaxie: has joined #ruby
[22:51:49] arahael4: has joined #ruby
[22:51:52] queip: has joined #ruby
[23:01:32] arahael4: has joined #ruby
[23:05:09] DaRock: has joined #ruby
[23:07:31] Azure|dc: has joined #ruby
[23:30:54] Calinou: has joined #ruby
[23:34:20] bradleyprice: has joined #ruby
[23:42:42] sgen: has joined #ruby
[23:46:03] rsh: has joined #ruby
[23:51:08] ivanskie: has joined #ruby
[23:51:37] ivanskie: hi is there a way to make siure hash.to_json always makes everything a string, and wraps everything in quotes?
[23:51:49] ivanskie: for some reason it leaves integers and bools as is.
[23:55:54] leftylink: hmm, although that doesn't sound like something I would personally want (I would prefer that integers should stay integers and bools should stay bools), if I wanted to do that, I would use WELL GUESS I DON'T NEED TO TYPE AN ANSWER NOW
[23:56:21] leftylink: sorry for the caps, I was very vexed
[23:58:11] bradleyprice: has joined #ruby