« Back to channel list

#ruby - 06 August 2018

« Back 1 day
[00:05:51] patr0clus: has joined #ruby
[00:12:59] apeiros: has joined #ruby
[00:45:07] edwardly: has joined #ruby
[00:49:56] baweaver: So I had a bad idea
[00:50:05] baweaver: How can I get something to pretend it's Object without overwriting Object methods?
[00:50:16] baweaver: Such that: 1.is_a?(Any) -> true
[00:50:37] baweaver: `is_a?` returns true if the class is anywhere in its ancestary.
[00:50:59] baweaver: >> Any = Object; 1.is_a?(Any) # This works, sure, but....
[00:51:01] ruby[bot]: baweaver: # => true (https://eval.in/1044764)
[00:51:35] baweaver: >> Any = Object; def Any.===(o) true end; Any === 1 # This seems to crash
[00:51:36] ruby[bot]: baweaver: # => true (https://eval.in/1044765)
[00:51:57] baweaver: Oh, so just Pry, though I feel like that overrides the base.
[00:52:20] baweaver: Yeah, it flips out IRB too.
[00:52:58] baweaver: havenwood / apeiros: help me do bad things to Ruby again
[00:53:04] baweaver: https://github.com/baweaver/any
[00:54:12] elphe: has joined #ruby
[01:09:41] havenwood: baweaver: Ah, interesting.
[01:09:44] havenwood: baweaver: hmm
[01:09:58] havenwood: baweaver: Object.method(:===).owner #=> Module
[01:10:24] havenwood: BasicObject.method(:===).owner #=> Module
[01:13:31] havenwood: Object === Pry::Config.new #=> false
[01:15:57] baweaver: IRB goes straight into an infinite loop
[01:16:04] baweaver: Waitasecond
[01:16:12] baweaver: How does a class know its own name?
[01:16:32] baweaver: If there were a way to cheat and tap that, making it think it's an "Object" then...
[01:20:17] baweaver: havenwood: Got a new idea
[01:20:39] baweaver: Circus theme, Indigo as the ring master, cue: The Most RSpectacular Show on Earth!
[01:20:53] baweaver: Each of the rings correspond to one type of testing
[01:20:59] baweaver: Unit, Integration, Acceptance
[01:22:06] banisterfiend: has joined #ruby
[01:22:29] havenwood: baweaver: "moar tests!" roared the lion!
[01:22:44] baweaver: Testy testy aren't you?
[01:23:00] havenwood: "rwar tests" roared zenspider!
[01:23:33] baweaver: I'd kinda like to give "Reducing Enumerable - An Illustrated Guide" a few more runs before I start on another super ambitious presentation
[01:24:16] baweaver: That said, I'm also massively faster now in preparing them
[01:27:39] this_dude: has joined #ruby
[01:27:52] this_dude: anyone online?
[01:28:42] this_dude: trying to code a method to do the following: Write a method that takes in a string of lowercase letters and # spaces, producing a new string that capitalizes the first letter of each word
[01:28:57] this_dude: running across some trouble
[01:28:59] baweaver: What have you tried
[01:29:19] this_dude: do i post my code so far on the github?
[01:29:30] baweaver: Yeah, that should work.
[01:30:13] this_dude: oh do i need to be registered or something?
[01:30:28] baweaver: channel is fine
[01:30:45] this_dude: its more than 3 lines D:
[01:30:59] baweaver: https://paste.debian.net/
[01:31:03] baweaver: Some people have used that
[01:31:46] this_dude: ok i posted what i have so far
[01:32:12] this_dude: obvious its wrong as i keep returning an "undefined local variable or method" error
[01:32:19] this_dude: but idk where to go from there..
[01:33:26] this_dude: actually here ...to make our lives easier
[01:33:51] this_dude: http://prntscr.com/kf3f4t
[01:34:27] ruby[bot]: https://gist.github.com - Multiple files, syntax highlighting, even automatically with matching filenames, can be edited
[01:34:51] this_dude: idk how to use the gist link
[01:34:55] baweaver: So you want to capitalize every word then?
[01:35:01] this_dude: yeah basically
[01:35:22] baweaver: >> 'this is a sentence'.split(' ') # This gets you an array of words
[01:35:23] ruby[bot]: baweaver: # => ["this", "is", "a", "sentence"] (https://eval.in/1044766)
[01:35:56] baweaver: >> 'this is a sentence'.split(' ').map { |w| w.reverse } # With it you can map it to transform each word
[01:35:57] ruby[bot]: baweaver: # => ["siht", "si", "a", "ecnetnes"] (https://eval.in/1044767)
[01:36:20] havenwood: >> 'this is a sentence'.split.map(&:reverse) # Or a slightly shorter version that does the exact same thing as above.
[01:36:21] ruby[bot]: havenwood: # => ["siht", "si", "a", "ecnetnes"] (https://eval.in/1044768)
[01:36:35] baweaver: >> 'this is a sentence'.split(' ').map { |w| w.reverse }.join(' ') # That you can then join back together
[01:36:36] ruby[bot]: baweaver: # => "siht si a ecnetnes" (https://eval.in/1044769)
[01:36:51] baweaver: Yep, havenwood is correct that you can shorthand it as well
[01:36:52] this_dude: im unfamiliar with that syntax
[01:37:04] this_dude: but i dont need to reverse the words
[01:37:12] this_dude: i need to capitalize the first letter of each one
[01:37:14] baweaver: You could do anything in map
[01:37:16] havenwood: this_dude: It's similar to what you're doing, but not the exact solution.
[01:37:28] this_dude: instead of .reverse?
[01:37:54] this_dude: wait no cause that'll capitalize the whole word
[01:37:54] havenwood: this_dude: Compare #upcase, #downcase, #capitalize, and #swapcase.
[01:37:57] baweaver: Try it out.
[01:38:09] baweaver: wasn't capitalize Rails?
[01:38:21] this_dude: is this not ruby on rails
[01:38:33] baweaver: Well, a Rails only method. It's not.
[01:38:44] baweaver: Some methods are only in Rails (or activerecord)
[01:38:46] this_dude: is there a rails chat?
[01:38:51] baweaver: >> 'string'.capitalize
[01:38:52] ruby[bot]: baweaver: # => "String" (https://eval.in/1044771)
[01:38:59] havenwood: this_dude: #RubyOnRails
[01:39:06] havenwood: 18>> 'string'.capitalize
[01:39:08] baweaver: though you don't need it.
[01:39:11] ruby[bot]: havenwood: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
[01:39:20] baweaver: bot go boom
[01:39:24] havenwood: But yeah, it's been in Ruby core since forever.
[01:40:13] this_dude: in my case where I need "string".upcase
[01:40:23] this_dude: is it not the same as .capitalize?
[01:40:32] havenwood: this_dude: Try in irb or pry.
[01:40:33] baweaver: Try it out in IRB on your computer
[01:40:38] ruby[bot]: irb is "interactive ruby", it is part of ruby. You can run ruby code and see results immediately. it's useful for testing code. Also see ?pry, a gem which is a popular alternative to irb.
[01:40:40] this_dude: ok gimme a sec
[01:40:40] ruby[bot]: Pry, the better IRB, provides easy object inspection `ls`, `history`, viewing docs `?`, viewing source `$`, syntax highlighting and other features (see `help` for more). Put `binding.pry` in your source code for easy debugging. Install Pry (https://pryrepl.org/): gem install pry pry-doc
[01:40:59] this_dude: i have ruby already installes
[01:41:06] this_dude: gimme a sec to run the code
[01:42:51] this_dude: is this syntax written correctly? http://prntscr.com/kf3hcg
[01:43:33] havenwood: this_dude: One of the reasons to show us text and not an image is that we can then easily run your code.
[01:43:53] this_dude: but how can i do that if im not allowed to put more than 3 lines D:
[01:44:03] this_dude: how do i use the gist thing
[01:44:06] havenwood: Where was Radar's gist about how to gist?
[01:44:12] havenwood: That was goodl
[01:45:26] this_dude: oh i do have to sign up
[01:45:29] this_dude: smh gimme a sec
[01:45:34] havenwood: this_dude: Gists are nice because we can then comment, clone the gist, propose modifications, etc.
[01:47:06] havenwood: this_dude: https://github.com/radar/guides/blob/master/using-gist.markdown#using-gist
[01:47:09] this_dude: bruh "password has been compromised in a 3rd party data breach"
[01:47:13] this_dude: um excuse me
[01:47:27] this_dude: now im scared smh
[01:47:29] havenwood: Time to start using a new password.
[01:47:37] havenwood: Someone lost the keys to the castle.
[01:47:45] this_dude: bruh it was a secure password too
[01:47:53] this_dude: thats what i get for using the dark web
[01:49:41] this_dude: https://gist.github.com/this-dude/a67ed312d2dad756ab65d3a90f2c8ebd
[01:49:44] this_dude: there ya go
[01:50:03] baweaver: So you know how split and map works
[01:50:11] baweaver: what if you replaced reverse with something else?
[01:51:22] this_dude: i dont think that syntax you used works in rails does it?
[01:51:49] this_dude: { |w| w.reverse }
[01:51:54] this_dude: idk how this works
[01:52:15] this_dude: it wasnt in the material provided to study for my entrance exams..
[01:52:19] havenwood: this_dude: Ruby syntax always works in Rails.
[01:52:30] havenwood: this_dude: Blocks might not have been on your entrance exam.
[01:54:19] this_dude: http://prntscr.com/kf3k8m
[01:54:36] ansraliant: has joined #ruby
[01:55:28] postmodern: has joined #ruby
[01:56:54] baweaver: map, select, find, and reduce are some of the most powerful methods in Ruby.
[01:57:00] baweaver: ignoring them is a bit silly.
[01:57:10] this_dude: its a beginner level entrance exam D:
[01:57:13] baweaver: >> [1,2,3].map { |v| v * 2 }
[01:57:14] ruby[bot]: baweaver: # => [2, 4, 6] (https://eval.in/1044772)
[01:57:24] this_dude: i was given 10 days to learn the basics enough to pass 2 entrance exams
[01:57:26] this_dude: im on day 4
[01:57:31] baweaver: Map takes a function ({ |v| v * 2 })
[01:57:36] baweaver: and runs it for every element
[01:57:46] this_dude: what is the "v"
[01:58:01] this_dude: random name for the array?
[01:58:09] baweaver: In javascript it may look like this: function (v) { return v * 2; }
[01:58:15] baweaver: v is the argument to the function
[01:58:22] baweaver: v * 2 is what it does with it
[01:58:34] this_dude: okay and earlier you used w
[01:58:39] this_dude: whats the difference
[01:58:42] baweaver: It could be anything
[01:59:03] baweaver: >> [1,2,3].map { |anything| anything * 2 } # depending on how literal you want to be
[01:59:04] ruby[bot]: baweaver: # => [2, 4, 6] (https://eval.in/1044773)
[01:59:17] this_dude: so its like i said..a random naming of the arra
[01:59:28] this_dude: ie anything [1,2,3]
[01:59:28] baweaver: not the array, but rather each element of it
[01:59:37] this_dude: for example
[01:59:51] this_dude: and then incrementing i
[01:59:56] baweaver: each element that goes into the function is named 'v' for you to use
[02:00:01] this_dude: okay i get it
[02:00:03] baweaver: there is no i
[02:00:32] baweaver: even still, there is no i there.
[02:00:40] this_dude: you cant use i?
[02:00:43] Creatornator: has joined #ruby
[02:01:38] this_dude: in my code i completely removed the word "string" but im still getting an error that says "Did you mean: String?"
[02:03:28] this_dude: oh i resolved that
[02:03:32] this_dude: forgot a gets statement
[02:04:29] baweaver: https://repl.it/repls/GloomyVerifiableAgent
[02:04:37] baweaver: That should show you how map, select, and find work
[02:04:59] this_dude: oh youre using repl.it too?!
[02:05:00] baweaver: If you know those three you basically have superpowers.
[02:05:40] this_dude: this is the problem im working on
[02:05:41] this_dude: https://repl.it/@AppAcademy/CapitalizeWords
[02:06:18] baweaver: split, map, capitalize, join
[02:06:24] baweaver: that's all you need
[02:06:34] this_dude: this is the solution provided
[02:06:46] this_dude: https://repl.it/@AppAcademy/CapitalizeWordsSolution
[02:07:08] this_dude: oh wow that was easier than i made it seem wtf
[02:07:14] baweaver: It's a silly solution
[02:07:26] baweaver: you can do it in one line easily, and it's perfectly legible.
[02:07:58] this_dude: what would the one line code for it be
[02:08:01] baweaver: you have the tools
[02:08:07] this_dude: let me try to figure it out
[02:08:55] this_dude: [string.split].map { |v| v.upcase }
[02:09:13] this_dude: after def capitalize_words(string)
[02:09:17] baweaver: was upcase one of the words mentioned?
[02:09:56] baweaver: split, map, capitalize, join
[02:09:57] baweaver: that's all you need
[02:10:14] this_dude: [string.split].map { |v| v.capitalize }
[02:10:27] baweaver: why the array brackets?
[02:10:33] baweaver: and what about join?
[02:10:44] this_dude: here let me actually write out the code brb
[02:12:28] havenwood: this_dude: I wrote you some tests, if you'd like to try them: https://gist.github.com/havenwood/a46712ea8df08c6da46cd2707b4efb1b
[02:12:41] this_dude: like practice problems?
[02:13:01] havenwood: this_dude: Yup, the tests will all fail and you can make them all pass.
[02:13:27] havenwood: this_dude: You can save the contents of that gist as `capitalize_words.rb` then run the tests with: ruby capitalize_words.rb
[02:14:01] havenwood: this_dude: Then try just an `s` inside the method and you'll see two tests now pass.
[02:14:07] this_dude: def capitalize_words(string) (string.split(" ")).map { |v| v.capitalize} string.join
[02:14:26] this_dude: string.join(" ")*
[02:14:43] baweaver: your REPL will answer more questions faster than we can.
[02:14:52] this_dude: theres already code that they provide to see if it works
[02:16:00] this_dude: idk how to join it back
[02:16:09] this_dude: ik how to do .split(" ")
[02:16:18] this_dude: but idk how to join it back and put the spaces back in
[02:16:30] baweaver: every method returns a value
[02:16:34] this_dude: .join always confuses me
[02:16:39] baweaver: who's to say you can't chain them all together?
[02:16:52] baweaver: What does join do?
[02:16:53] kapil___: has joined #ruby
[02:17:04] this_dude: joins an array into a string
[02:17:17] baweaver: >> 'this is a sentence'.split(' ').map { |w| w.reverse }.join(' ') # That you can then join back together
[02:17:22] ruby[bot]: baweaver: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
[02:17:25] baweaver: What's that doing?
[02:17:29] baweaver: bot be broke
[02:17:41] this_dude: you can do that in the same line???
[02:19:20] this_dude: getting an error
[02:19:57] this_dude: thats stupid easy
[02:20:03] this_dude: idk why they dont teach that
[02:20:05] this_dude: string.split(" ").map{ |v| v.capitalize}.join(" ")
[02:20:13] this_dude: literally in one line thats so dumb
[02:20:22] baweaver: and once you understand those three methods (select, map, and find) you're well ahead already.
[02:20:37] baweaver: Hence us chuckling a bit about the proposed solution
[02:21:20] baweaver: https://medium.com/@baweaver/reducing-enumerable-the-basics-fa042ce6806
[02:21:24] baweaver: Give that a read through
[02:22:39] this_dude: wow ruby syntax is alot stronger than i thought it was
[02:22:51] this_dude: i literally did what they put in like 15 lines...in 1 line
[02:23:05] this_dude: whats that?
[02:23:23] baweaver: It explains one of the most powerful functions in Ruby
[02:23:41] this_dude: wait let me ask you a question then
[02:23:56] baweaver: Triple Equals is the other super power in Ruby - https://medium.com/rubyinside/triple-equals-black-magic-d934936a6379
[02:24:01] this_dude: could i use that .map function for another problem on there...the caesar cipher?
[02:24:09] havenwood: this_dude: yes
[02:24:18] this_dude: oh yeah i saw something on an article about the triple equals
[02:24:20] baweaver: map is generic.
[02:24:36] baweaver: It operates on any Enumerable type, and returns a new Array
[02:24:37] this_dude: dude if i go into these exams using advanced ruby code im sure to get into the program lmao
[02:24:40] this_dude: i love you guys
[02:25:18] baweaver: These are the basic building blocks, there's still more to learn, but once you have these building blocks down it unlocks a ton.
[02:25:20] this_dude: ok so let me try to code the caesar cipher using that then...cause the exam is supposedly gonna only go up to the "medium difficulty" category questions and the cipher is in the "hard" category
[02:25:59] baweaver: What's funny about Caesar and ROT13 is they can be done in a handful of characters
[02:26:03] baweaver: barely even a full line worth.
[02:26:08] baweaver: but I'd use map for now.
[02:26:44] baweaver: well, rather I'd use map, ord, and modulo.
[02:28:32] baweaver: the way that'd be a bit hard to reason about is tr, which is translate.
[02:28:40] baweaver: It basically says take set a and transform it to set b
[02:28:46] baweaver: but that's also super dense
[02:31:56] alfiemax: has joined #ruby
[02:36:58] this_dude: has joined #ruby
[02:37:04] this_dude: sorry had to relocate pc
[02:37:06] this_dude: im back lol
[02:37:20] this_dude: so you said use .map .ord and %?
[02:37:38] tdy: has joined #ruby
[02:39:53] tdy1: has joined #ruby
[02:44:22] this_dude: what does string.each_char do?
[02:45:32] FredrikThuresson: has joined #ruby
[02:46:51] alfiemax_: has joined #ruby
[02:47:51] cschneid_: has joined #ruby
[02:57:47] dviola: has joined #ruby
[03:10:00] al2o3-cr: >> 'qefp_arab tfii yb x jxpqbo lc oryv fk kl qfjb :)'.tr'x-za-w','a-z'
[03:10:01] ruby[bot]: al2o3-cr: # => "this_dude will be a master of ruby in no time :)" (https://eval.in/1044781)
[03:10:53] braincrash: has joined #ruby
[03:19:18] gix: has joined #ruby
[03:22:01] patr0clus: has joined #ruby
[03:30:35] Creatornator: has joined #ruby
[03:49:11] cschneid_: has joined #ruby
[03:53:16] patr0clus: has joined #ruby
[03:55:48] Caerus: has joined #ruby
[03:56:14] patr0clus: has joined #ruby
[04:07:27] this_dude: has joined #ruby
[04:08:36] JamJam_kid: has joined #ruby
[04:09:20] this_dude: i just saw the code you sent lol
[04:09:26] this_dude: how the hell does that compute xD
[04:17:47] patr0clus: has joined #ruby
[04:18:06] alfiemax: has joined #ruby
[04:36:40] _aeris_: has joined #ruby
[04:42:12] tristanp: has joined #ruby
[04:43:17] this_dude: ill repeat my question from the other channel..can someone please help me correct the syntax of this line
[04:43:19] this_dude: string.map {|v| ((v.ord)+offset).chr}
[04:47:31] havenwood: this_dude: ''.respond_to? :map #=> false
[04:48:01] havenwood: this_dude: String doesn't mixin Enumerable or anything else that defined #map, and it isn't defined on String itself either.
[04:48:28] this_dude: i have no idea what that means D:
[04:48:35] havenwood: this_dude: Above I asked an empty string if it responds to #map, and it doesn't.
[04:48:48] this_dude: ohhh sorry forgot to give you the context
[04:49:00] this_dude: this is for an any offset caesar cipher
[04:49:14] this_dude: i will use a gets to ask for the offset
[04:49:19] this_dude: and another to ask for the string
[04:49:27] havenwood: this_dude: It looks like you're calling #map on a String, but String doesn't respond to the #map method because #map isn't defined on String.
[04:49:56] this_dude: http://prntscr.com/kf4pza
[04:49:58] havenwood: "this dude".respond_to? :map #=> false
[04:50:22] this_dude: oh yeah i changed it
[04:50:25] havenwood: "this dude".respond_to? :chars #=> true
[04:51:01] havenwood: >> 'this_dude'.chars
[04:51:05] this_dude: whats the difference
[04:51:06] ruby[bot]: havenwood: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
[04:51:11] havenwood: #=> ["t", "h", "i", "s", "_", "d", "u", "d", "e"]
[04:51:25] this_dude: then i will use .chars?
[04:51:26] havenwood: this_dude: In Ruby, different Objects respond to different methods.
[04:51:52] this_dude: so .map is for integers
[04:51:59] this_dude: and .chars is for characters
[04:52:25] havenwood: this_dude: No, map is for things that respond to map. And chars is for things that respond to chars.
[04:52:32] havenwood: [].respond_to? :map #=> true
[04:52:43] havenwood: 42.respond_to? :map #=> false
[04:53:03] this_dude: ive never heard of .chars thats why
[04:53:06] havenwood: this_dude: The `[]` or `42` is the "receiver" of the method call. You call the method on the receiver object.
[04:53:12] this_dude: i didnt even know .map existed until earlier
[04:53:26] ruby[bot]: Pry, the better IRB, provides easy object inspection `ls`, `history`, viewing docs `?`, viewing source `$`, syntax highlighting and other features (see `help` for more). Put `binding.pry` in your source code for easy debugging. Install Pry (https://pryrepl.org/): gem install pry pry-doc
[04:53:53] this_dude: so can I use (string.split).char?
[04:53:57] havenwood: this_dude: In Pry, you can easily check what methods an object respond to. You can do it in irb too, it's just more work.
[04:54:41] havenwood: 'this_dude'.chars.map(&:upcase) #=> ["T", "H", "I", "S", "_", "D", "U", "D", "E"]
[04:55:00] havenwood: 'this_dude'.chars.class #=> Array
[04:55:10] havenwood: this_dude: Array does respond to #map.
[04:55:59] havenwood: this_dude: https://docs.ruby-lang.org/en/2.5.0/Array.html
[04:56:04] this_dude: so if i turn it into an array with .char i can then call it with .map
[04:56:26] havenwood: this_dude: yes
[04:57:42] this_dude: i cant combine a .char.map with a while can I? since the .map IS the while?
[04:58:05] this_dude: http://prntscr.com/kf4rsl
[05:00:10] baweaver: Qo 0.4.0 has been released. `Any` is now used for wildcard values: https://github.com/baweaver/qo
[05:00:47] this_dude: oh hey weaver
[05:00:52] this_dude: im lost again lmao
[05:01:04] baweaver: shall we lend you a map? :D
[05:01:04] this_dude: i think im confused on how the === works
[05:01:14] this_dude: dont make fun pls
[05:01:23] this_dude: i have 10 days to learn this entire language
[05:01:26] this_dude: im really trying
[05:01:30] baweaver: what about ===?
[05:01:43] baweaver: You won't. Focus on getting a decent foundation instead.
[05:01:59] this_dude: i have the entrance exams
[05:02:07] this_dude: so anyways===
[05:02:13] this_dude: this statement
[05:02:15] this_dude: if (string[i]).split(" ")===(a..w)
[05:02:21] this_dude: is this even written correctly?
[05:02:26] havenwood: this_dude: Skip === for now. You'll want to learn about it when you start writing your own classes.
[05:02:41] baweaver: yeah, I'd ignore it for now
[05:02:44] this_dude: okay how can I write that normally then?
[05:02:55] baweaver: I sincerely doubt you need to know all of Ruby to pass an exam
[05:02:57] this_dude: for any character from a-w
[05:03:09] this_dude: i gotta be able to code all of the problems they give me
[05:03:12] baweaver: I don't know all of Ruby and I've been doing it for some 6-7 years now
[05:03:51] this_dude: do you do ruby dev for a living?
[05:04:22] this_dude: ah im getting off track
[05:04:53] havenwood: this_dude: what did you mean by the code above? if any word has a letter from "a" to "w" in it or something else?
[05:05:12] this_dude: in the cipher
[05:05:23] this_dude: im trying to separate it into two statements
[05:05:35] this_dude: letters from a-w
[05:05:39] this_dude: and letters from x-z
[05:05:47] havenwood: x, y and z?
[05:06:17] this_dude: that way i can do (string[i].ord + offset).chr
[05:07:22] this_dude: and for x,y,z itll be (string[i].ord-(26-offset)).chr
[05:07:55] havenwood: this_dude: it seems your on a good track
[05:08:42] this_dude: can I do that using .char.map?
[05:10:24] memo1: has joined #ruby
[05:10:56] alex``: has joined #ruby
[05:11:27] this_dude: string.chars.map {|v| ((v.ord)+offset).chr}
[05:16:51] gigetoo: has joined #ruby
[05:20:41] this_dude: gonna relocate pc brb
[05:30:19] moei: has joined #ruby
[05:39:42] ur5us: has joined #ruby
[05:42:00] chussenot: has joined #ruby
[05:48:11] this_dude: has joined #ruby
[06:01:21] this_dude: im getting a strange error
[06:01:32] this_dude: "string cannot be coerced into integer"
[06:03:26] aufi: has joined #ruby
[06:03:33] baweaver: you tried to add an int and a string
[06:03:42] ruby[bot]: baweaver: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
[06:04:39] za1b1tsu: has joined #ruby
[06:06:23] this_dude: what am i doing wrong here
[06:06:23] this_dude: http://prntscr.com/kf58su
[06:09:38] baweaver: indent things
[06:09:45] baweaver: it'll save you a lot of sanity later
[06:09:58] biberu: has joined #ruby
[06:10:05] baweaver: Also you don't need while loops
[06:10:06] baweaver: Remember map.
[06:10:52] nowhere_man: has joined #ruby
[06:10:57] this_dude: how do i set the 'a'..'w' parameter into the map?
[06:11:46] bak1an: has joined #ruby
[06:11:52] this_dude: or can i leave it as is and just remove the while
[06:12:05] baweaver: Also don't use === for that.
[06:12:11] lunarkitty7: has joined #ruby
[06:12:12] baweaver: use this style for range inclusions: (1..10).include?(v)
[06:12:45] this_dude: let me research the .include function..
[06:12:58] baweaver: 'all the stuff'.chars.map { |c| c ... } # Use this style
[06:14:34] baweaver: Are there only going to be lowercase characters?
[06:14:47] Nicmavr: has joined #ruby
[06:15:13] this_dude: im trying to understand [00:12] <baweaver> 'all the stuff'.chars.map { |c| c ... } # Use this style
[06:15:23] this_dude: so then would it be
[06:16:06] baweaver: >> offset = 13; ('a'..'z').to_a.rotate(offset)
[06:16:07] ruby[bot]: baweaver: # => ["n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "a", "b", "c", "d", "e", "f", "g", ...check link for more (https://eval.in/1044794)
[06:16:33] this_dude: wait wtf thats stupid simple..
[06:16:36] baweaver: >> offset = 13; alpha = ('a'..'z').to_a; alpha.zip(alpha.rotate(offset)).to_h
[06:16:42] ruby[bot]: baweaver: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
[06:16:46] baweaver: >> offset = 13; alpha = ('a'..'z').to_a; alpha.zip(alpha.rotate(offset)).to_h
[06:16:52] ruby[bot]: baweaver: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
[06:16:56] baweaver: ...fine fine
[06:16:59] this_dude: what is .to_a.rotate?
[06:17:28] baweaver: => {"a"=>"n", "b"=>"o", ... }
[06:17:38] this_dude: let me rephrase
[06:17:43] this_dude: what is .to_a
[06:18:00] this_dude: i know .to_i and .to_s
[06:18:06] this_dude: never heard if .to_a
[06:18:15] lunarkitty7: to array I believe
[06:18:40] this_dude: is that the same as .split?
[06:18:59] baweaver: >> offset = 13; alpha = ('a'..'z').to_a; translation = alpha.zip(alpha.rotate(offset)).to_h; translation.default_proc = proc { |h, k| h[k] = k }; 'the rain in spain'.chars.map { |c| translation[c] }.join
[06:19:00] ruby[bot]: baweaver: # => "gur enva va fcnva" (https://eval.in/1044795)
[06:19:01] alem0lars: has joined #ruby
[06:19:07] baweaver: >> offset = 3; alpha = ('a'..'z').to_a; translation = alpha.zip(alpha.rotate(offset)).to_h; translation.default_proc = proc { |h, k| h[k] = k }; 'the rain in spain'.chars.map { |c| translation[c] }.join
[06:19:08] ruby[bot]: baweaver: # => "wkh udlq lq vsdlq" (https://eval.in/1044796)
[06:19:19] lunarkitty7: in that case it's converting a range to an array this_dude
[06:19:31] snickers: has joined #ruby
[06:19:38] lunarkitty7: oh wow, Array.rotate
[06:19:43] lunarkitty7: didn't know about that
[06:19:47] this_dude: i didnt either..
[06:20:05] baweaver: translating and commenting it, one sec.
[06:21:12] lunarkitty7: wow, that is so different from how I did a one line ROT, really interesting
[06:21:37] baweaver: The only reason I do that one is because variable ROT offset.
[06:21:42] baweaver: otherwise just use tr
[06:21:50] this_dude: idk what you guys are saying smh
[06:23:41] this_dude: im trying to write out the code you just gave me...kinda confusing
[06:23:59] lunarkitty7: >> rot=-> s, k {a,aa,l ='a'.ord,'A'.ord,26;p s=s.split('').map {|x| sh = -> x,a {(((x.ord - a) + k)%l + a).chr}; if (a...a+l).include? x.ord then sh[x,a] elsif (aa...aa+l).include? x.ord then sh[x,aa] end}; s.join('')}; rot['meow', 13]
[06:24:00] ruby[bot]: lunarkitty7: # => ["z", "r", "b", "j"] ...check link for more (https://eval.in/1044797)
[06:24:26] this_dude: oh idk what that is
[06:24:37] this_dude: thats one of the things they said i wouldnt need to know
[06:24:51] lunarkitty7: it's a key:value store
[06:24:52] baweaver: you know what a dictionary is in real life?
[06:25:08] baweaver: it has words that have definitions
[06:25:13] baweaver: or rather keys that have values
[06:25:21] redlegion: has joined #ruby
[06:25:25] lunarkitty7: Super super super useful
[06:25:31] baweaver: So instead of an array having an index that's a number, it has an index which is anything
[06:25:46] redlegion: has joined #ruby
[06:26:05] this_dude: so what did you turn into a hash?
[06:26:05] baweaver: https://medium.com/@baweaver/abusing-hash-constructors-65d59c0a5b27
[06:26:23] this_dude: i have so many links open from you rn lmao
[06:26:30] baweaver: >> %w(a b c).zip([1,2,3]).to_h
[06:26:33] this_dude: im learning so much im supposed to be ignoring looool
[06:26:36] ruby[bot]: baweaver: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
[06:26:41] baweaver: >> %w(a b c).zip([1,2,3]).to_h
[06:26:46] dionysus69: has joined #ruby
[06:26:46] ruby[bot]: baweaver: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
[06:26:57] baweaver: => {"a"=>1, "b"=>2, "c"=>3}
[06:27:01] this_dude: and this all works in rails?
[06:27:09] baweaver: Rails is just Ruby
[06:27:16] baweaver: well, rather Rails is built in ruby
[06:27:22] this_dude: whats with the .zip
[06:27:32] baweaver: How does a zipper work in real life?
[06:27:34] this_dude: what did you compress
[06:27:44] this_dude: well ik what a .zip file is
[06:27:57] this_dude: how tf did you just create one mid code
[06:28:05] baweaver: It takes two sides and zips them together
[06:28:06] baweaver: %w(a b c).zip([1,2,3])
[06:28:07] baweaver: => [["a", 1], ["b", 2], ["c", 3]]
[06:28:21] baweaver: So now I took two arrays and zipped them together
[06:28:36] baweaver: by putting to_h on the end I now have a key value instead.
[06:29:13] baweaver: I did get through enough of it
[06:29:14] baweaver: https://baweaver.gitbooks.io/an-illustrated-guide-to-ruby/content/
[06:29:21] baweaver: Learn more Ruby
[06:29:25] baweaver: ....with cartoon lemurs
[06:29:37] baweaver: That version isn't done, but it gets enough in there.
[06:29:57] this_dude: is it necessary?
[06:30:02] this_dude: or can i just read the other links lol
[06:30:11] baweaver: Eh, either or.
[06:30:14] this_dude: btw im still trying to follow the syntax of your code
[06:30:15] baweaver: I just explain more in there.
[06:30:17] this_dude: another question
[06:30:54] lunarkitty7: Oh wow, it's like a toned down Why's Poignant guide!
[06:31:11] baweaver: Oh it's about to be toned up
[06:31:22] baweaver: lunarkitty7: How much do you know about what I've been working on?
[06:32:01] lunarkitty7: *looks at chatlog*
[06:32:05] baweaver: One of the more interesting ones recently is that I was speaking at Southeast Ruby
[06:32:07] baweaver: and I illustrated the entire talk
[06:32:09] baweaver: https://medium.com/@baweaver/creating-reducing-enumerable-an-illustrated-adventure-c6adfcc30d5b
[06:32:34] baweaver: That goes through how I went about it, but the gist of it is 135 hours into it, and it explains how to use reduce effectively.
[06:32:47] baweaver: It's also me getting substantially better at illustration
[06:33:10] this_dude: ok im ready to ask questions
[06:33:13] baweaver: because I happen to have something very interesting that I'm not going to mention on channel :)
[06:33:20] this_dude: .default_proc?
[06:33:39] this_dude: actually this entire line
[06:33:45] this_dude: translation.default_proc = proc { |h,k| h[k] = k}
[06:33:48] baweaver: Heh, yeah, figured that one
[06:33:49] lunarkitty7: awesome baweaver
[06:34:01] baweaver: The talk should be live in 2 weeks or so.
[06:34:11] baweaver: I went full on voice acting for each lemur too
[06:34:29] baweaver: ok, so, default proc
[06:34:39] baweaver: If a key can't be found in a hash, it returns nil by default
[06:34:41] arup_r: has joined #ruby
[06:34:51] baweaver: if there's a default proc, it calls that when it finds a key it doesn't know about
[06:35:03] baweaver: >> {a: 1}[:b]
[06:35:06] this_dude: like since the range is a..z and you put 0 it would return nil?
[06:35:08] ruby[bot]: baweaver: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
[06:35:29] baweaver: So if that key isn't in there (:b isn't) it gives nil
[06:35:42] baweaver: In our case we want to not translate any character that's not a lowercase letter.
[06:35:49] this_dude: like since the range is a..z if you put 0 it would return nil?
[06:36:06] baweaver: The simpler idea would instead be: translate[c] || c
[06:36:20] baweaver: except it's a hash after the zip.to_h
[06:36:37] apeiros: has joined #ruby
[06:36:52] this_dude: from this line
[06:37:00] this_dude: alpha=('a'..'z').to_a.rotate(offset)
[06:37:02] this_dude: to this line
[06:37:08] this_dude: translation=alpha.zip(alpha.rotate(offset)).to_h
[06:37:14] this_dude: you have a double rotation
[06:37:18] this_dude: i dont understand
[06:39:09] baweaver: https://repl.it/repls/AquaJovialSystems
[06:39:11] baweaver: There we go
[06:40:32] baweaver: >> ALPHABET = ('a'..'z').to_a; offset = 13; translation = ALPHABET.zip(ALPHABET.rotate(offset)).to_h; 'strings are real fun BUT NOT THIS'.chars.map { |c| translation[c] || c }.join
[06:40:33] ruby[bot]: baweaver: # => "fgevatf ner erny sha BUT NOT THIS" (https://eval.in/1044799)
[06:41:45] this_dude: really well notated
[06:41:51] this_dude: what do you do for a living??
[06:42:15] baweaver: Software Engineer
[06:42:43] this_dude: thats what i wanna be D:
[06:42:47] this_dude: um why is alphabet all caps
[06:42:59] this_dude: that sets it to an unalterable item right?
[06:43:17] baweaver: We'd like to think so
[06:43:27] baweaver: (in general I _should_ freeze it)
[06:44:19] baweaver: I also get paid to do bad things to Ruby and teach people
[06:44:44] this_dude: im more of a blackhat coder than a white hat
[06:44:56] this_dude: any violent coding books you need i got all the links hehe
[06:45:13] baweaver: Do note that'll likely get you in trouble on this channel.
[06:45:23] this_dude: even though like you saw earlier..delving into the darknet has apparently compromised my passwords
[06:45:31] this_dude: oh well i wouldnt do it here obviously
[06:45:36] this_dude: im here for school purposes
[06:45:45] baweaver: In general it's not a good idea to go black hat.
[06:46:06] baweaver: White hat pays better.
[06:46:06] this_dude: its kinda fun though..
[06:46:28] this_dude: i know tons of people who sell cc's and make crazy money
[06:46:42] this_dude: i would love to be a ruby dev
[06:46:42] baweaver: In the bay area a Senior class SecOps engineer is raking in around 150-170k base.
[06:46:54] baweaver: That's not counting stock options
[06:46:56] this_dude: which entails how many years exp?
[06:46:58] baweaver: which can double that easily.
[06:47:11] baweaver: depends on skill, normally around 5
[06:47:22] this_dude: i dont have that kinda time on my hands
[06:47:25] this_dude: and im not in school
[06:47:33] this_dude: and cant afford to go to school
[06:47:37] baweaver: If you're 21 you have time.
[06:47:46] this_dude: so like..if i dont try to learn by myself i wont learn
[06:48:01] lunarkitty7: has joined #ruby
[06:48:06] baweaver: Who says you need to get a degree?
[06:48:06] this_dude: my friend is a senior network engineer and hes 22
[06:48:09] lunarkitty7: dang internet connection
[06:48:18] this_dude: do you not have a degree?
[06:48:20] baweaver: Levels are inflated.
[06:48:29] baweaver: Only a tangentially related one
[06:48:42] this_dude: he leads a team of network engineers
[06:48:46] baweaver: I went to a super cheap state school no-name
[06:48:52] this_dude: he makes great money for our age
[06:49:09] this_dude: but you went to school at least :/
[06:49:20] baweaver: Didn't count for much
[06:49:31] baweaver: Every job I had came from hard won experience and networking.
[06:49:34] lunarkitty7: this_dude: about %50 of devs don't have a degree
[06:50:05] baweaver: One of the strongest principal engineers in our company didn't get a degree
[06:50:06] baweaver: and he absolutely demolishes me
[06:50:39] baweaver: He's also on this channel
[06:50:55] this_dude: okay so basically in the coding industry hardwork==money
[06:51:02] this_dude: and experience
[06:51:22] baweaver: Networking is going to be the big card
[06:51:30] this_dude: btw in your code for the cipher i have another question
[06:51:33] baweaver: Hard work with no connections will nail you
[06:51:34] this_dude: what is p translation_table
[06:51:44] baweaver: puts thing.inspect
[06:52:22] baweaver: p returns the value, puts returns nil
[06:52:34] baweaver: It inspects the object instead of calling to_s on it.
[06:52:40] baweaver: That one takes some getting used to.
[06:52:51] this_dude: so could i not replace that with
[06:53:02] lunarkitty7: oh, huh I thought it was an alias for print
[06:53:10] this_dude: return translation_table
[06:53:27] baweaver: p is just outputting it so you can see it
[06:53:38] baweaver: the actual return value is at the end
[06:53:52] this_dude: so i can see what?
[06:53:54] this_dude: the entire table?
[06:53:55] tristanp: has joined #ruby
[06:54:16] baweaver: ACTION is back on accordion music Youtube
[06:54:37] this_dude: your code returns me an error
[06:55:01] arup_r1: has joined #ruby
[06:55:18] arup_r1: has joined #ruby
[06:55:28] this_dude: I can replace the c in the map statement with v also right?
[06:55:39] baweaver: yep, just replace all the c's
[06:55:46] this_dude: and about that
[06:55:54] this_dude: im unfamiliar with that statment
[06:56:12] this_dude: string.chars.map { |v| translation_table[v] || v } .join
[06:56:39] baweaver: Enjoy accordion tango with me - https://youtu.be/Un9sXWWuChU?t=1m
[06:56:52] this_dude: the only one you taught me is { |v| v ___ }
[06:57:09] baweaver: You could use c instead of v
[06:57:25] baweaver: I just tend to use c for character, v for value, i for index, w for word, etc
[06:57:38] this_dude: but that wasnt my question
[06:57:42] baweaver: It's not necessary strictly speaking.
[06:57:43] this_dude: my question is this part
[06:57:56] this_dude: { |v| translation_table[v] || v } <--
[06:58:37] baweaver: Each character gets translated using the translation map. It has the original alphabet latter as the key, and its translation as the value
[06:58:47] moei: has joined #ruby
[06:58:48] this_dude: yeah but whats the || v
[06:58:55] baweaver: If there is no translation, you get back nil. || is saying or this
[06:59:06] baweaver: So: false || 'other value'
[06:59:09] this_dude: like if theres a space?
[06:59:24] this_dude: thats super cool
[06:59:32] this_dude: btw im listening to that accordion music
[06:59:38] this_dude: actually really relaxing..
[06:59:42] baweaver: >> [true || true, false || true, false || false, true && true, false && true]
[06:59:43] ruby[bot]: baweaver: # => [true, true, false, true, false] (https://eval.in/1044802)
[07:00:05] baweaver: boolean truth operations
[07:00:28] this_dude: oh wait so youre using it as an or statement
[07:00:51] baweaver: Either there's a translation, or you return the original character
[07:01:19] this_dude: ohhhhhhhhhhhhhhh ok
[07:01:30] this_dude: tht code returns an error btw
[07:01:32] this_dude: for me at least
[07:01:36] baweaver: Astor Piazolla, master of tango :D
[07:02:15] this_dude: http://prntscr.com/kf5ri8
[07:02:21] yohji: has joined #ruby
[07:02:45] baweaver: Are you passing in a string for the rotation?
[07:02:58] baweaver: gets isn't _that_ smart
[07:03:01] this_dude: i dont understand the question
[07:03:09] baweaver: gets will give you a string
[07:03:15] baweaver: you have to make that an integer
[07:03:20] baweaver: rotate takes an integer
[07:03:30] this_dude: wellllll uhhhh
[07:03:51] this_dude: can i just use string=string.to_i
[07:04:19] baweaver: input = gets.chomp; rot = gets.chomp.to_i; cipher(input, rot)
[07:04:33] arup_r: has joined #ruby
[07:04:44] this_dude: heres my code...
[07:04:49] baweaver: chomp gets rid of newlines
[07:04:59] this_dude: http://prntscr.com/kf5skc
[07:05:31] baweaver: yep, use that above
[07:06:17] arup_r: has joined #ruby
[07:06:48] this_dude: im getting stuck in a loop now
[07:08:09] this_dude: yeah something is wrong
[07:08:34] this_dude: http://prntscr.com/kf5u1p
[07:11:27] sysvalve: has joined #ruby
[07:12:22] baweaver: you reversed the arguments.
[07:12:47] baweaver: you're also using gets in the method
[07:12:58] this_dude: wdym i reversed the arguments
[07:13:10] baweaver: I'll let ya figure that one.
[07:13:19] alicef: has joined #ruby
[07:16:34] this_dude: can i do this
[07:16:42] this_dude: string=gets.chomp.to_i
[07:17:20] this_dude: it keeps saying no implicit conversion of string to integer
[07:17:41] this_dude: http://prntscr.com/kf5xt2
[07:19:01] this_dude: oh i removed the .to_i from the .char.map
[07:19:09] this_dude: but still getting the same error
[07:19:14] ineb: has joined #ruby
[07:19:43] ineb: if you go the dynamic approach and generate a client api out of the REST specifications
[07:20:01] ineb: would you generate the actual ruby code via erb templates
[07:20:18] ineb: or load the specifications (json) and create the code via meta programming?
[07:20:19] baweaver: Calling it a night. 'cheers
[07:20:27] baweaver: Apipie or Swagger
[07:20:31] baweaver: Don't make it complicated.
[07:20:34] this_dude: i have to finish at least this one
[07:20:44] baweaver: You're close, you have to think it through though
[07:20:54] baweaver: mainly what's an offset and what's the string
[07:21:24] baweaver: Anyways, late here and sleep is good.
[07:21:30] this_dude: oh i forgot offset to int?
[07:21:47] this_dude: hmm alright :/ g'night
[07:22:25] this_dude: oh i fixed the integer error and got a new one instead lmao
[07:23:42] snickers: has joined #ruby
[07:29:25] clemens3_: has joined #ruby
[07:41:10] apeiros: has joined #ruby
[07:41:24] mikecmpbll: has joined #ruby
[07:50:28] ferhaty: has joined #ruby
[07:50:43] alex``: has joined #ruby
[07:59:37] p4p0l0: has joined #ruby
[08:00:26] snickers: has joined #ruby
[08:01:44] vedu: has joined #ruby
[08:05:13] vedu: Hello. I am unable to get `rake task` working in my project https://github.com/vedant1811/customer-records. Currently it runs with "0 runs, 0 assertions, 0 failures, 0 errors, 0 skips"
[08:06:21] mikecmpbll: has joined #ruby
[08:07:51] Beams: has joined #ruby
[08:13:21] MuffinPimp: has joined #ruby
[08:13:24] drale2k_: has joined #ruby
[08:17:05] TomyWork: has joined #ruby
[08:19:27] sameerynho: has joined #ruby
[08:26:42] Zaab1t: has joined #ruby
[08:27:34] amelliaa: has joined #ruby
[08:35:13] Freshnuts: has joined #ruby
[08:42:08] cabotto: has joined #ruby
[08:42:13] Freshnuts: has joined #ruby
[08:49:40] Mike11: has joined #ruby
[08:57:21] alicef: has joined #ruby
[09:00:50] rishibit: has joined #ruby
[09:01:25] dhollin3: has joined #ruby
[09:03:32] rishibit: has left #ruby: ()
[09:09:15] cabotto: has joined #ruby
[09:13:34] User458764: has joined #ruby
[09:26:13] cabotto: has joined #ruby
[09:33:39] morantron: has joined #ruby
[09:34:14] morantron: hi! is there a way to set a breakpoint when a constant in a class is being defined? some gem is defining a constant, and I'm not sure where it comes from...
[09:34:22] Caerus: has joined #ruby
[09:54:49] apeiros: morantron: just define it again, ruby will tell you that it already exists and where the original definition was
[09:57:37] desperek: has joined #ruby
[09:59:38] jp: has joined #ruby
[10:00:59] Dbugger: has joined #ruby
[10:01:48] drale2k_: has joined #ruby
[10:09:00] dionysus69: return some_var if > 0 would be great syntax, wouldn't it? instead of return some_var if some_var > 0
[10:10:31] dionysus69: I assume it would require one more line in ruby's source code
[10:13:05] apeiros: mid-method returns are the way of the spaghetti
[10:16:52] tj-: has joined #ruby
[10:21:02] dionysus69: apeiros: why what's wrong with them? never found anything against guard clause, until now ^.^ rubocop actually tells you to use them in some cases
[10:21:54] Bish: has joined #ruby
[10:22:04] Bish: does anyone of you guys operate your own DNS server written in ruby?
[10:22:08] apeiros: there's plenty of material online about what's spaghetti code and why it's bad. I suggest you make use of google.
[10:27:08] erlend: has left #ruby: ("WeeChat 1.9.1")
[10:30:17] tdy: has joined #ruby
[10:37:57] apparition: has joined #ruby
[10:43:49] aufi: has joined #ruby
[10:43:56] FernandoBasso: has joined #ruby
[10:45:35] dminuoso: has joined #ruby
[10:47:11] dminuoso: Given `[:foo, :bar, :quux]` and `:baz` I want to obtain `{ foo: :baz, bar: :baz, quux: :baz}` is there an expressive but compact way to do this?
[10:47:47] dminuoso: >> [:foo, :bar, :quux].map { |e| [e, :baz] }.to_h
[10:47:48] ruby[bot]: dminuoso: # => {:foo=>:baz, :bar=>:baz, :quux=>:baz} (https://eval.in/1044936)
[10:47:50] dminuoso: I dont like this.
[10:48:14] dionysus69: I'd say that's good enough, I just did something like that :D
[10:49:21] elphe: has joined #ruby
[10:50:17] dminuoso: Ah well screw it. Its not worth the time.
[10:51:01] dionysus69: >> Hash[[:foo, :bar, :quux].collect { |e| [e, :baz] } ]
[10:51:02] ruby[bot]: dionysus69: # => {:foo=>:baz, :bar=>:baz, :quux=>:baz} (https://eval.in/1044941)
[10:51:15] dionysus69: I think the first one is better though
[10:55:29] tristanp: has joined #ruby
[10:55:52] elphe: has joined #ruby
[11:00:43] oldandwise: has joined #ruby
[11:19:26] flakas_: has joined #ruby
[11:19:30] ciro: has joined #ruby
[11:27:42] flakas: has joined #ruby
[11:29:23] arahael1: has joined #ruby
[11:33:22] schneider: has joined #ruby
[11:38:05] arahael1: has joined #ruby
[11:47:25] AJA4350: has joined #ruby
[11:58:02] schneider: has joined #ruby
[12:07:17] wildermind: has joined #ruby
[12:14:46] tty: has joined #ruby
[12:15:19] elphe: has joined #ruby
[12:19:08] fmcgeough: has joined #ruby
[12:25:52] AJA4351: has joined #ruby
[12:34:04] AJA4351: has joined #ruby
[12:34:59] elphe: has joined #ruby
[12:35:11] bmurt: has joined #ruby
[12:35:44] savolla: has joined #ruby
[12:41:40] AJA4351: has joined #ruby
[12:42:00] Sigyn: has joined #ruby
[12:44:49] elphe: has joined #ruby
[12:46:39] AJA4350: has joined #ruby
[12:47:48] hs366: has joined #ruby
[12:52:47] AJA4351: has joined #ruby
[12:54:41] elphe: has joined #ruby
[13:03:00] drale2k_: has joined #ruby
[13:03:47] InfinityFye: has joined #ruby
[13:04:27] elphe: has joined #ruby
[13:07:06] jcalla: has joined #ruby
[13:14:19] elphe: has joined #ruby
[13:16:19] AJA4351: has joined #ruby
[13:23:53] elphe: has joined #ruby
[13:24:08] cabotto: has joined #ruby
[13:24:50] fmcgeough: has joined #ruby
[13:27:42] aufi: has joined #ruby
[13:29:03] yokel: has joined #ruby
[13:32:21] snickers: has joined #ruby
[13:36:08] aufi: has joined #ruby
[13:37:30] AJA4351: has joined #ruby
[13:43:07] Caius: has joined #ruby
[13:44:15] elphe: has joined #ruby
[13:47:05] ciro: has joined #ruby
[13:47:07] gray_-_wolf: has joined #ruby
[13:48:01] gray_-_wolf: I want to have "read-only" Struct, I've come up with `Struct.new(:foo, :bar) { members.each { |m| remove_method("#{m}=") } }`, is there a better way?
[13:49:04] dminuoso: gray_-_wolf: Live with the fact that Ruby has no type system?
[13:49:14] dminuoso: gray_-_wolf: Regardless of what you do, there's enough backdooring to undo what you do.
[13:49:52] dminuoso: gray_-_wolf: If you just want some basic "I dont want to shoot myself" protection, what you wrote is the best you can get.
[13:50:58] Inline: has joined #ruby
[13:51:02] ineb: wait. just #freeze and/or its members
[13:51:13] ineb: *just #freeze the struct
[13:52:05] dminuoso: ACTION readies his fiddled thaw method..
[13:52:31] amelliaa: has joined #ruby
[13:53:43] gray_-_wolf: ineb: heh, that's probably a better way :) didn't think of that
[13:54:07] elphe: has joined #ruby
[13:55:24] snickers: has joined #ruby
[13:56:44] havenwood: >> %i[foo bar quux].each_with_object(:baz).to_h
[13:56:45] ruby[bot]: havenwood: # => {:foo=>:baz, :bar=>:baz, :quux=>:baz} (https://eval.in/1045031)
[13:57:06] dminuoso: ACTION sighs
[13:57:31] dminuoso: havenwood: This is why I dont like Ruby.
[13:58:04] havenwood: dminuoso: What's wrong with each_with_baz?
[13:58:25] ineb: dminuoso: i dont think its possible to easily unfreeze an object
[13:58:34] havenwood: ineb: dup it
[13:58:53] ineb: maybe with some hacks of the ruby interpreter
[13:58:58] havenwood: ACTION mutters something about the 11th bit
[13:59:14] dminuoso: havenwood: why would you ever dup over cloning?
[13:59:33] dminuoso: to unfreeze I guess
[13:59:49] dminuoso: havenwood: But seriously, its regarded because it's unclear why that works.
[14:00:49] reber: has joined #ruby
[14:01:42] dminuoso: I mean the stuff Ruby does to block arity to *implicitly* always somehow fit..
[14:03:54] elphe: has joined #ruby
[14:06:19] GodFather: has joined #ruby
[14:06:27] gnufied: has joined #ruby
[14:07:14] keanny479: has joined #ruby
[14:09:14] User458764: has joined #ruby
[14:13:47] elphe: has joined #ruby
[14:14:02] AJA4351: has joined #ruby
[14:14:09] cabotto: has joined #ruby
[14:16:37] memo1: has joined #ruby
[14:16:48] keanny479: hey everyone
[14:18:14] keanny479: which gems do you use for a ruby script ? the purpose of the script is to manage unix daemons (copy configuration file, replace keywords like sed...)
[14:18:36] darix: apeiros: JFYI: https://www.humblebundle.com/books/cybersecurity-wiley-books
[14:18:51] eddof13: has joined #ruby
[14:19:44] dminuoso: has left #ruby: ("WeeChat 2.0.1")
[14:21:09] keanny479: i found rr, safe_shell interesting
[14:21:16] keanny479: what do you use guys ?
[14:22:03] darix: i leave managing daemons to my init system
[14:23:18] flips_: has joined #ruby
[14:23:27] pmarreck_: has joined #ruby
[14:23:46] rjungemann_: has joined #ruby
[14:23:55] Kilobyte22: has joined #ruby
[14:24:23] jwheare_: has joined #ruby