baweaver changed the topic of #ruby to: Rules & more: https://ruby-community.com | Ruby 2.5.1, 2.4.4, 2.3.7, 2.6.0-preview2: https://www.ruby-lang.org | Paste 4+ lines of text to https://gist.github.com | Rails questions? Ask in #RubyOnRails | Books: https://goo.gl/wpGhoQ | Logs: https://irclog.whitequark.org/ruby | Can't talk? Register/identify with Nickserv first!
patr0clus has quit [Quit: WeeChat 2.1]
patr0clus has joined #ruby
<this_dude> 'this_dude'.chars.map { 'x' }.join #=>
<this_dude> ok so when i use
<havenwood> "xxxxxxxxx"
<this_dude> string.chars.map { |v| translation_table[v] || v } .join
<this_dude> in the code i get this error
<havenwood> this_dude: Extra space before the `.join`.
<this_dude> undefined method 'chars' for 0:integer
<this_dude> "Did you mean? chr"
<havenwood> this_dude: if `string` is an Integer then the variable name is a lie!
<this_dude> oh crap youre right
<this_dude> so i have to assign string.to_i to another variable?
cagomez has quit [Remote host closed the connection]
<this_dude> such as string_integer
eckhardt_ has joined #ruby
<havenwood> this_dude: 42.to_s.chars #=> ["4", "2"]
<havenwood> this_dude: '42'.chars #=> ["4", "2"]
cagomez has joined #ruby
<havenwood> this_dude: in irb, try: 42.chars
<havenwood> (It doesn't work - NoMethodError.)
<this_dude> so
<this_dude> im inputting a string
<this_dude> btw
<this_dude> not numbers
<this_dude> all lower case
<havenwood> this_dude: Take a look at: string.class
<havenwood> this_dude: string.class #=> Integer
<this_dude> wtf
<this_dude> excuse me?
<this_dude> how
<havenwood> this_dude: p string.class
<havenwood> this_dude: p string
<this_dude> oh #=
<havenwood> this_dude: Debug your code with p, or try it piece by piece in irb.
<this_dude> didnt see that
<this_dude> okay so
<this_dude> when calling for string
<this_dude> i am using
<this_dude> string=gets.chomp.to_i
<havenwood> this_dude: Sometime's you'll get confused about what it is that you have on hand. What you call `string` isn't in fact a String in your code. It's an Integer.
<this_dude> is this not valid?
<havenwood> this_dude: What does #to_i do?
<this_dude> changes a string to an integer arry
<havenwood> '42'.to_i #=> ???
<this_dude> array*
<havenwood> Nope.
<this_dude> [4,2]
<this_dude> wtf
<havenwood> Try it in IRB: '42'.to_i
<havenwood> What's the result?
<havenwood> '42'.to_i.class #=> ???
cagomez has quit [Ping timeout: 264 seconds]
<this_dude> 42
<havenwood> Yup. Is that a String?
<this_dude> :#
<havenwood> 42.is_a? String
r29v has quit [Quit: r29v]
<this_dude> okay well look
<this_dude> if i leave my string as a string
<this_dude> and use .map
AJA4350 has joined #ruby
<this_dude> it gives me an error of
<this_dude> "no implicit conversion of string to integer"
<this_dude> so I HAVE to convert it to an integer
ansraliant has joined #ruby
<havenwood> this_dude: Run the code you're thinking of in IRB, then show me what you've run.
ansraliant has quit [Client Quit]
ansraliant has joined #ruby
<this_dude> oh no i typoed
<this_dude> how do i edit it
<this_dude> nvm
<this_dude> fixed it
<havenwood> perfect
<havenwood> oops, MT
<this_dude> but this coe
<this_dude> code*
<this_dude> it doesnt work
Azure has quit [Ping timeout: 265 seconds]
<havenwood> that's not enough for us to go off of. how can you tell it doesn't work?
<this_dude> wait wtf
<this_dude> it works in the repl.it environment
<this_dude> but not in my command line lmao
<this_dude> why
<this_dude> it works in the exam environment lol
<this_dude> im so confused
Aroot has joined #ruby
<havenwood> this_dude: If you gist your code I bet someone here can help you sort it out.
mikecmpbll has quit [Quit: inabit. zz.]
white_lilies has quit [Quit: WeeChat 2.1]
<this_dude> i get this error in my command line
<havenwood> ?gist-usage
<this_dude> but its works in the test invironment idk whats going onnnn
<havenwood> ?gist this_dude
<ruby[bot]> this_dude: https://gist.github.com - Multiple files, syntax highlighting, even automatically with matching filenames, can be edited
<havenwood> this_dude: Having all the code gives us the context we need to quickly spot the problem. Having the code as text lets us run it and see.
<havenwood> this_dude: Sharing code as images is only one step above sharing code as animated gifs. Share code as text, and preferably as syntax highlighted, cloneable text.
<havenwood> The ability to edit code, and have us see the history gives context to the problem and where you currently are on it.
Azure has joined #ruby
<havenwood> ?gist_usage
<ruby[bot]> To properly use gist, please enable syntax highlighting, either by choosing the language manually or by entering a proper filename. If you post multiple things, separate them into multiple files. If you have a Github account, please update your gist with new information instead of posting a new one.
<havenwood> this_dude: How many arguments did you define the method to expect?
<this_dude> there?
<this_dude> arguments?
<havenwood> this_dude: How many arguments did you use when you called the method?
<this_dude> 2
<havenwood> And then when you called it?
<this_dude> oh youre right
<havenwood> this_dude: wrong number of arguments (given 1, expected 2)
<this_dude> oop
<this_dude> check now
<this_dude> you see it works in this environment
<havenwood> this_dude: How does this seem to you?
<havenwood> this_dude: Note, someone just joining this convo can't see what your previous code was.
<this_dude> but not in my command line when calling it with caesar_cipher.rb
<havenwood> this_dude: This is way better than an image though. :-P
<this_dude> does it allow you to edit it and me see it?
<havenwood> this_dude: When you run this code in irb, what happens?
<havenwood> this_dude: yes
<havenwood> this_dude: gists can be forked, or we can comment
<havenwood> it's why we recommend it
<this_dude> when i run it in irb
<this_dude> i get the "no implicit conversion of string into integer" error
<havenwood> i've got to relocate - but i'm sure someone else can help
<this_dude> ok..
<this_dude> gonna relocate also brb
this_dude has quit [Quit: Page closed]
UserOO7 has joined #ruby
Autolycus has joined #ruby
isene has quit [Quit: WeeChat 1.9.1]
UserOO7 has quit [Read error: Connection reset by peer]
eckhardt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Autolycus has quit [Client Quit]
akaiiro has quit [Ping timeout: 260 seconds]
href has quit [Ping timeout: 260 seconds]
alfiemax has joined #ruby
TJ- has quit [Ping timeout: 260 seconds]
Aroot has quit [Ping timeout: 248 seconds]
alfiemax has quit [Ping timeout: 256 seconds]
TJ- has joined #ruby
UserOO7 has joined #ruby
UserOO7 has quit [Read error: Connection reset by peer]
fmcgeough has joined #ruby
p4p0l0 has quit [Remote host closed the connection]
ixti has quit [Quit: WeeChat 2.1]
siaw23 has quit [Quit: siaw23]
fmcgeough has quit [Quit: fmcgeough]
levifig has quit [Read error: Connection reset by peer]
r29v has joined #ruby
memo1 has joined #ruby
p4p0l0 has joined #ruby
r29v has quit [Client Quit]
jp has quit [Ping timeout: 240 seconds]
jp has joined #ruby
p4p0l0 has quit [Ping timeout: 240 seconds]
ciro has quit [Quit: WeeChat 2.2]
Aroot has joined #ruby
Aroot has quit [Client Quit]
agent_white has quit [Quit: brb]
\void has joined #ruby
scrptktty has joined #ruby
impermanence has joined #ruby
<impermanence> Does erb come along with any Ruby install?
alex`` has joined #ruby
agent_white has joined #ruby
maryo has joined #ruby
AJA4350 has quit [Quit: AJA4350]
cagomez_ has joined #ruby
cagomez_ has quit [Remote host closed the connection]
maryo has quit [Ping timeout: 260 seconds]
dionysus69 has joined #ruby
dionysus69 has quit [Ping timeout: 240 seconds]
<havenwood> impermanence: Yes, ERB comes with Ruby in the standard library.
siaw23 has joined #ruby
siaw23 has quit [Client Quit]
braincrash has quit [Quit: bye bye]
maryo has joined #ruby
thy0 has quit [Quit: TTFN]
braincrash has joined #ruby
maryo has quit [Ping timeout: 268 seconds]
gix has quit [Disconnected by services]
<SuperLag> pry > irb
patr0clus has quit [Ping timeout: 265 seconds]
Nicmavr has quit [Read error: Connection reset by peer]
Nicmavr has joined #ruby
alex`` has quit [Ping timeout: 240 seconds]
Freshnuts has joined #ruby
kapil___ has joined #ruby
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jcalla has quit [Ping timeout: 248 seconds]
Tempesta has joined #ruby
Tempesta has quit [Client Quit]
jcalla has joined #ruby
jp has quit [Ping timeout: 248 seconds]
Tempesta has joined #ruby
armyriad has quit [Ping timeout: 240 seconds]
jp has joined #ruby
armyriad has joined #ruby
jp has quit [Read error: Connection reset by peer]
jp has joined #ruby
armyriad has quit [Ping timeout: 264 seconds]
armyriad has joined #ruby
armyriad has quit [Max SendQ exceeded]
TJ- has quit [Ping timeout: 276 seconds]
za1b1tsu has joined #ruby
Inline has quit [Quit: Leaving]
reber has joined #ruby
Furai has quit [Quit: WeeChat 2.2]
Jonno_FTW has quit [Remote host closed the connection]
snickers has joined #ruby
snickers has quit [Client Quit]
Furai has joined #ruby
p4p0l0 has joined #ruby
p4p0l0 has quit [Ping timeout: 260 seconds]
alfiemax_ has joined #ruby
Freshnuts has quit [Quit: Leaving]
User458764 has joined #ruby
levifig has joined #ruby
User458764 has quit [Client Quit]
User458764 has joined #ruby
User458764 has quit [Client Quit]
sauvin has joined #ruby
apeiros_ has joined #ruby
DarthGandalf has quit [Ping timeout: 265 seconds]
troys has quit [Quit: Bye]
pskosinski has quit [Ping timeout: 265 seconds]
\void has quit [Quit: So long, and thanks for all the fish.]
pskosinski has joined #ruby
BTRE has quit [Ping timeout: 264 seconds]
alex`` has joined #ruby
apeiros_ has quit [Remote host closed the connection]
flakas has joined #ruby
dionysus69 has joined #ruby
za1b1tsu has quit [Ping timeout: 260 seconds]
apeiros_ has joined #ruby
spiette has joined #ruby
spiette_ has quit [Ping timeout: 248 seconds]
bak1an has joined #ruby
apeiros_ has quit [Remote host closed the connection]
hfp_work has quit [Ping timeout: 265 seconds]
akkad is now known as Ober
hfp_work has joined #ruby
za1b1tsu has joined #ruby
alicef has quit [Ping timeout: 240 seconds]
unsymbol has joined #ruby
apeiros_ has joined #ruby
alicef has joined #ruby
raulp has joined #ruby
kapil___ has quit [Quit: Connection closed for inactivity]
flakas has quit [Read error: Connection reset by peer]
p4p0l0 has joined #ruby
aufi has joined #ruby
aufi has quit [Read error: Connection reset by peer]
aufi has joined #ruby
<baweaver> Anyone willing to give a PR a quick one-over?
<baweaver> Mostly cleaning up the Qo API and refining down to get it stable.
<baweaver> cc havenwood, apeiros_
sysvalve has joined #ruby
Burgestrand has joined #ruby
silviu has quit [Remote host closed the connection]
armyriad has joined #ruby
clemens3 has joined #ruby
TomyWork has joined #ruby
vutral|kali has quit [Ping timeout: 260 seconds]
alex`` has quit [Ping timeout: 260 seconds]
arand has quit [Ping timeout: 264 seconds]
arand has joined #ruby
volix has quit [Ping timeout: 256 seconds]
biberu has joined #ruby
alex`` has joined #ruby
Fraeon has quit [Quit: Connection reset by peer]
volix has joined #ruby
aef has joined #ruby
DTZUZO has quit [Ping timeout: 244 seconds]
DarthGandalf has joined #ruby
ferhaty has joined #ruby
tty has quit [Quit: tty]
snapcase has joined #ruby
mikecmpbll has joined #ruby
noudle has joined #ruby
<noudle> im not too good with ruby and gems, but can someone tell my how i can resolve this error on running msfconsole? (seems to not find bigdecimal gem altho it is installed): https://pastebin.com/kMwZAVnc
<ruby[bot]> noudle: 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
<noudle> i know its not the best idea to install and run it as root but this is just a test for now.
<noudle> ive got 'ruby 2.5.1p57 (2018-03-29 revision 63029)'
<noudle> here is the paste again, not on pastebin: https://dpaste.de/NrGG
yohji has joined #ruby
scrptktty has quit [Quit: Connection closed for inactivity]
href has joined #ruby
Beams has joined #ruby
asphyxia has joined #ruby
dalpo has quit [Quit: leaving]
p4p0l0 has quit [Ping timeout: 244 seconds]
dalpo has joined #ruby
<dalpo> hi
Burgestrand has quit [Quit: Closing time!]
kapil___ has joined #ruby
bak1an has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
schneider has joined #ruby
nicesignal has quit [Remote host closed the connection]
nicesignal has joined #ruby
ferhaty has quit [Quit: ferhaty]
Burgestrand has joined #ruby
ferhaty has joined #ruby
schneider has quit [Quit: WeeChat 2.0.1]
ansraliant has quit [Quit: Konversation terminated!]
zapata has quit [Quit: WeeChat 2.2]
Burgestrand has quit [Quit: Closing time!]
tristanp has joined #ruby
Dbugger has joined #ruby
tristanp has quit [Ping timeout: 256 seconds]
jetchisel has joined #ruby
<qolq> do ruby (no rails) arrays have an exclude? method or something similar or do i need to use !arr.include?
Burgestrand has joined #ruby
<marahin> Assuming that I have a hash, is there a way to retrieve values of keys in a certain order? E.g. `a = { first: 1, second: 2, third: 3 }; a.retrieve(:second, :third) # => [2, 3]`?
<marahin> I just came back from vacations and I feel void in my head.
<gray_-_wolf> a.values_at(:second, :third)
<gray_-_wolf> ?
<gray_-_wolf> dunno, I've just open documentation so might be wrong
<gray_-_wolf> opened*
<marahin> yeah I'm just browsing as well, let me check that method out
<marahin> yes, it seems like this is the one. Thank you gray_-_wolf !
<gray_-_wolf> ^_^
drale2k_ has joined #ruby
gray_-_wolf has quit [Quit: WeeChat 2.2]
bak1an has joined #ruby
Bish has quit [Ping timeout: 240 seconds]
Burgestrand has quit [Quit: Closing time!]
alfiemax has joined #ruby
alfiemax_ has quit [Ping timeout: 248 seconds]
wildermind has joined #ruby
johnnytao has joined #ruby
johnnytao has quit [Client Quit]
<apeiros_> qolq: no, there's no negative form of Array#include?, !arr.include? it is.
Beams has quit [Ping timeout: 260 seconds]
<qolq> apeiros_: thanks
Beams has joined #ruby
Beams has quit [Client Quit]
tristanp has joined #ruby
johnnytao has joined #ruby
johnnytao has left #ruby [#ruby]
alfiemax has quit [Ping timeout: 244 seconds]
tristanp has quit [Ping timeout: 256 seconds]
SolarAquarion has quit [Remote host closed the connection]
bijan_ has joined #ruby
SolarAquarion has joined #ruby
agent_white has quit [Quit: gnight]
za1b1tsu has quit [Ping timeout: 240 seconds]
sagax has quit [Quit: Konversation terminated!]
SolarAquarion has quit [Max SendQ exceeded]
asphyxia has quit [Quit: leaving]
SolarAquarion has joined #ruby
DTZUZO has joined #ruby
sticaz has quit [Read error: No route to host]
Mike11 has joined #ruby
apparition has joined #ruby
Beams has joined #ruby
SegFaultAX has quit [Ping timeout: 255 seconds]
russt has quit [Ping timeout: 255 seconds]
Klumben has quit [Ping timeout: 256 seconds]
SolarAquarion has quit [Ping timeout: 240 seconds]
miah has quit [Ping timeout: 260 seconds]
miah has joined #ruby
Junaos has quit [Ping timeout: 265 seconds]
Junaos has joined #ruby
SegFaultAX has joined #ruby
Beams has quit [Quit: .]
za1b1tsu has joined #ruby
russt has joined #ruby
psychicist__ has joined #ruby
SolarAquarion has joined #ruby
za1b1tsu has quit [Ping timeout: 248 seconds]
johnnyt has joined #ruby
johnnyt has left #ruby [#ruby]
Burgestrand has joined #ruby
AJA4350 has joined #ruby
hs366 has quit [Quit: Leaving]
bijan_ has quit [Remote host closed the connection]
badeball has joined #ruby
bijan_ has joined #ruby
unreal_ has quit [Ping timeout: 240 seconds]
bijan__ has joined #ruby
za1b1tsu has joined #ruby
bijan__ has quit [Read error: Connection reset by peer]
bijan_ has quit [Ping timeout: 256 seconds]
FernandoBasso has joined #ruby
User458764 has joined #ruby
User458764 has quit [Client Quit]
bijan_ has joined #ruby
Beams has joined #ruby
TJ- has joined #ruby
ciro has joined #ruby
bijan_ has quit [Ping timeout: 256 seconds]
<ineb> apeiros_: what about arr.none?
<apeiros_> ineb: that's not the inversion of .include?, it's the inversion of all?
apeiros_ is now known as apeiros
<ineb> ok
<havenwood> ineb: Also, with a single argument (2.5) none? will compare with ===, not ==.
<havenwood> ![42].include? Integer #=> true
<havenwood> [42].none? Integer #=> false
<havenwood> ineb: So opposite results ^
<apeiros> the single arg thing is as of 2.5? or 2.4 already?
<havenwood> 2.5
<apeiros> thx
meinside has joined #ruby
BTRE has joined #ruby
tristanp has joined #ruby
Cybergeek has joined #ruby
tristanp has quit [Ping timeout: 240 seconds]
drale2k_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
postmodern has quit [Quit: Leaving]
Burgestrand has quit [Quit: Closing time!]
Mattias__ has joined #ruby
drale2k_ has joined #ruby
Mattias__ is now known as Cork
ghoti_ has joined #ruby
mikecmpb_ has joined #ruby
canton7_ has joined #ruby
mikecmpbll has quit [Read error: Connection reset by peer]
ghoti has quit [Read error: Connection reset by peer]
manakanapa5 has quit [Quit: Ping timeout (120 seconds)]
jerryskye has quit [Quit: Ping timeout (120 seconds)]
woodruffw has quit [Ping timeout: 244 seconds]
kenichi has quit [Remote host closed the connection]
canton7 has quit [Remote host closed the connection]
nchambers has quit [Quit: So long and thanks for all the fish!]
justinmcp has quit [Quit: No Ping reply in 180 seconds.]
jalcine has quit [Ping timeout: 244 seconds]
jyaworski has quit [Ping timeout: 244 seconds]
Radar has quit [Ping timeout: 244 seconds]
matti has quit [Ping timeout: 244 seconds]
connor_goodwolf has quit [Ping timeout: 244 seconds]
j416 has quit [Ping timeout: 244 seconds]
chaos95 has quit [Ping timeout: 244 seconds]
asio_ has quit [Ping timeout: 244 seconds]
canton7_ is now known as canton7
jyaworski_ has joined #ruby
jyaworski_ is now known as jyaworski
ineb has quit [Ping timeout: 244 seconds]
ule has quit [Remote host closed the connection]
\13k has quit [Ping timeout: 260 seconds]
woodruffw has joined #ruby
shortdudey123 has quit [Ping timeout: 240 seconds]
manakanapa5 has joined #ruby
jerryskye has joined #ruby
jalcine has joined #ruby
j416 has joined #ruby
uplime has joined #ruby
alem0lars has joined #ruby
shortdudey123 has joined #ruby
\13k has joined #ruby
fmcgeough has joined #ruby
georgie has quit []
bga57 has joined #ruby
Dbugger has quit [Remote host closed the connection]
tristanp has joined #ruby
thy0 has joined #ruby
Dbugger has joined #ruby
tristanp has quit [Ping timeout: 240 seconds]
johnny56_ has joined #ruby
FernandoBasso has quit [Quit: Page closed]
johnny56 has quit [Ping timeout: 276 seconds]
Mike11 has quit [Read error: Connection reset by peer]
nickjj has quit [Read error: Connection reset by peer]
drale2k_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
alem0lars has quit [Ping timeout: 244 seconds]
FernandoBasso has joined #ruby
mydog2 has joined #ruby
ferhaty has quit [Quit: ferhaty]
Inline has joined #ruby
Burgestrand has joined #ruby
nmeum has joined #ruby
<nmeum> Is there any standard method to convert an address family integer such as Socket::AF_INET to a string representation, e.g. "AF_INET"?
FernandoBasso has quit [Ping timeout: 252 seconds]
<leah2> Hash[Socket.constants.grep(/AF_/).map{|c|[Socket.const_get(c),c]}] ;)
bijan_ has joined #ruby
<leah2> (since when is Hash[[[k1,v1],[k1,v2]]] allowed?)
gray_-_wolf has joined #ruby
ciro has quit [Ping timeout: 240 seconds]
Rapture has joined #ruby
beefjoe has joined #ruby
bak1an has quit [Quit: Textual IRC Client: www.textualapp.com]
Nicmavr has quit [Read error: Connection reset by peer]
Nicmavr has joined #ruby
akaiiro has joined #ruby
drale2k_ has joined #ruby
<apeiros> leah2: you mean re duplicate keys?
<apeiros> or the way Hash::[] works?
<apeiros> if you meant the latter, i.e. `Hash[[[k1,v1],[k2,v2]]]` (k2 instead of k1), then 1.8.7/1.9 iirc.
<leah2> really oO
<apeiros> leah2: btw., Array#to_h
<leah2> >> RUBY_VERSION
<ruby[bot]> leah2: # => "2.3.0" (https://eval.in/1045393)
<leah2> => "2.2.1"
<apeiros> >> require 'socket'; Socket.constants.grep(/AF_/).map{|c|[Socket.const_get(c),c]}.to_h
<leah2> >> Hash[[1,2],[3,4]]
<ruby[bot]> apeiros: # => {0=>:AF_UNSPEC, 2=>:AF_INET, 10=>:AF_INET6, 1=>:AF_LOCAL, 3=>:AF_AX25, 4=>:AF_IPX, 5=>:AF_APPLETALK, ...check link for more (https://eval.in/1045394)
<ruby[bot]> leah2: # => {[1, 2]=>[3, 4]} (https://eval.in/1045395)
<leah2> => {[1, 2]=>[3, 4]}
<leah2> ah duh, typo
<apeiros> 18>> >> Hash[[1,2],[3,4]]
<ruby[bot]> apeiros: # => /tmp/execpad-802ac6c420a9/source-802ac6c420a9:2: syntax error, unexpected tRSHFT ...check link for more (https://eval.in/1045396)
<apeiros> 18>> Hash[[1,2],[3,4]]
<ruby[bot]> apeiros: # => {[1, 2]=>[3, 4]} (https://eval.in/1045397)
<apeiros> 19>> Hash[[1,2],[3,4]]
<ruby[bot]> apeiros: # => {[1, 2]=>[3, 4]} (https://eval.in/1045398)
<leah2> it really worked in 1.8.7 oO
<leah2> nice
<apeiros> 18>> Hash[[[1,2],[3,4]]]
<ruby[bot]> apeiros: # => {1=>2, 3=>4} (https://eval.in/1045399)
<apeiros> meh, not enough brackets!
<apeiros> 18>> RUBY_VERSION
<ruby[bot]> apeiros: # => "1.8.7" (https://eval.in/1045400)
<leah2> recently i found other fun stuff
<leah2> /[a-z&&[^g]]/
<leah2> and slice_after, slice_before, slice_when
<apeiros> whatwhathwat?!? (re regex)
<leah2> unfortunately there still is no Array#split
<apeiros> why did I never know?
<apeiros> I'd also like Array#chunk
<apeiros> (split it into chunks of the same size)
<leah2> that exists?
<apeiros> no. hence I'd like to have it :)
<leah2> each_slice?
<apeiros> actually same for string, but there we can at least (ab)use scan
<apeiros> huh? right
<leah2> >> "g" =~ /[a-z&&[^g]]/
<apeiros> I blame the heat.
<ruby[bot]> leah2: # => nil (https://eval.in/1045401)
<leah2> 18>> "g" =~ /[a-z&&[^g]]/
<ruby[bot]> leah2: # => /tmp/execpad-e0fd61ede105/source-e0fd61ede105:2: warning: character class has `[' without escape ...check link for more (https://eval.in/1045402)
<leah2> 21>> "g" =~ /[a-z&&[^g]]/
<ruby[bot]> leah2: # => nil (https://eval.in/1045403)
<leah2> 20>> "g" =~ /[a-z&&[^g]]/
<leah2> triggered -.-
<alex``> How to refer to sub-module name?
<alex``> MyModule::{Name}
<apeiros> leah2: you're likely throttled, sorry :)
<leah2> 20>> "g" =~ /[a-z&&[^g]]/
<apeiros> alex``: const_get
<leah2> and querying doesnt work :P
<alex``> Wow
<apeiros> leah2: hm?
<leah2> the bot
<alex``> MyModule.const_get('Name') so ?
<apeiros> alex``: yes
<alex``> And within a class?
<alex``> in class Foo::Bar, how to refer to Foo::Babar?
<apeiros> leah2: been a while since I implemented it. but I think once you hit the threshold, it'll not do anything which results in a reply. in order to avoid the bot itself triggering thresholds on the ircd side.
<alex``> without naming Foo
<apeiros> alex``: Foo is first and foremost a constant
<leah2> i see
<apeiros> it can happen to reference a class, a module or any other object (remember, classes and modules are objects)
apparition has quit [Quit: Bye]
<apeiros> alex``: one way is `class Foo; def get_bar; self.class.const_get(:Bar); end; end`
<apeiros> in class body scope, you can of course drop the `self.class.` part.
<apeiros> (since self == Foo there)
<alex``> apeiros: It’s simpler to refer by full path Foo::Bar then no?
<apeiros> alex``: depends. that's not the same.
<apeiros> (not necessarily the same)
<apeiros> class Qoo < Foo; Bar = "another bar"; end
<apeiros> with Foo.const_get(:Bar), both Qoo.new.get_bar and Foo.new.get_bar will get Foo::Bar
<apeiros> with self.class.const_get(:Bar), Qoo.new.get_bar will get Qoo::Bar
bijan_ has quit [Remote host closed the connection]
<apeiros> oh, or you mean Foo::Bar instead of Foo.const_get(:Bar)? if so, then yes. always. if you have the name literally, then don't use const_get :D
<alex``> in class Foo::Bar, I can do self.class.const_get 'Babar' to refer to Foo::Babar ?
<apeiros> within instance methods, yes.
<apeiros> if you have the name literally, you can just do `Babar`
<alex``> I don’t understand well
<apeiros> maybe show the actual problem instead
<alex``> self.class refer to Foo::Bar, not the Foo module; how self.class.const_get('Babar') can return Foo::Babar refrence ?
bijan_ has joined #ruby
<apeiros> why'd self.class refer to Foo::Bar?
<apeiros> >> class Foo; def self_class; self.class; end; end; Foo.new.self_class
<ruby[bot]> apeiros: # => Foo (https://eval.in/1045407)
<alex``> >> module Foo; end; class Foo::Babar; end; class Foo::Bar; def bar; self.class.const_get('Babar'); end; Foo::Bar.new.bar
<ruby[bot]> alex``: # => /tmp/execpad-78ab8692bc9f/source-78ab8692bc9f:7: syntax error, unexpected end-of-input, expecting ke ...check link for more (https://eval.in/1045408)
<alex``> >> module Foo; end; class Foo::Babar; end; class Foo::Bar; def bar; self.class.const_get('Babar'); end; end; Foo::Bar.new.bar
<ruby[bot]> alex``: # => uninitialized constant Foo::Bar::Babar ...check link for more (https://eval.in/1045409)
<alex``> >> module Foo; end; class Foo::Babar; end; class Foo::Bar; def bar; Foo.const_get('Babar'); end; end; Foo::Bar.new.bar
<ruby[bot]> alex``: # => Foo::Babar (https://eval.in/1045410)
<alex``> o/
bijan_ has quit [Ping timeout: 256 seconds]
biberu has quit []
<gray_-_wolf> ok this is maybe a stupid question but how can I run just one ruby test file? `make check` executes everything and takes too long, how can I run just /test/ruby/test_file.rb ?
bijan_ has joined #ruby
cschneid_ has joined #ruby
Burgestrand has quit [Quit: Closing time!]
thy0 has quit [Ping timeout: 248 seconds]
bijan_ has quit [Read error: Connection reset by peer]
<Caerus> gray_-_wolf, have you tried: rails test /test/ruby/test_file.rb ?
<Caerus> for more options: rails test --help
<gray_-_wolf> oh, sorry, I'm talking about ruby itself here, not rails. Should've made that clear
snickers has joined #ruby
<gray_-_wolf> but I guess I can try it and how nothing subtle breaks
<Caerus> my bad, it was me that screwed the channels
snickers has quit [Client Quit]
beefjoe has quit [Remote host closed the connection]
<Caerus> if you´re using RSpec you can require "rspec/autorun" on any rb file and then just run the file, I believe. haven´t used rspec in a while
dionysus69 has quit [Ping timeout: 268 seconds]
bijan_ has joined #ruby
bijan_ has quit [Read error: Connection reset by peer]
<gray_-_wolf> Yeeey! `make test-all TESTS=ruby/test_file.rb`
troys has joined #ruby
maryo has joined #ruby
Caerus has quit [Ping timeout: 260 seconds]
polishdub has joined #ruby
Creatornator has joined #ruby
bijan_ has joined #ruby
alfiemax has joined #ruby
BTRE has quit [Quit: Leaving]
bijan_ has quit [Read error: Connection reset by peer]
bijan_ has joined #ruby
bijan_ has quit [Remote host closed the connection]
tcopeland has joined #ruby
tcopeland has quit [Client Quit]
BTRE has joined #ruby
alfiemax has quit [Ping timeout: 240 seconds]
velu[m] has quit [Quit: removing from IRC because user idle on matrix for 30+ days]
aufi has quit [Ping timeout: 240 seconds]
alfiemax has joined #ruby
TomyWork has quit [Ping timeout: 240 seconds]
clemens3 has quit [Ping timeout: 240 seconds]
wolfshappen has quit [Ping timeout: 260 seconds]
Caerus has joined #ruby
FernandoBasso has joined #ruby
bijan_ has joined #ruby
alfiemax has quit [Remote host closed the connection]
alfiemax has joined #ruby
bijan_ has quit [Ping timeout: 256 seconds]
wolfshappen has joined #ruby
Dbugger has quit [Ping timeout: 240 seconds]
alfiemax has quit [Ping timeout: 240 seconds]
ohcibi has quit [Ping timeout: 240 seconds]
Zaab1t has joined #ruby
bijan_ has joined #ruby
rippa has joined #ruby
dionysus69 has joined #ruby
dionysus69 has quit [Client Quit]
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ivanskie has joined #ruby
apeiros has quit []
bijan_ has quit [Ping timeout: 256 seconds]
ivanskie has quit [Client Quit]
ivanskie has joined #ruby
Dbugger has joined #ruby
cthulchu has joined #ruby
sysvalve has quit [Quit: Leaving]
bijan_ has joined #ruby
jnix has joined #ruby
ciro has joined #ruby
maryo has quit [Ping timeout: 244 seconds]
bijan_ has quit [Ping timeout: 256 seconds]
Creatornator has joined #ruby
ciro has quit [Ping timeout: 256 seconds]
Creatornator has quit [Client Quit]
bijan_ has joined #ruby
bijan_ has quit [Ping timeout: 256 seconds]
ciro has joined #ruby
Beams has quit [Quit: .]
bijan_ has joined #ruby
yohji has quit [Remote host closed the connection]
bijan_ has quit [Ping timeout: 256 seconds]
akaiiro has quit [Ping timeout: 244 seconds]
klaas has joined #ruby
<cjohnson> Is there a nice way to say return x if x
<cjohnson> where x is a longer expression?
kieranjogrady has quit [Quit: Connection closed for inactivity]
bijan_ has joined #ruby
<cjohnson> Do I just need to write x to a variable
<alex``> Hm
jcarl43 has joined #ruby
maryo has joined #ruby
<alex``> cjohnson: is Proc satisfaying?
bijan_ has quit [Ping timeout: 256 seconds]
<alex``> return_if = Proc.new { |expression| return expression if expression }
<alex``> return_if.call x
lomex has joined #ruby
<alex``> or saving
<alex``> x = {long-expression}
<alex``> return x if x
mikecmpb_ has quit [Ping timeout: 260 seconds]
ivanskie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ivanskie has joined #ruby
<cjohnson> Yeah I may as well just use the variable, its just a bit messy how I'm doing it
bijan_ has joined #ruby
akaiiro has joined #ruby
tty has joined #ruby
bijan_ has quit [Ping timeout: 256 seconds]
maryo_ has joined #ruby
[Butch] has joined #ruby
maryo has quit [Ping timeout: 244 seconds]
mikecmpbll has joined #ruby
apeiros_ has joined #ruby
bijan_ has joined #ruby
eckhardt_ has joined #ruby
mikecmpbll has quit [Client Quit]
mikecmpbll has joined #ruby
bijan_ has quit [Ping timeout: 256 seconds]
orbyt_ has joined #ruby
Dbugger has quit [Ping timeout: 240 seconds]
<maryo_> I am trying to troubleshoot a ruby code which is written an year ago by one of our system admin and looking for some guidance. I wanted to figure out, the complete value for request statement in this program -> https://dpaste.de/inch# is there a way to print the value on what it takes?
nmeum has left #ruby [#ruby]
bijan_ has joined #ruby
r29v has joined #ruby
AJA4351 has joined #ruby
lxsameer has quit [Ping timeout: 240 seconds]
AJA4350 has quit [Ping timeout: 260 seconds]
AJA4351 is now known as AJA4350
lxsameer has joined #ruby
TomyLobo has joined #ruby
<elomatreb> maryo_: You can use the debug print method p, e.g. `p request`
bijan_ has quit [Ping timeout: 256 seconds]
<maryo_> elomatreb, thank you so much. Will try that
tag has joined #ruby
Mike11 has joined #ruby
<baweaver> cjohnson: got an example?
<baweaver> I tend to use methods if conditions get long
<baweaver> return x if thing_was_in_bounds?(x)
<baweaver> Gives a name to the concept
<maryo_> elomatreb, hey could you also provide some pointers on this error pls -> https://dpaste.de/dokf when I run the program, I get those errors
Creatornator has joined #ruby
<elomatreb> You're not showing your entire code, there is no mention of a SCHEDULER anywhere
<baweaver> maryo_: You're referring to something that doesn't exist.
<baweaver> See the last line of your error.
bijan_ has joined #ruby
<elomatreb> The first two lines are not errors per se, only warnings that something violated the constant-assumption by reassigning
<baweaver> Could use some eyes and opinions on this PR - https://github.com/baweaver/qo/pull/20
<baweaver> Qo is going 0.5, solidifying the API
<baweaver> more of an RFC really.
lxsameer has quit [Ping timeout: 240 seconds]
lxsameer has joined #ruby
<baweaver> Mostly if you take a look at the README diff and notes that covers the bulk case
SeepingN has joined #ruby
<maryo_> baweaver, elomatreb sorry I missed it in the last paste.. Here it is https://dpaste.de/FO26
bijan_ has quit [Ping timeout: 256 seconds]
lxsameer has quit [Ping timeout: 240 seconds]
<elomatreb> maryo_: There has to be more to this or the script isn't meant to run in isolation, there is nothing to explain where the scheduler is supposed to come from
lxsameer has joined #ruby
HoierM has joined #ruby
bijan_ has joined #ruby
impermanence has quit [Ping timeout: 240 seconds]
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bijan_ has quit [Ping timeout: 256 seconds]
memo1 has quit [Ping timeout: 248 seconds]
gnufied has quit [Ping timeout: 240 seconds]
agent_white has joined #ruby
chouhoulis has joined #ruby
alex`` has quit [Ping timeout: 244 seconds]
za1b1tsu has quit [Read error: Connection reset by peer]
lxsameer has quit [Ping timeout: 240 seconds]
bijan_ has joined #ruby
bijan_ has quit [Ping timeout: 256 seconds]
gnufied has joined #ruby
Inline has quit [Quit: Leaving]
AJA4351 has joined #ruby
bijan_ has joined #ruby
Inline has joined #ruby
AJA4350 has quit [Ping timeout: 260 seconds]
AJA4351 is now known as AJA4350
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bijan_ has quit [Ping timeout: 256 seconds]
gnufied has quit [Quit: Leaving]
llua has quit [Quit: <Rudolph> shell code is what greycat reads to kids when he tucks them in]
HoierM has quit [Ping timeout: 256 seconds]
HoierM has joined #ruby
llua has joined #ruby
sameerynho has joined #ruby
bijan_ has joined #ruby
orbyt_ has joined #ruby
Mikasi has joined #ruby
MikasiCoyote has joined #ruby
Mikasi has quit [Client Quit]
lxsameer has joined #ruby
lxsameer has quit [Ping timeout: 240 seconds]
Zaab1t has quit [Quit: Zaab1t]
sauvin has quit [Read error: Connection reset by peer]
ghoti_ is now known as ghoti
bijan_ has quit [Ping timeout: 256 seconds]
alex`` has joined #ruby
mikecmpbll has quit [Quit: inabit. zz.]
bijan_ has joined #ruby
ivanskie has quit [Ping timeout: 244 seconds]
lxsameer has joined #ruby
bijan_ has quit [Ping timeout: 256 seconds]
jnix has quit [Quit: Connection closed for inactivity]
AJA4351 has joined #ruby
drale2k_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
AJA4350 has quit [Ping timeout: 244 seconds]
AJA4351 is now known as AJA4350
lxsameer has quit [Ping timeout: 240 seconds]
lxsameer has joined #ruby
lomex has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
oldandwise has quit [Read error: Connection reset by peer]
samort7 has joined #ruby
bijan_ has joined #ruby
alex`` has quit [Ping timeout: 256 seconds]
lomex has joined #ruby
lxsameer has quit [Ping timeout: 240 seconds]
lxsameer has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bijan_ has quit [Ping timeout: 256 seconds]
c0ncealed2 has quit [Remote host closed the connection]
c0ncealed2 has joined #ruby
gnufied has joined #ruby
bijan_ has joined #ruby
bijan_ has quit [Ping timeout: 256 seconds]
Azure has quit [Ping timeout: 260 seconds]
lomex has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
joecodes has joined #ruby
Azure has joined #ruby
bijan_ has joined #ruby
lxsameer has quit [Ping timeout: 260 seconds]
lxsameer has joined #ruby
bijan_ has quit [Ping timeout: 256 seconds]
lomex has joined #ruby
bijan_ has joined #ruby
lxsameer has quit [Ping timeout: 240 seconds]
aldr has joined #ruby
orbyt_ has joined #ruby
lxsameer has joined #ruby
bijan_ has quit [Remote host closed the connection]
bijan__ has joined #ruby
bijan__ has quit [Ping timeout: 240 seconds]
mochiyoda has quit [Ping timeout: 260 seconds]
alex`` has joined #ruby
lxsameer has quit [Ping timeout: 240 seconds]
fmcgeough has quit [Quit: fmcgeough]
lxsameer has joined #ruby
HoierM has quit [Ping timeout: 260 seconds]
lomex has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
maryo_ has quit [Ping timeout: 240 seconds]
doubledup has joined #ruby
fmcgeough has joined #ruby
rrichardsr3 has joined #ruby
lxsameer has quit [Ping timeout: 260 seconds]
lomex has joined #ruby
<samort7> Afternoon everyone
lomex has quit [Client Quit]
<samort7> I had an interview last week and during the technical part of it, the guy asked me how I would structure the code for the cards in a game like blackjack or poker. I didn't get time to finish my answer with him, so I decided to try to write it up in my free time as practice.
lomex has joined #ruby
<samort7> Was wondering if someone could take a quick look at it and tell me if the basic structure seems intelligent. Games not finished yet, all it does is deal some cards. Mostly concerned with my class organization: https://github.com/tliss/blackjack
lomex has quit [Client Quit]
Burgestrand has joined #ruby
<mensvaga> The problem with the question is that Black Jack is a pretty small game.
<mensvaga> If you're already doing OO programming, and "organizing" stuff a certain way, and you get it working
<mensvaga> the next thing to focus on is discussing with yourself how you could make it better, and at what costs
<mensvaga> Everybody has their own way for "liking" how object oriented stuff gets designed.
<mensvaga> For job interviews, if you have a requisite level of knowledge, the NEXT step is determining whether or not you're capable of working with the people who will be on your team.
<samort7> mensvaga: Yea, I get that, but the recruiter just wanted a high-level explanation of how I would organize it (I didn't actually have to code it out - I just did that for some extra practice)
<samort7> I made a card, deck, and hand class and was just wondering if that's what the recruiter wanted to hear
<mensvaga> So, "Give me a high-level explanation for how you would design something simple" , eh?
<samort7> mensvaga: pretty much
alfiemax has joined #ruby
<mensvaga> After looking at your code... you might want to consider the fact that you COULD have more technical knowledge than the recruiter, but don't be arrogant about it.
<mensvaga> In many ways they're just gate keepers with checklists.
<elomatreb> One thing might be that you could think about validation
<mensvaga> He's desigining the cards, and deck.
aldr has quit [Remote host closed the connection]
<mensvaga> Validation would only be on input side.
<elomatreb> Not necessarily
Mike11 has quit [Quit: Leaving.]
<mensvaga> "Please make sure the cards that you make are valid." - Uh, OK. You can pay me to waste my time on stuff you want to get done.
<mensvaga> You could definitely test the logic of the game
<elomatreb> E.g. currently you represent the different types of cards as magic primitives (integers and strings), but you might also consider using something like an enum
Creatornator has joined #ruby
<samort7> elomatreb: could you elaborate on that a bit? What would I be enumerating exactly?
<mensvaga> So, this is actually TURNING into a job interview.
<samort7> mensvaga: XD
<elomatreb> Ruby doesn't have real enums, but you might create e.g. create classes that represent to the suits types
<elomatreb> Just simple Objects with no behavior, but the thing you gain is that you can't accidentally typo a suit and get weird bugs
<samort7> elomatreb: ah, that's actually pretty clever. Nice idea!
<mensvaga> I'd take points away for kissing ass
AJA4350 has quit [Remote host closed the connection]
AJA4350 has joined #ruby
SCHAPiE has quit [Ping timeout: 240 seconds]
SCHAPiE has joined #ruby
vikaton has joined #ruby
gnufied has quit [Ping timeout: 244 seconds]
mochiyoda has joined #ruby
fmcgeough has quit [Quit: fmcgeough]
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
scrptktty has joined #ruby
lxsameer has joined #ruby
MikasiCoyote has quit [Read error: Connection reset by peer]
FernandoBasso has quit [Quit: Page closed]
mikecmpbll has joined #ruby
dinfuehr has quit [Ping timeout: 240 seconds]
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
chouhoulis has quit [Ping timeout: 256 seconds]
dinfuehr has joined #ruby
za1b1tsu has joined #ruby
gnufied has joined #ruby
lxsameer has quit [Ping timeout: 248 seconds]
vutral|kali has joined #ruby
<baweaver> >> [*2..10, *%(J Q K A)].product(%w(h s d c)).map(&:join).shuffle.first(5)
<ruby[bot]> baweaver: # => ["J Q K Ah", "6d", "6c", "7c", "2h"] (https://eval.in/1045518)
<baweaver> ah, right
<baweaver> >> [*2..10, *%w(J Q K A)].product(%w(h s d c)).map(&:join).shuffle.first(5)
<ruby[bot]> baweaver: # => ["9c", "2s", "3h", "7c", "10s"] (https://eval.in/1045519)
<baweaver> cards :D
<baweaver> elomatreb: Do I get a cookie?
<baweaver> 'tis a crap poker hand though
<baweaver> AHA!
<baweaver> That's what I can use
<baweaver> Qo to pattern match poker hands!
[Butch] has quit [Quit: Textual IRC Client: www.textualapp.com]
<baweaver> Will have to make that into an example.
c0ncealed2 has quit [Remote host closed the connection]
eckhardt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
c0ncealed2 has joined #ruby
Burgestrand has quit [Quit: Closing time!]
pisculichi has joined #ruby
Azure has quit [Read error: Connection reset by peer]
doubledup has quit [Remote host closed the connection]
lxsameer has joined #ruby
psychicist__ has quit [Ping timeout: 248 seconds]
<samort7> <-- Still trying to figure out baweaver's code
arup_r has joined #ruby
Azure has joined #ruby
reber__ has joined #ruby
lxsameer has quit [Ping timeout: 240 seconds]
lxsameer has joined #ruby
Azure has quit [Remote host closed the connection]
reber has quit [Ping timeout: 260 seconds]
fmcgeough has joined #ruby
lxsameer has quit [Ping timeout: 244 seconds]
lxsameer has joined #ruby
<apeiros_> baweaver: 5 cards? doesn't sound like texas hold'em?
lxsameer has quit [Ping timeout: 240 seconds]
sameerynho has quit [Ping timeout: 260 seconds]
wildermind has quit [Quit: Connection closed for inactivity]
za1b1tsu has quit [Ping timeout: 248 seconds]
arup_r has quit []
alex`` has quit [Quit: WeeChat 2.2]
Rapture has quit [Quit: Textual IRC Client: www.textualapp.com]
kapil___ has quit [Quit: Connection closed for inactivity]
<baweaver> samort7: cartesian products :D
fmcgeough has quit [Quit: fmcgeough]
mikecmpbll has quit [Quit: inabit. zz.]
lxsameer has joined #ruby
TomyLobo has quit [Read error: Connection reset by peer]
tdy has quit [Ping timeout: 240 seconds]
orbyt_ has quit [Quit: Textual IRC Client: www.textualapp.com]
lxsameer has quit [Ping timeout: 256 seconds]
lxsameer has joined #ruby
eckhardt_ has joined #ruby
lxsameer has quit [Ping timeout: 256 seconds]
lxsameer has joined #ruby
reber__ has quit [Remote host closed the connection]
Radar has joined #ruby
lxsameer has quit [Ping timeout: 244 seconds]
polishdub has quit [Remote host closed the connection]
troys has quit [Ping timeout: 244 seconds]
ur5us has joined #ruby
duderonomy has quit [Ping timeout: 240 seconds]
duderonomy has joined #ruby
duderonomy has quit [Client Quit]
weaksauce has joined #ruby
apeiros_ has quit []
moei has quit [Quit: Leaving...]
moei has joined #ruby
chouhoulis has joined #ruby
<havenwood> >> [*'2'..'10', 'Jack', 'Queen', 'King', 'Ace'].product(%w[Hearts Spades Diamonds Clubs]).map { |rank, suit| "#{rank} of #{suit}" }.lazy.each_slice(3).take(3).force
<ruby[bot]> havenwood: # => [["2 of Hearts", "2 of Spades", "2 of Diamonds"], ["2 of Clubs", "3 of Hearts", "3 of Spades"], ["3 ...check link for more (https://eval.in/1045527)
<havenwood> oh, right - gotta shuffle!
<havenwood> >> [*'2'..'10', 'Jack', 'Queen', 'King', 'Ace'].product(%w[Hearts Spades Diamonds Clubs]).shuffle.map { |rank, suit| "#{rank} of #{suit}" }.lazy.each_slice(3).take(3).force
<ruby[bot]> havenwood: # => [["8 of Spades", "Queen of Diamonds", "Queen of Clubs"], ["3 of Clubs", "6 of Spades", "2 of Spades" ...check link for more (https://eval.in/1045528)
<havenwood> Pair of Queens! Index 0 wins.
scrptktty has quit [Quit: Connection closed for inactivity]
<havenwood> >> srand 0; [*'2'..'10', 'Jack', 'Queen', 'King', 'Ace'].product(%w[Hearts Spades Diamonds Clubs]).shuffle.map { |rank, suit| "#{rank} of #{suit}" }.lazy.each_slice(3).take(3).force
<ruby[bot]> havenwood: # => [["9 of Hearts", "Jack of Spades", "4 of Clubs"], ["10 of Diamonds", "2 of Diamonds", "9 of Diamonds ...check link for more (https://eval.in/1045529)
lxsameer has joined #ruby
cschneid_ has quit [Remote host closed the connection]
pedahzur has joined #ruby
<havenwood> >> srand 2549; [*'2'..'10', 'Jack', 'Queen', 'King', 'Ace'].product(%w[Hearts Spades Diamonds Clubs]).shuffle.map { |rank, suit| "#{rank} of #{suit}" }.lazy.each_slice(3).take(3).force.last
<ruby[bot]> havenwood: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
<havenwood> >> srand 2549; [*'2'..'10', 'Jack', 'Queen', 'King', 'Ace'].product(%w[Hearts Spades Diamonds Clubs]).shuffle.map { |rank, suit| "#{rank} of #{suit}" }.lazy.each_slice(3).take(3).force.last
<ruby[bot]> havenwood: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
<havenwood> #=> ["Ace of Clubs", "Ace of Diamonds", "Ace of Spades"]
<pedahzur> I'm trying to compare versions with Gem::Version (in inspec, package resource). I'm trying to do >= '1.0'. But it is saying 1.0-2 is *NOT* >= 1.0. How would I properly compare that?
<havenwood> pedahzur: 1.0.2 is greater than 1.0
<havenwood> pedahzur: What does the "2" following the "-" mean?
<pedahzur> havenwood I know it is. :) But I get the message: "expected it to be >= "1.0"" "got: 1.0-2" So, the test is failing.
<pedahzur> havenwood: build number.
<havenwood> pedahzur: Is this a gem version? Do you control the gem versioning?
<pedahzur> havenwood: It's the inspec package resource. This isn't a gem version, it's a package version. If I do this: Gem::Version::new('1.0-2'), I get told "Malformed version number" so it sounds like this test might not work.
Doow has quit [Ping timeout: 240 seconds]
lxsameer has quit [Ping timeout: 260 seconds]
<pedahzur> Hmm...I wonder why inspec is pulling the build number into the version...
lxsameer has joined #ruby
<havenwood> pedahzur: Yeah, that's against RubyGems versioning convention so it's not supported.
<havenwood> pedahzur: Gem::Version.new('1.0-2'.gsub(/[^\d]/, '.')) > Gem::Version.new('1.0') #=> true
<pedahzur> Right.
<havenwood> Or tr would be faster.
<havenwood> pedahzur: FWIW: '1.0-2' > '1.0' #=> true
<havenwood> pedahzur: I think plain String comparison is closer to what you want than Gem versions.
<havenwood> pedahzur: I don't know your other versioning conventions but you might just check if String#<=> passes your tests.
<pedahzur> Yeah. Inspec docs say it uses Gem::Version, so....
<havenwood> pedahzur: You might try the #chef channel if you haven't already. I don't know why they do that if it's not a Gem version.
<pedahzur> havenwood: Thanks.
Azure has joined #ruby
ur5us has quit [Read error: Connection reset by peer]
lxsameer has quit [Ping timeout: 240 seconds]
ur5us has joined #ruby
lxsameer has joined #ruby
orbyt_ has joined #ruby
lxsameer has quit [Ping timeout: 248 seconds]
lxsameer has joined #ruby
lxsameer has quit [Ping timeout: 240 seconds]
lxsameer has joined #ruby
tdy has joined #ruby
thy0 has joined #ruby
lxsameer has quit [Ping timeout: 256 seconds]
lxsameer has joined #ruby
joecodes has quit [Quit: Page closed]
duderonomy has joined #ruby
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
lxsameer has quit [Ping timeout: 244 seconds]