<hagabaka>
for example [1,2,3]['a'] gives TypeError: no implicit conversion of String into Integer
marr has quit []
<weaksauce>
yes
RobertBirnie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
hendranata_ has joined #ruby-lang
avdi has joined #ruby-lang
<weaksauce>
because it's not a hash and ['a'] is trying to look up like a hash
<weaksauce>
vs array [1,2,3][1] == 2 => true
<weaksauce>
hagabaka are you talking about where in your code specifically it is causing that error? or are you talking about in general which ways could it happen? [1,2,3] + "string" will also do that error
adambeynon has joined #ruby-lang
bryancp has joined #ruby-lang
<hagabaka>
well I'm curious in general, but I'm also trying to find out what part of that code is causing it. But that's a good answer, "string" + [1,2,3] gives the error I got
<weaksauce>
basically what that means is that ruby is trying to coerce the type of an array to a string
Aova has joined #ruby-lang
<weaksauce>
to_s shouldn't cause that error.
<hagabaka>
that's not my code btw, I'm just trying to use the library
<weaksauce>
I'd say one of the + or * operators is doingit
<weaksauce>
but most likely +
|jemc| has joined #ruby-lang
gix has quit [Ping timeout: 240 seconds]
tkuchiki has joined #ruby-lang
mattyohe has quit []
mattyohe has joined #ruby-lang
gix has joined #ruby-lang
stamina has quit [Ping timeout: 255 seconds]
roamingdog has quit [Remote host closed the connection]
jxie has quit [Quit: leaving]
sankaber has joined #ruby-lang
centrx has quit [Quit: In the beginning there was nothing, which exploded. - Terry Pratchett]
roamingdog has joined #ruby-lang
lytol has joined #ruby-lang
grandy has quit []
grandy has joined #ruby-lang
roamingdog has quit [Remote host closed the connection]
lytol has quit [Ping timeout: 240 seconds]
roamingdog has joined #ruby-lang
roamingdog has quit [Remote host closed the connection]
roamingdog has joined #ruby-lang
AlexAltea has quit [Quit: Leaving]
roamingdog has quit [Remote host closed the connection]
mikecmpbll has quit [Quit: i've nodded off.]
roamingdog has joined #ruby-lang
roamingdog has quit [Remote host closed the connection]
roamingdog has joined #ruby-lang
amsi has quit [Quit: Leaving]
djbkd has quit [Remote host closed the connection]
sankaber has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
djbkd has joined #ruby-lang
djbkd has quit [Remote host closed the connection]
j4cknewt has quit [Remote host closed the connection]
Aova has quit [Read error: Connection reset by peer]
rkrdo has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
tunaCanBruh has quit [Ping timeout: 265 seconds]
lytol has joined #ruby-lang
Aova has joined #ruby-lang
postmodern has quit [Quit: Leaving]
<crankharder>
when my gem is loaded it includes a module into ActionController::Base depending on the current version of Rails - this makes testing a bit difficult since I want to test the effects of each module on ActionController::Base, but as far as I can tell the gem's source is only loaded the one time
<crankharder>
suggestions how I can test it against different versions?
pabloh has quit [Quit: Saliendo]
chills42 has joined #ruby-lang
sankaber has joined #ruby-lang
rkrdo has joined #ruby-lang
fujimura has joined #ruby-lang
djbkd has quit [Remote host closed the connection]
djbkd has joined #ruby-lang
amclain has joined #ruby-lang
roamingdog has quit [Read error: No route to host]
<warcisan>
hi all, i don't know if this is the correct place to ask, but i can't wrap my head around a regex issue
<warcisan>
in interactive ruby it works, but when i execute it as a function from a puppet module i can't get a match
<warcisan>
i want to match something like "££aaa::blabla::zzz££" with: val.to_s.match(/\302\243\302\243[[[:alnum:]]+:*]+\302\243\302\243/)
<warcisan>
anyone any idea what i'm doing wrong?
djbkd_ has quit [Ping timeout: 264 seconds]
kwd has joined #ruby-lang
panda__ has quit [Read error: Connection reset by peer]
iamninja has joined #ruby-lang
nofxx has quit [Ping timeout: 250 seconds]
ta_ has joined #ruby-lang
<wnd>
either I'm not following or your input encoding is not utf-8, which you seem to expect
solars has joined #ruby-lang
<warcisan>
aha, i was already suspecting some kind of character issue... but i got these values by performing an "inspect"
<warcisan>
when i create a simpeler match between the pound signs, it works
<warcisan>
so it's more the "[[:alnum:]]" part that has issues
<wnd>
alnum probably only matches US-ASCII
<wnd>
nevermind: "POSIX bracket expressions are also similar to character classes. They provide a portable alternative to the above, with the added benefit that they encompass non-ASCII characters."
warcisan has quit [Ping timeout: 246 seconds]
ta_ has quit [Ping timeout: 240 seconds]
nofxx has joined #ruby-lang
hendranata_ has joined #ruby-lang
tunaCanBruh has joined #ruby-lang
greenarrow has joined #ruby-lang
fujimura has quit [Remote host closed the connection]
SuMo_D has quit [Remote host closed the connection]
tunaCanBruh has quit [Ping timeout: 252 seconds]
fujimura has joined #ruby-lang
|jemc| has quit [Ping timeout: 252 seconds]
roamingdog has joined #ruby-lang
ta has quit [Remote host closed the connection]
djbkd has joined #ruby-lang
roamingdog has quit [Ping timeout: 264 seconds]
ta has joined #ruby-lang
ta has quit [Remote host closed the connection]
ta has joined #ruby-lang
pepperbreath has quit [Quit: Leaving.]
pepperbreath has joined #ruby-lang
chills42 has joined #ruby-lang
marr has joined #ruby-lang
Integralist has joined #ruby-lang
chills42 has quit [Ping timeout: 264 seconds]
Integralist has quit [Client Quit]
Integralist has joined #ruby-lang
lytol has quit [Remote host closed the connection]
Aova has quit [Read error: Connection reset by peer]
twe4ked has quit [Ping timeout: 245 seconds]
Aova has joined #ruby-lang
mskaesz has joined #ruby-lang
mkaesz_ has joined #ruby-lang
mkaesz has quit [Ping timeout: 252 seconds]
pico-pete has quit [Ping timeout: 255 seconds]
mskaesz has quit [Read error: No route to host]
mkaesz has joined #ruby-lang
twe4ked has joined #ruby-lang
mkaesz_ has quit [Ping timeout: 244 seconds]
kyb3r_ has quit [Read error: Connection reset by peer]
Xzanron has quit [Ping timeout: 252 seconds]
mikecmpbll has joined #ruby-lang
stamina has joined #ruby-lang
solars has quit [Ping timeout: 245 seconds]
arBmind has quit [Quit: Leaving.]
fclausen has quit [Ping timeout: 272 seconds]
skyrocker has quit [Read error: Connection reset by peer]
hendranata_ has quit [Ping timeout: 245 seconds]
solars has joined #ruby-lang
<yorickpeterse>
morning
rikkipitt has joined #ruby-lang
workmad3 has joined #ruby-lang
arBmind has joined #ruby-lang
Aova has quit [Read error: Connection reset by peer]
yusuf1 has quit [Quit: Leaving.]
Xzanron has joined #ruby-lang
auspenskii has joined #ruby-lang
charliesome has joined #ruby-lang
Aova has joined #ruby-lang
j4cknewt has quit [Remote host closed the connection]
ta_ has joined #ruby-lang
ur5us has quit [Remote host closed the connection]
<havenwood>
rbpd5015: Ruby 1.8 is dead, so drop: require 'rubygems'
nofxx has joined #ruby-lang
nofxx has joined #ruby-lang
<rbpd5015>
to list the lines on 4 different lines
uberjar has joined #ruby-lang
<rbpd5015>
1st line I want away Line, then away moneyline
<rbpd5015>
then home line and home moneyline
<rbpd5015>
but instead the 1st line I get ["+8", "-110"]
<rbpd5015>
and second line ["-8", "-110"]
<uberjar>
will whatever is on the right hand side of ||= be evaluated if whatever's on the left hand side is truthy ?
donove has quit [Remote host closed the connection]
<wallerdev>
no
<uberjar>
k thnx
<wallerdev>
it will short circuit
<uberjar>
didn't think so, just wanted to be sure
<rbpd5015>
got rid of that rubygems line
sarkyniin has quit [Remote host closed the connection]
yfeldblu_ has quit [Remote host closed the connection]
<rbpd5015>
.
<rbpd5015>
I think I lost connection
<rbpd5015>
did you say anything havenwood
<havenwood>
rbpd5015: nope, i didn't follow what you're trying to do. what's the input and what's the expected output?
<rbpd5015>
I am trying to extract everything in order from a single game
<rbpd5015>
however when i get to bettting lines it comes in a group of 2
<rbpd5015>
away and home
<rbpd5015>
and I need it in a group of 4
<rbpd5015>
so i can save the line and the moneyline in a different column
<rbpd5015>
i am so close
<rbpd5015>
so frustrated
<wallerdev>
do you have much experience programming?
petertretyakov_ has quit [Quit: Be back later ...]
<wallerdev>
you could do something like have a counter, n = 0, then increment it each result, and when it hits 2 you can combine the last 2 results, then set it back to 0
<rbpd5015>
i have some basic experience
<rbpd5015>
were you able to run the code i just posted?
<rbpd5015>
ok look there thats the output I am getting
<rbpd5015>
that is 1 of 12 or 13 NBA games today
<rbpd5015>
lines 1-14 are perfect
<rbpd5015>
on line 15 is the book number which is correct
<rbpd5015>
line 16 is then puts out the away SPREAD and LINE on 1 line
<rbpd5015>
I want line 16 to be -8.5
<rbpd5015>
and line 17 to be -110
<rbpd5015>
line 18 to be 18 +8.5 andline 19 -110
<rbpd5015>
and so on and so on
<rbpd5015>
once i get that i will store everyputs into my DB
mshieldsdunn has joined #ruby-lang
roamingdog has quit [Remote host closed the connection]
shazaum has joined #ruby-lang
HappySlappy has left #ruby-lang ["Textual IRC Client: www.textualapp.com"]
roamingdog has joined #ruby-lang
<havenwood>
rbpd5015: It is easier to understand data than logic. I commented on your Gist with one of the game's :opener and :live_lines. Is this the part you're talking about? Given that input, what is the output you'd want?
roamingdog has quit [Ping timeout: 244 seconds]
<rbpd5015>
open was fine just the live lines
<havenwood>
so given that Array, what output are you wanting?
<havenwood>
Another Array? A Hash? What does it look like ideally?
<rbpd5015>
ok given an array I want it to be AwaySpread,AwayMoneyline,HomeSpread,HomeMoneyline
<rbpd5015>
ill comment ideally
roamingdog has joined #ruby-lang
Aova has quit [Read error: Connection reset by peer]
<havenwood>
rbpd5015: Is that supposed to represent lines of print?
<rbpd5015>
yes
<rbpd5015>
because I will store it in the DB as a betting line which is -8
<rbpd5015>
and then the moneyline of the betting line -110
<rbpd5015>
if I ask for the betting line I want to see -8
<rbpd5015>
If I ask for the betting line of the spread I want -110
<havenwood>
rbpd5015: So given the first Array, what would it look like as a new Array with each Array item representing a line of print? Show what that Array literal would look like.
<rbpd5015>
so write now we have what
<rbpd5015>
we have an array of the lines 1 for home 1 for away
<rbpd5015>
now I need the same thing but inside home i need an array with spread and moneyline
djbkd has quit [Remote host closed the connection]
<rbpd5015>
and away I need an array of spread and moneyline
chrisseaton has quit [Read error: Connection reset by peer]
Antivan has joined #ruby-lang
ritek has quit [Read error: Connection reset by peer]
bryancp has quit [Ping timeout: 265 seconds]
poikon has quit [Ping timeout: 245 seconds]
<weaksauce>
elaborate on the problem
AKASkip has quit [Ping timeout: 245 seconds]
adambeynon has quit [Ping timeout: 252 seconds]
<rbpd5015>
ok Ok what I wat is the following
<rbpd5015>
look at line 11
<rbpd5015>
where it says -7 -110
<rbpd5015>
I wants line 11 to say -7
<rbpd5015>
I want line 12 to say -110
<rbpd5015>
I want line 13 to say +7 and line 14 to say -110
<rbpd5015>
and i will be happy doesnt look to damm hard but been stuck 3 days on this
havenwood has joined #ruby-lang
<weaksauce>
that's a really long time
<rbpd5015>
havenwood your back man
<rbpd5015>
welcome back
<rbpd5015>
my luck is so bad i go online to railsmentors to hire a mentor and the site has errors so i can not complete my profile so i cant even hire someone to help me
<rbpd5015>
freaking crazy
<wallerdev>
lol
<weaksauce>
haha
<rbpd5015>
yeah it was funny the first two days
<rbpd5015>
not anymore i got to start storing this data
<weaksauce>
what version of ruby are you using?
<rbpd5015>
2.1
Aova has quit [Read error: Connection reset by peer]
ritek has joined #ruby-lang
avdi has joined #ruby-lang
rikkipitt has joined #ruby-lang
solars has quit [Ping timeout: 245 seconds]
bryancp has joined #ruby-lang
<weaksauce>
instead of begin rescue ... do a lines.scan do |x| puts x end
<weaksauce>
that will do it
cmisenas has quit [Ping timeout: 264 seconds]
<weaksauce>
but I suggest going through some ruby tutorials rbpd5015 because this shouldn't take 3 days.
ritek has joined #ruby-lang
ritek has quit [Changing host]
avdi has quit [Changing host]
avdi has joined #ruby-lang
bryancp has quit [Changing host]
bryancp has joined #ruby-lang
Aova has joined #ruby-lang
poikon has joined #ruby-lang
<weaksauce>
rbpd5015 do you follow the solution?
<rbpd5015>
yep and it worked
bb010g has joined #ruby-lang
tcopeland has joined #ruby-lang
twe4ked has quit [Ping timeout: 245 seconds]
<rbpd5015>
weaksauce 1 mor ething sorry
manveru has joined #ruby-lang
<weaksauce>
I guess I will take that as a thank you
<rbpd5015>
you see i got the same problem with openenr
<rbpd5015>
?
<rbpd5015>
opener
charliesome has quit [Quit: zzz]
<rbpd5015>
No I do not have that in a block already where would i add the scan part?
<weaksauce>
use this and see if you can't figure out how to coerce the data the way you want it on your own: puts "opener #{opener}"
<rbpd5015>
also in the other part you have puts x
<rbpd5015>
this prints all 4
<rbpd5015>
if I want to just print the 3rd object which would be the home line puts x[3] doesnt work as it only print the 3rd character?
<rbpd5015>
any ideas?
adambeynon has joined #ruby-lang
rikkipitt has quit [Quit: Leaving...]
chrisseaton has joined #ruby-lang
Lewix has quit [Remote host closed the connection]
SuMo_D has quit [Remote host closed the connection]
<rbpd5015>
weaksuace sorry i am a bit confused?
SuMo_D has joined #ruby-lang
mshieldsdunn has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<weaksauce>
you should copy the code that you have there and open up irb
<weaksauce>
paste it in and then play with it to see if you can't coerce the data how you want it
sonic_boom has joined #ruby-lang
<weaksauce>
but instead of games.each do game = games[1]
twe4ked has joined #ruby-lang
setanta has quit [Quit: Leaving]
<weaksauce>
what do you think opener is?
uberjar has quit [Quit: uberjar]
workmad3 has quit [Ping timeout: 245 seconds]
<rbpd5015>
canti make that entire process a method weaksauce and just call it?
SuMo_D has quit [Ping timeout: 252 seconds]
<weaksauce>
probably. try it out
ta_ has joined #ruby-lang
enebo has quit [Quit: enebo]
<rbpd5015>
ok damm want to make a few dollars let me know
dzejrou has quit [Quit: Leaving]
djbkd has quit [Remote host closed the connection]
charliesome has joined #ruby-lang
twe4ked has quit [Ping timeout: 245 seconds]
djbkd has joined #ruby-lang
<weaksauce>
how much?
<rbpd5015>
dude i dont know just need to finsh this parser up you tell me
<rbpd5015>
its 95% there
<weaksauce>
what are you looking to have finished?
<rbpd5015>
i just need this bit of ruby cleaned up so i can save it to a db in rails
<rbpd5015>
right now i am parsing lines, i need to add the overunders, which is a different namespace same structure
<rbpd5015>
then thats it.
<rbpd5015>
these little issues are killing me
twe4ked has joined #ruby-lang
<weaksauce>
where are the overunders?
ta_ has quit [Ping timeout: 252 seconds]
<rbpd5015>
if you add totals/
<rbpd5015>
to the url it works
<rbpd5015>
and they are there
<rbpd5015>
i just do not need to duplicate the first 14 lines