<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.
<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.
<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.
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]
<ruby[bot]>
apeiros: # => /tmp/execpad-802ac6c420a9/source-802ac6c420a9:2: syntax error, unexpected tRSHFT ...check link for more (https://eval.in/1045396)
<ruby[bot]>
leah2: # => /tmp/execpad-e0fd61ede105/source-e0fd61ede105:2: warning: character class has `[' without escape ...check link for more (https://eval.in/1045402)
<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
<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
<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]
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>
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
<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)
<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]
<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]
<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.