apeiros_ changed the topic of #ruby to: programming language || ruby-lang.org || Paste >3 lines of text in http://pastie.org || Rails is in #rubyonrails
sbanwart has joined #ruby
replore_ has joined #ruby
maccosmo has quit [Ping timeout: 260 seconds]
maccosmo_ is now known as maccosmo
Sheehan has quit [Quit: Sheehan]
joch_n_ has joined #ruby
baroquebobcat has quit [Quit: baroquebobcat]
c0rn has quit [Quit: Computer has gone to sleep.]
freeayu has joined #ruby
digitalcakestudi has quit [Quit: Leaving.]
shtirlic_ has joined #ruby
shtirlic has quit [Ping timeout: 260 seconds]
joch_n has quit [Ping timeout: 252 seconds]
rmascarenhas has joined #ruby
chico_chicote has joined #ruby
Progster has joined #ruby
bfig has joined #ruby
replore_ has quit [Remote host closed the connection]
stephenjudkins has quit [Quit: stephenjudkins]
iocor has quit [Quit: Computer has gone to sleep.]
eywu has joined #ruby
eywu has quit [Client Quit]
iamjarvo has quit [Quit: Leaving.]
ZachBeta has joined #ruby
fukushim_ has joined #ruby
fukushima has quit [Ping timeout: 265 seconds]
siksia has quit [Read error: Connection reset by peer]
Tomasso has joined #ruby
siksia has joined #ruby
eywu has joined #ruby
eywu has quit [Client Quit]
albemuth has quit [Quit: Computer has gone to sleep.]
kenperkins has quit [Ping timeout: 245 seconds]
eywu has joined #ruby
eywu has quit [Client Quit]
counterbeing has joined #ruby
eywu has joined #ruby
eywu has quit [Client Quit]
elake has joined #ruby
elake has quit [Client Quit]
banisterfiend has quit [Remote host closed the connection]
davidpk has quit [Quit: Computer has gone to sleep.]
Clordio has joined #ruby
cbuxton has quit [Read error: Connection reset by peer]
piglittlepuffpuf has quit [Read error: Connection reset by peer]
cbuxton has joined #ruby
Clordio has quit [Client Quit]
punkrawkR has quit [Read error: Connection reset by peer]
eywu has joined #ruby
eywu has quit [Client Quit]
Clordio has joined #ruby
Clordio has quit [Client Quit]
taterbas_ has joined #ruby
taterbas_ has left #ruby [#ruby]
mikeycgto has joined #ruby
rvmeier has joined #ruby
adamkittelson has quit [Remote host closed the connection]
trend has joined #ruby
kenperkins has joined #ruby
nai has joined #ruby
graspee has quit [Quit: night night]
akem has joined #ruby
akem has quit [Read error: Connection reset by peer]
test34 has joined #ruby
test34 has quit [Changing host]
test34 has joined #ruby
balki_ is now known as balki
chson has joined #ruby
kenichi has quit [Remote host closed the connection]
alexim has quit [Quit: sleep]
carlyle has joined #ruby
test34- has quit [Ping timeout: 265 seconds]
kah_ has quit [Quit: Leaving]
mikeg has quit [Quit: Leaving]
ringotwo has quit [Remote host closed the connection]
jenrzzz-mac has quit [Quit: jenrzzz-mac]
akem has joined #ruby
L-----D has joined #ruby
akem has quit [Read error: Connection reset by peer]
savage-_ has quit [Ping timeout: 245 seconds]
c0rn has joined #ruby
berserkr has quit [Quit: Leaving.]
qwerxy has joined #ruby
carlyle has quit [Remote host closed the connection]
iamjarvo has joined #ruby
nai has quit [Remote host closed the connection]
adeponte has quit [Remote host closed the connection]
adeponte has joined #ruby
true_techie has quit [Quit: ChatZilla 0.9.88.2 [Firefox 13.0/20120531155942]]
axl_ has quit [Quit: axl_]
alexim has joined #ruby
shevy has quit [Ping timeout: 244 seconds]
seanstickle has joined #ruby
adeponte has quit [Ping timeout: 250 seconds]
trend has quit [Read error: No route to host]
trend has joined #ruby
ericcoleman has joined #ruby
cbuxton1 has joined #ruby
cbuxton1 has quit [Client Quit]
fumduq has quit [Ping timeout: 244 seconds]
joshman_ has quit [Quit: Computer has gone to sleep.]
KazW has quit [Ping timeout: 248 seconds]
Ripp___ has joined #ruby
cbuxton has quit [Ping timeout: 260 seconds]
CannedCorn has quit [Ping timeout: 244 seconds]
Ripp__ has quit [Ping timeout: 244 seconds]
davidpk has joined #ruby
nisstyre has quit [Quit: Leaving]
iori has joined #ruby
zizzyx has quit [Quit: Lost terminal]
uris has joined #ruby
theRoUS has joined #ruby
theRoUS has quit [Changing host]
theRoUS has joined #ruby
shevy2 has joined #ruby
nfluxx_ has joined #ruby
benatwork has joined #ruby
dtang has joined #ruby
KazW has joined #ruby
Gavilan has joined #ruby
ianbishop has quit []
nfluxx has quit [Ping timeout: 244 seconds]
dnyy has quit [Remote host closed the connection]
nfluxx_ has quit [Ping timeout: 244 seconds]
iori has quit [Remote host closed the connection]
Hanmac1 has joined #ruby
iori has joined #ruby
Hanmac has quit [Ping timeout: 252 seconds]
axl_ has joined #ruby
akem has joined #ruby
akem has quit [Changing host]
akem has joined #ruby
myndzi has quit [Ping timeout: 244 seconds]
bricker88 has quit [Quit: Leaving.]
siksia has quit [Ping timeout: 244 seconds]
bricker88 has joined #ruby
iori has quit [Ping timeout: 265 seconds]
shtirlic_ has joined #ruby
andrewhl has joined #ruby
savage- has joined #ruby
emmanuelux has quit [Read error: No route to host]
artOfWar_ has quit [Remote host closed the connection]
itnomad has quit [Quit: Leaving]
shtirlic has quit [Ping timeout: 260 seconds]
emmanuelux has joined #ruby
Sgeo has quit [Read error: Connection reset by peer]
Sgeo has joined #ruby
meescha has joined #ruby
yannis has joined #ruby
fearoffish has quit [Quit: Computer has gone to sleep.]
meescha has left #ruby [#ruby]
true_techie has joined #ruby
meescha has joined #ruby
<true_techie>
:method => :delete is the same as hash = {:method => :delete} ?
siksia has joined #ruby
<jedmtnman>
true_techie: in the rails context?
<true_techie>
jedmtnman, yes
<jedmtnman>
I guess if it depends how you use instance var `hash`
savage- has quit [Remote host closed the connection]
<jedmtnman>
probably this is not the same in the rails context
yannis has quit [Quit: Bye!]
darkf_ has joined #ruby
stkowski_ has joined #ruby
x0F has quit [Disconnected by services]
x0F_ has joined #ruby
x0F_ is now known as x0F
simao has joined #ruby
stkowski_ has quit [Client Quit]
darkf has quit [Ping timeout: 260 seconds]
noodletraveler has joined #ruby
simao has quit [Ping timeout: 265 seconds]
dbgster has quit [Quit: dbgster]
darkf_ is now known as darkf
noodletraveler has quit [Ping timeout: 260 seconds]
apok has quit [Ping timeout: 248 seconds]
noodletraveler has joined #ruby
sbanwart has quit [Ping timeout: 248 seconds]
peregrine81 has quit [Quit: Computer sleeping.]
stephenjudkins has joined #ruby
zizzyx has joined #ruby
RangerMauve has joined #ruby
<zizzyx>
what type of db column is generally used if i want to store video in my model?
Karmaon has quit [Ping timeout: 276 seconds]
<zizzyx>
for rails
<RangerMauve>
Hey, is there a way to make some code run when a ruby program exits?
noodletraveler has quit [Ping timeout: 244 seconds]
<stephenjudkins>
RangerMauve: atexit
<stephenjudkins>
but what you actually want to do is just run code before your program quits.
peregrine81 has joined #ruby
<stephenjudkins>
if you're having random parts of code calling "exit" you have a bigger problem.
<RangerMauve>
Well, basically I have a simple sinatra app running and I jsut want to save something when it stops
noodletraveler has joined #ruby
<stephenjudkins>
what stops the app?
<RangerMauve>
Pressing ctrl+c on my console
<stephenjudkins>
do you plan to ever deploy this application anywhere?
<RangerMauve>
Nope
<RangerMauve>
This is just to help me learn some ajax
<stephenjudkins>
so, you have an in-memory data structure. you want to persist it. am I correct?
<RangerMauve>
I've made a little chat program and I want to save the current messages to a yaml file when I stop the program. So I can reload them on startup
<RangerMauve>
Yes
<stephenjudkins>
if so, you should just persist it every time a request is made that alters it.
<RangerMauve>
Bleh, I was hoping to avoid something like that. =\
peregrine81 has quit [Client Quit]
Karmaon has joined #ruby
<RangerMauve>
But if that's the only not convoluted way then I guess I can suck it up
digitalcakestudi has joined #ruby
Karmaon has quit [Excess Flood]
chico_chicote has quit [Remote host closed the connection]
davidpk has quit [Quit: Computer has gone to sleep.]
akem has quit [Ping timeout: 252 seconds]
<jrajav>
eph3meral: Well, #count is an O(N) operation
<jrajav>
eph3meral: I don't know if it's the BEST way to do it but a better way would be to replace that whole unless block with occurrences[name] = occurrences[name] ? occurrences[name] + 1 : 1
<jedmtnman>
eph3meral: the entities.uniq.map{} is the important part. the rest is just forcing it into the hash syntax you want
Mission-Critical is now known as MissionCritical
<jrajav>
That method still runs count on every unique element
ipoval has joined #ruby
<jrajav>
Making a simple O(N) operation into O(N^2)
RudyValencia has quit [Quit: My IRC client doesn't advertise in /quit messages.]
<jedmtnman>
jrajav: that doesn't make it less functional...
<jrajav>
Well, true
ben_alman has joined #ruby
ipoval has left #ruby [#ruby]
apok has joined #ruby
<jrajav>
As long as you know performance won't matter (it usually doesn't), then yes I agree you should go with whatever works best
apok has quit [Client Quit]
<Azure>
When grabbing data from an API and outputting it to like say, a terminal or IRC channel, how should I go about dealing with possible choices between available formats from the API, etc.?
paf0 has quit [Quit: paf0]
<Azure>
E.G., Celsius and Fahrenheit, mph and kph, etc.
<jedmtnman>
jrajav: it would be nice to know at a glance from documentation, how performant it is. like an O rating.
<jrajav>
Yeah that would be nice
Bosma has quit [Read error: Operation timed out]
Ripp__ has joined #ruby
<jrajav>
They actually do that in Java documentation
Ripp___ has quit [Ping timeout: 244 seconds]
<jedmtnman>
jrajav: did you just happen to know it was O(N)?
<jrajav>
It's clear from what it does
<Azure>
Just do it inline? Have structs/procs/methods for processing?
<Boohbah>
Azure: in a terminal, i would check the locale environment variables
<jrajav>
It usually is
<Azure>
I see. In my case, it is to an irc channel (an irc bot using the Cinch framework.)
iori has joined #ruby
<jrajav>
jedmtnman: #count(item) counts the number of items in the enumerable that are equal to item
uris has quit [Quit: leaving]
<jedmtnman>
jrajav: I'm not very proficient in algo design, but wouldn't it matter how the count method is written, or is it something about counting that is O(N)?
<jrajav>
jedmtnman: That must necessarily run enum[i] == item for each i
<jedmtnman>
jrajav: ah, i see
<bnagy>
only if there's a block
akem has joined #ruby
b3gott3n has joined #ruby
<jrajav>
O() notation sounds complicated but it's pretty intuitive once you know how it works
<eph3meral>
jedmtnman, ok cool, so I've used Hash[] before, in fact I'm using it a few lines earlier already in a different chunk of code, but what does * do again? I've read about it before, but even after that it was still kind of hazy
<eph3meral>
jedmtnman, seems like * kind of does a lot
<eph3meral>
actually I've also tried it out before
<eph3meral>
in irb... I did a Hash[] and Hash[*...] on the same data set
<eph3meral>
just to see the diff
<eph3meral>
but I still don't quite understand the technical detail of exactly what * to cause that
<eph3meral>
jedmtnman, ^
<jedmtnman>
eph3meral: it turns it into a splat arg
akem has quit [Max SendQ exceeded]
<eph3meral>
right, splats
Xyphy has quit [Remote host closed the connection]
<jedmtnman>
eph3meral: just a sec
<eph3meral>
i've read about splats, still don't understand them :)
<eph3meral>
i feel like there's a more "official" doc in there as well
cha1tanya has quit [Ping timeout: 252 seconds]
<monokrome>
Does the do statement not create a function? I am trying to return from inside a do/end block but it seems to just return my whole function or something
emmanuelux has quit [Remote host closed the connection]
cha1tanya has joined #ruby
akem has quit [Max SendQ exceeded]
<jedmtnman>
eph3meral: try running that code without the *
akem has joined #ruby
<jedmtnman>
empty, right?
<bnagy>
entities.each.with_object(Hash.new {|k,v| k[v]=0}) {|e,h| h[e]+=1} is how I would write it btw
luke3321 has quit [Quit: LIKE A BOSS]
hakunin has quit [Remote host closed the connection]
<bnagy>
you could also do this with group_by and map
<bnagy>
which might be easier to read
<EstanislaoStanis>
Hello, everyone. ^-^.
parzo has joined #ruby
<jedmtnman>
bnagy: good call
<bnagy>
then again maybe not...
<eph3meral>
bnagy, cool I'll look in to those next
<eph3meral>
bnagy, can you explain a little more detail exactly what the block that you provide to Hash.new is doing?
<bnagy>
eph3meral: but matches.group_by {|match| match,first,downcase} is noce
<bnagy>
nice
<eph3meral>
is that a block that's used for later initialization any time a nil member is accessed?
<bnagy>
but your values will be the whole match
ryanf has joined #ruby
<bnagy>
yes
<eph3meral>
ok cool, didn't know you could do that on a Hash, good to know thx
<bnagy>
it's a very handy trick for things like hashes of object counts etc
<eph3meral>
yeah, actually just knowing that
<eph3meral>
how to use each_with_object
<eph3meral>
has become immensely more clear now
<bnagy>
also, note the big diff to Hash.new([])
simao has joined #ruby
<eph3meral>
ok, what is the big diff, I mean I wouldn't have assumed they were the same
<eph3meral>
but, what does [] initialize?
<bnagy>
read the docs :D
<eph3meral>
k
<EstanislaoStanis>
Anyone have time to answer a couple of my noob questions?
<jedmtnman>
EstanislaoStanis: just ask
<jedmtnman>
if no one answers, ask again
tomb_ has quit [Quit: Computer has gone to sleep.]
<bnagy>
preferably after a pause
<EstanislaoStanis>
Ok, thanks. First, is the channel #ruby-lang supposed to be set to where people can't talk unless they're given a voice? Because when I tried to it said "Cannot send to channel".
<bnagy>
you just need to be registered
L-----D has quit [Quit: Leaving]
<EstanislaoStanis>
I suspected as much, but I read around and it didn't seem to tell me how...
simao has quit [Ping timeout: 265 seconds]
siksia has quit [Ping timeout: 240 seconds]
mneorr has joined #ruby
<bnagy>
try /msg NickServ help register
<bnagy>
or something, I can't remember :)
<EstanislaoStanis>
And that's just for that channel?
<bnagy>
no it's for all of freenode
<EstanislaoStanis>
Oh, ok.
bwlang has quit [Quit: bwlang]
krusty_ar_ has quit [Ping timeout: 245 seconds]
davidpk has joined #ruby
polysics has joined #ruby
ghanima has joined #ruby
ghanima has quit [Remote host closed the connection]
tomb_ has joined #ruby
<EstanislaoStanis>
Ok, and is there any major difference between this channel and #ruby-lang?
siksia has joined #ruby
dwon has joined #ruby
jenrzzz-mac has joined #ruby
tomb_ has quit [Client Quit]
jedmtnman has quit [Quit: Leaving.]
<bnagy>
the answer to that question is political, subjective and controversial
digitalcakestudi has quit [Ping timeout: 245 seconds]
Gekz has joined #ruby
polysics has quit [Remote host closed the connection]
Gekz has quit [Changing host]
Gekz has joined #ruby
<EstanislaoStanis>
Somehow I thought that might be the answer. Got a very simple explanation?
mengu has joined #ruby
<bnagy>
ruby-lang is 'official' because it's on the website <-- political
<bnagy>
they should probably be merged <-- controversial
<bnagy>
this channel is better for n00bish questions, and has more noobs in general <-- subjective
jenrzzz-mac has quit [Client Quit]
<EstanislaoStanis>
Thanks!
td123 has quit [Read error: Connection reset by peer]
<EstanislaoStanis>
Now I have some very noobish code that I'd like someone to look at if they have any time. It's very short, and I just want to know why I get a certain error when I try to run it.
<bnagy>
so the bugs I can see so far are that you forgot to chomp your input, and then you're calling Array#select on a String, which won't work
williamcotton has quit [Quit: williamcotton]
PragCypher has quit [Client Quit]
<eph3meral>
how can I write something on multiple lines? like my_array.uniq.flatten.each.with_object so that each thing that begins with a . is on its own line?
williamcotton has joined #ruby
<eph3meral>
i'm getting some syntax errors (not super surprisingly
gureg has joined #ruby
<bnagy>
eph3meral: you'd need to use intermediate variables
<eph3meral>
ahh, hmm, well it seems it works fine if the object operator . is at the end of each line
<EstanislaoStanis>
Ok, those two things I'm not sure about. I think I know what chomp means. I know it's a method, right?
<bnagy>
eph3meral: also, .uniq.flatten is a weird construction
<eph3meral>
just can't be at the beginning, I guess that makes basic sense
<eph3meral>
bnagy, yep, it was an out-of-my-arse example
<eph3meral>
i didn't care to actually do much thinking
<eph3meral>
so, the weirder the better
<bnagy>
EstanislaoStanis: chomp will get rid of the "\n" that comes with the gets
rippa has joined #ruby
baroquebobcat has quit [Quit: baroquebobcat]
<EstanislaoStanis>
Is that \n a new line command?
<bnagy>
newline character, yeah. When you go gets you'll get a string that has one at the end
<bnagy>
*do
Proggy has quit [Ping timeout: 252 seconds]
<bnagy>
EstanislaoStanis: personally, I wouldn't bother checking anything, or defining game_commands etc etc
<bnagy>
just do command=gets.chomp;case command;when 'sleep';... when ... when ... else; puts "Bad command"
kenperkins has quit [Quit: Computer has gone to sleep.]
<bnagy>
if you get a lot of commands there are other ways of handling them, but we'll leave that for now
<EstanislaoStanis>
bnagy: To your second idea about the error, isn't this a case of select using an array? http://pastie.org/4035769
<bnagy>
yes, but it's a bad example
ZachBeta has quit [Read error: Connection reset by peer]
<bnagy>
use reject, not select with a negative condition
<EstanislaoStanis>
Lol, that from my book: Beginning Ruby by Peter Cooper.
<bnagy>
really? textB as well?
test34 has joined #ruby
test34 has quit [Changing host]
test34 has joined #ruby
<EstanislaoStanis>
It was originally just text.
<bnagy>
ok, cause we use snake_case for variables as well
test34- has joined #ruby
test34- has quit [Changing host]
test34- has joined #ruby
<bnagy>
brb
CheeToS has quit [Ping timeout: 244 seconds]
<EstanislaoStanis>
Ok.
huwenfeng1 has joined #ruby
ryanf_ has joined #ruby
huwenfeng1 has quit [Client Quit]
ryanf has quit [Quit: leaving]
ryanf_ is now known as ryanf
mneorr has quit [Ping timeout: 248 seconds]
huwenfeng has quit [Ping timeout: 245 seconds]
mneorr has joined #ruby
test34 has quit [Ping timeout: 245 seconds]
<kenneth>
so i have a rack http app which works great. i'd like to start using socket.io (or equivalent) for real-time communication between my server and html/websocket-supporting client
luxurymode has joined #ruby
cj3kim has joined #ruby
hemanth has joined #ruby
jrajav has quit [Quit: burgermouth]
<kenneth>
first question: a rack app is (as far as i understand it) a permanent process. so it could make sense to just launch a new thread to handle the real-time communication, right? it's not going to get killed or anything…
gureg has left #ruby [#ruby]
Sheehan has joined #ruby
mneorr has quit [Ping timeout: 244 seconds]
dwon has quit [Quit: Leaving]
jfarmer has quit [Quit: jfarmer]
<EstanislaoStanis>
I wish I could help kenneth. Maybe when bnagy gets back he'll be able to. He said brb a few minutes ago.
<bnagy>
hm? Oh I'm back, I just know nothing about web stuff
<bnagy>
I would imagine there's a better way to do websockets that that, though
<kenneth>
welcome back bnagy. tying to figure out how to integrate real-time streaming of data into my app
<kenneth>
i'd love it if i could just get zeromq to work over websockets
lkba has quit [Read error: Connection reset by peer]
lkba has joined #ruby
yannis has joined #ruby
<bnagy>
maybe try one of the webby channels
<bnagy>
or wait for europe to come online :)
corburn has quit [Quit: Leaving]
<bnagy>
imho though I would make your streamy thing a different process, not a thread
<kenneth>
maybe that's actually a better idea, come to think of it
* hemanth
needs some feedback on Ninja Object Properties in Scripting languages -> http://is.gd/BDnJ65
<EstanislaoStanis>
bnagy: I looked up snake_case, and its a formatting, right? I'll try to remember to use that for my method defs. I was using some formatting thing I learned from my dabbling in ActionScript 3.0. Thanks for your help so far!
mneorr has joined #ruby
<bnagy>
hemanth: I will never in my life click on a url shortened link in irc
adeponte has quit [Remote host closed the connection]
<acyed>
I want to turn this (http://pastebin.com/wKLgd9pS) into a web app... but I don't have the slightest clue on how to get started.
<bnagy>
hemanth: what you want to look for are strings that are different to the interpreter but appear identical to the user
<bnagy>
hemanth: so see if some of the weird zero-length space chars etc work
<bnagy>
otherwise you're not obfuscating anything at all
<hemanth>
roger that
Sgeo_ has quit [Ping timeout: 248 seconds]
<bnagy>
there are also some glyphs that look a great deal like 'normal' ascii characters, depending on font
* hemanth
notes down 'strings that are different to the interpreter but appear identical to the user'
<bnagy>
leaving aside the question of the value of obfuscating ruby, versus JS where your code is exposed
TheHunter_1039 has quit [Quit: TheHunter_1039]
Johnny7656 has joined #ruby
<acyed>
I wrote it thinking it would be easy to put into a ruby on rails app on Heroku, but then I remembered that 1. I've never written a rails app 2. that was a foolish thought
abionic has quit [Ping timeout: 260 seconds]
<bnagy>
acyed: maybe try one of the rails channels, eg #rubyonrails
<hemanth>
bnagy, JS needs that...true
<acyed>
ah, ok
kenneth has quit [Quit: kenneth]
lkba has quit [Ping timeout: 260 seconds]
cirwim has joined #ruby
replore_ has joined #ruby
<EstanislaoStanis>
bnagy: If you have time could you try to explain to me why the book code works when using an .select on an array but mine returns "private method 'select' called for "..":String"?
geekfactor has quit [Remote host closed the connection]
<bnagy>
EstanislaoStanis: your code is not calling it on an array
<EstanislaoStanis>
How do you mean?
geekfactor has joined #ruby
<bnagy>
the object that is receiving the select method in your case is not an array
<bnagy>
it's a string
<bnagy>
strings are not arrays
<EstanislaoStanis>
And the object that is receiving the select method is input?
<bnagy>
yes
b1rkh0ff has quit [Ping timeout: 260 seconds]
GeekOnCoffee has quit [Ping timeout: 250 seconds]
fantazo has joined #ruby
<Johnny7656>
For permuting a string, would the best way to do it be convert to an array, permute, and then convert the results to a String?
<bnagy>
I think that's the only way, Johnny7656
minijupe has joined #ruby
<Johnny7656>
Well, you could write your own ruby code, but I'm assuming that would be slower
<bnagy>
unless by permute you mean reverse
alanp_ has quit [Remote host closed the connection]
balki has quit [Remote host closed the connection]
minijupe has quit [Client Quit]
<bnagy>
which is one possible permutation :P
<Johnny7656>
:D Nope, all the permutations. It just seems that join is eating up a lot of CPU
<bnagy>
oh, actually... you can do quite a lot with tr as well
<Johnny7656>
I still have to figure out what all those columns mean ha ha
<EstanislaoStanis>
bnagy: !!!, thanks! Now I at least understand why my code wasn't working and how to make the old stuff work! I think your suggestion was probably better. I originally wanted to store my commands in an array because I thought it would make adding them easier, but I see now that I'd have to add the if, when, when, anyways. Thank you so much.
<Johnny7768>
Right now, it's a naive way of search for all the possible words in say a scrabble hand
mneorr has quit [Ping timeout: 244 seconds]
cha1tanya has joined #ruby
<Johnny7768>
That's added to the string class by the way, where the string is all the letters in a scrabble hand
<bnagy>
ugh, you're doing all permutations on n!
<Johnny7768>
Yeah, it's not the fastest way for sure :D
jcromartie has quit [Read error: Connection reset by peer]
jcromartie has joined #ruby
<Johnny7768>
I had thought using a sortedset for WORDS instead of a regular set would help a lot, but it barely sped things up
trend has quit [Disconnected by services]
<eph3meral>
is there a way to merge an array of hashes in to a single hash? ala translating [my_hash, some_other_hash, yet_another_hash]; into something like my_hash.merge(some_other_hash).merge(yet_another_hash);
<cirwim>
Johnny7768: I found that algorithm was fast-enough up to about 7 letters
jcromartie has quit [Read error: Connection reset by peer]
<cirwim>
after that you want proper storage of your dictionary
<bnagy>
Johnny7768: no your WORDS lookup is constant time
<cirwim>
there are some really cool algorithms out there for scrabble
adamramadhan has joined #ruby
<bnagy>
it's n! * n! that's killing you
<Johnny7768>
Now why is words lookup constant time?
mneorr has joined #ruby
<bnagy>
cause it's a Set or Hash, right?
<Johnny7768>
True, but why does it work that way I meant
<bnagy>
cause that's how hash tables work
<bnagy>
calculate hash of key, get value at corresponding memory address
amacgregor has quit [Ping timeout: 244 seconds]
ConstantineXVI has quit [Read error: Connection reset by peer]
keyvan is now known as kiin
<cirwim>
eph3meral: you want .inject(&:merge) or something horrible like that
becom33 has joined #ruby
cha1tanya has quit [Ping timeout: 252 seconds]
ConstantineXVI has joined #ruby
<eph3meral>
cirwim, hahah, why is that horrible
<eph3meral>
and is there any non-horrible option?
cha1tanya has joined #ruby
cha1tanya has quit [Changing host]
cha1tanya has joined #ruby
nipra has joined #ruby
<cirwim>
it's not that horrible, though "inject" is a very complex beast
joshman_ has quit [Quit: Computer has gone to sleep.]
<cirwim>
I think the alternatives would probably be just as bad hashes.each_with_object({}) do |h, item| h.update(item); end
<cirwim>
that way you avoid some intermediary hash creation
<Johnny7768>
Alright sure, hash tables are coming back to me ha ha
<bnagy>
Johnny7768: as a quick idea, what if you reverse your permutations (start with permutation(n.size)) and then break at the first match? Least that will ghive you a maximal length word
<bnagy>
not the best score though
<bnagy>
I think you'd be better off reversing your search though
<Johnny7768>
Yeah, I'll probably have to do it some other way
akem has joined #ruby
<EstanislaoStanis>
Quick question, is there a difference between the when and if flow controls?
<bnagy>
enumerate words and see if the word can be made with those tiles
<Johnny7768>
Like if no words start with 'xx'
<cirwim>
Johnny7768: look up DAWG and GADDAG
<Johnny7768>
Don't do all the permutations with that at the beginning
<cirwim>
they are lightening-fast storage solutions for permutation problems
<Johnny7768>
DAWG, the old TI app?
<bnagy>
if you have a Trie I think this will be fast
<heftig>
maybe iterate your list of words and check if each is a possible permutation of your hand
<cirwim>
Johnny7768: no, directed acyclic word graphs
<bnagy>
cause you can abort all branches where you can't proceed with that tileset
<bnagy>
heftig: ha great minds think alike
<heftig>
cirwim: making a graph of all words?
<cirwim>
heftig: aye
<Johnny7768>
cirwim: It actually was a dictionary app type thing - probably got its name from there
<heftig>
as in f->o->o->b->a->r
<cirwim>
heftig: well, you can be arbitrarily clever
<eddie_>
i have been staring at unicode chart for sometime
<eddie_>
:)
<cirwim>
heh
alanp has joined #ruby
balki has joined #ruby
andrewhl has quit [Remote host closed the connection]
<vectorshelve>
hemanth: nice will tweet it :)
<hemanth>
vectorshelve, :)
<vectorshelve>
hemanth: typo -> instead of "As a responsible app, it's a neat if it does so?" it should be "As a responsible app, isn't it neat if it does so ?"
Morkel has joined #ruby
gtuckerkellogg has quit [Quit: Computer has gone to sleep.]
<eph3meral>
how should I go about translating two arrays such as
<eph3meral>
a = {foo_item:{loc:{ny:3,ca:5},org:{fd:8,pd:6}}}; b = {bar_item:{loc:{ny:9,az:7},org:{fd:2,emt:2}}}
<kenneth>
to run an event machine in parallel with a rack app
cha1tanya has quit [Ping timeout: 250 seconds]
<cirwim>
do you really really not want to use thin?
<cirwim>
because that will give you a managed event loop more easily
<cirwim>
and then you can do whatever you like
mrdtt has joined #ruby
daniel_hinojosa has quit [Ping timeout: 252 seconds]
nirakara has joined #ruby
<kenneth>
cirwim: i want this to work with any rack-compatible web server
<kenneth>
thin, apache w/ passenger, etc.
<cirwim>
ok
ph^ has joined #ruby
mikepack has quit [Read error: Connection reset by peer]
mikepack has joined #ruby
locriani has joined #ruby
Helius has joined #ruby
jrallison has quit [Quit: Computer has gone to sleep.]
mneorr has joined #ruby
dekroning has joined #ruby
ank_ has joined #ruby
Ripp__ has quit [Read error: Operation timed out]
sleetdrop has joined #ruby
nirakara has quit [Ping timeout: 244 seconds]
ank has quit [Ping timeout: 245 seconds]
ank_ is now known as ank
locriani has quit [Ping timeout: 260 seconds]
nikhil_ has joined #ruby
nikhil_ has quit [Max SendQ exceeded]
nikhil_ has joined #ruby
Ripp__ has joined #ruby
hoelzro|away is now known as hoelzro
heftig has quit [Quit: leaving]
darkf has quit [Quit: Leaving]
a_a_g has joined #ruby
Helius has quit [Remote host closed the connection]
Helius has joined #ruby
mengu has quit [Read error: Connection reset by peer]
luckyruby has quit [Remote host closed the connection]
ZachBeta has quit [Quit: Computer has gone to sleep.]
bosphorus has joined #ruby
sparrovv has joined #ruby
maccosmo has joined #ruby
savage- has quit [Remote host closed the connection]
pabloh has joined #ruby
ij has left #ruby ["WeeChat 0.3.7"]
cj3kim has quit [Quit: This computer has gone to sleep]
CheeToS has quit [Ping timeout: 244 seconds]
schovi has joined #ruby
eggie5 has quit [Quit: eggie5]
Eldariof-ru has joined #ruby
mikepack has quit [Read error: No route to host]
nikhil_ has quit [Quit: This computer has gone to sleep]
lopin has quit [Ping timeout: 245 seconds]
apeiros_ has joined #ruby
pu22l3r_ has joined #ruby
<tommylommykins>
hmm
* tommylommykins
notes pathname#relative and absolute don't work on windows
<tommylommykins>
which makes much of pathname broken on windows
<tommylommykins>
Is there a canonical solution to this problem?
noodletraveler has quit [Read error: Connection reset by peer]
simao has joined #ruby
<tommylommykins>
hmm, actually not erlative, but realpath is broken
pu22l3r has quit [Ping timeout: 244 seconds]
d3c has quit [Quit: Quit]
<Hanmac>
tommylommykins: can you pastie your line? ... i heard that ruby uses / on windows too
looopy has joined #ruby
savage- has joined #ruby
qwerxy has quit [Quit: offski]
simao has quit [Ping timeout: 265 seconds]
pabloh has quit [Quit: Ex-Chat]
milestone has joined #ruby
BiHi has joined #ruby
kenneth has quit [Quit: kswizz.com]
nfluxx has quit [Quit: nfluxx]
<milestone>
hi all i installed ruby 1.9.3 from source on rhel 6 now i want to do gem install charlock_holmes i keep getting icu required although i installed libicu
blacktulip has joined #ruby
mdw has joined #ruby
jimeh2 has joined #ruby
a_a_g has quit [Quit: Leaving.]
a_a_g has joined #ruby
ryanf has quit [Quit: leaving]
tvw has joined #ruby
<milestone>
what am i doing wrong?
<hoelzro>
milestone: did you install libicu-devel or whatever it's calle?
<hoelzro>
*called
<hoelzro>
you need headers to build source
<milestone>
hoelzro: i did a yum search icu and only found libicu
<milestone>
libicu.x86_64 : International Components for Unicode - libraries
jimeh2 has quit [Client Quit]
<hoelzro>
and there's no other packages listed?
simao has joined #ruby
<hoelzro>
try searching for libicu-devel
<milestone>
no let me check within stellite <-- hoelzro
<milestone>
hoelzro: ok found it in another channel
<milestone>
hoelzro: adding it to the system
parzo has quit [Quit: Leaving.]
fserb has joined #ruby
jimeh has joined #ruby
QaDeS has joined #ruby
parzo has joined #ruby
IrishGringo has quit [Quit: ChatZilla 0.9.88.2 [Firefox 12.0/20120420145725]]
thecreators has quit [Quit: thecreators]
ephemerian has joined #ruby
Konboi has joined #ruby
mdw has quit [Remote host closed the connection]
savage- has quit [Remote host closed the connection]
timbuchwaldt has joined #ruby
maccosmo has quit [Quit: maccosmo]
cantonic_ has joined #ruby
mdw has joined #ruby
timonv has joined #ruby
cantonic has quit [Read error: Operation timed out]
sleetdrop has quit [Remote host closed the connection]
twinturbo has quit [Read error: Operation timed out]
<shevy>
hmm that case menu has 1400 lines
* Hanmac
has enough time to read it :P
Drewch_ has quit [Ping timeout: 245 seconds]
<Hanmac>
PS: i am only intestested in the case / when heads
<Hanmac>
what do you use for when clauses?
<shevy>
hmm perhaps I would need a class that scans through
<shevy>
and outputs the duplicates
Drewch has joined #ruby
flype has quit [Quit: Computer has gone to sleep.]
<shevy>
the thing I am wondering is, if I would write such a class
<shevy>
the when clauses are like this:
<shevy>
.
<shevy>
when 'colour_wheel','colourwheel','std_colours','stdcolours',
<shevy>
'col'
arvidkahl has joined #ruby
<shevy>
so they flow to the next line. now I am not sure how to easily find out when they stop
remmy444 has quit [Remote host closed the connection]
darthdeus has joined #ruby
flype has joined #ruby
keanehsiao has quit [Quit: keanehsiao]
<matled>
shevy: you could remove parts of the case in a binary search fashion until you find the problem
geekbri has joined #ruby
tomask has joined #ruby
tomask has quit [Changing host]
tomask has joined #ruby
mdw has joined #ruby
pl_ab has joined #ruby
nanderoo has joined #ruby
<AxonetBE>
how can I do in ruby 1.9.2 string to array?
<AxonetBE>
seems that "test".to_a is not working anymore
mneorr has joined #ruby
<shevy>
AxonetBE one way you could use .split like .split("\n")
<Hanmac>
AxonetBE: "string".split or "string".chars or "string".each_char ... (for chars) ... the different between the first and the others is that the others does not make an array if you dont need to store them
<matled>
.lines seems to do the same as .to_a, but I never used .to_a
<zizzyx>
what's currently considered the best option for javascript runtime in rails environment?
<Hanmac>
AxonetBE: you could be also interested in each_line, each_byte, and each_codepoint
<zizzyx>
heroku is warning against rubyracer but i thought the runtime was mostly for testing and etc
<AxonetBE>
The facts is that I have sometimes 1 brand and sometimes multiple brands, so I do in my view params[:brand].to_a.join(" / "), because when I have 1 brand, the join is not working because it is a string, so I have to convert the string to an array
<Hanmac>
shevy lines and each_line are the same, but i prefer the each_* methods to show what i want the enum stuff
<shevy>
aha
burgestrand has quit [Quit: Leaving.]
bluenemo has joined #ruby
bluenemo has quit [Changing host]
bluenemo has joined #ruby
ananthakumaran has quit [Quit: Leaving.]
mneorr has quit [Ping timeout: 240 seconds]
etehtsea has joined #ruby
medik has joined #ruby
[Neurotic] has quit [Quit: Leaving]
mneorr has joined #ruby
eurek has joined #ruby
bluenemo has quit [Ping timeout: 265 seconds]
jcromartie has joined #ruby
lukaszk has joined #ruby
lukaszk has left #ruby [#ruby]
banister_ has quit [Read error: Connection reset by peer]
nirakara has joined #ruby
ajonsson has joined #ruby
banister_ has joined #ruby
<geekbri>
In ruby is there a way to print the full object type? As in, if i had some object that was SomeClass::SomeSubClass and I wanted to literally print to the screen that class of the object. Is it just .class.name ?
franksort has joined #ruby
<franksort>
Is there a quick way to print an object in irb so it displays one attribute per line?
<Hanmac>
geekbri: you could also print .class directly
<geekbri>
Hanmac: ah ok, i will give that a shot, thank you
<Hanmac>
franksort i think you are looking for pp (prettyprint)
<shevy>
geekbri .class.ancestors and perhaps the first entry of that array
<shevy>
oh wait
<shevy>
.class alone suffices :)
bluenemo has joined #ruby
<geekbri>
:)
tayy has quit [Remote host closed the connection]
<franksort>
Hanmac: It looks like pp can wrap at a certain char limit, but I'm looking for one attribute per line
jcromartie has quit [Quit: jcromartie]
jenrzzz-mac has quit [Quit: jenrzzz-mac]
bwlang has joined #ruby
mohits has quit [Ping timeout: 252 seconds]
<Hanmac>
franksort: a.tap{|obj|obj.instance_variables.each {|s| p "#{s} => #{obj.instance_variable_get(s)}"}}
banister_ has quit [Read error: Connection reset by peer]
`brendan has joined #ruby
mohits has joined #ruby
mohits has quit [Changing host]
mohits has joined #ruby
ZachBeta has joined #ruby
<franksort>
Interesting…what's that tap method?
ryan0x2 has joined #ruby
<hoelzro>
I just learned about tap myself =)
banister_ has joined #ruby
gentz has quit [Remote host closed the connection]
milestone has joined #ruby
BiHi has joined #ruby
<ij>
Is chaining after a multi-line do..end proc heavily frowned upon?
sbanwart has joined #ruby
ZachBeta has quit [Quit: Computer has gone to sleep.]
<Tasser>
ij, I do it, sooo :-)
allanm_ has joined #ruby
tatsuya__ has joined #ruby
tatsuya_o has quit [Read error: Connection reset by peer]
allanm has quit [Read error: Connection reset by peer]
Guest29062 has quit [Read error: Connection reset by peer]
robotmay_ has joined #ruby
Guest29062 has joined #ruby
milestone_ has joined #ruby
ajonsson is now known as ajonsson|away
krusty_ar has joined #ruby
burgestrand has joined #ruby
<Hanmac>
franksort: currently i use it because i need obj twice in my code, and i dont want to use the a variable again
Axsuul has quit [Ping timeout: 240 seconds]
robotmay has quit [Ping timeout: 260 seconds]
mneorr_ has joined #ruby
allanm_ has quit [Read error: Connection reset by peer]
fayimora has quit [Ping timeout: 260 seconds]
mneorr has quit [Ping timeout: 265 seconds]
milestone has quit [Ping timeout: 245 seconds]
milestone_ is now known as milestone
ajonsson|away has quit [Quit: ajonsson|away]
banister_ has quit [Read error: Connection reset by peer]
banseljaj is now known as imami|afk
bwlang has quit [Ping timeout: 244 seconds]
iocor has joined #ruby
banister_ has joined #ruby
bfig has quit [Ping timeout: 240 seconds]
rizzylt has joined #ruby
tommyvyo has joined #ruby
Konboi has quit [Remote host closed the connection]
adamkittelson has joined #ruby
nfluxx has quit [Quit: nfluxx]
<franksort>
ah, thanks
banister_ has quit [Read error: Connection reset by peer]
chrismcg is now known as zz_chrismcg
yonggu_ has joined #ruby
banisterfiend has joined #ruby
yonggu has quit [Ping timeout: 252 seconds]
siksia has quit [Ping timeout: 252 seconds]
Criztian has joined #ruby
<shevy>
ij it can be useful. I usually do it via {} though. exit_game { do_cleanup_tasks } if @game_over
fayimora has joined #ruby
test34 has joined #ruby
bfig has joined #ruby
siksia has joined #ruby
xjiujiu_ has joined #ruby
hakunin has joined #ruby
adamkittelson has quit [Remote host closed the connection]
fayimora has quit [Ping timeout: 252 seconds]
Jackneill has joined #ruby
DuoSRX has quit [Remote host closed the connection]
fayimora has joined #ruby
DuoSRX has joined #ruby
bbttxu has quit [Quit: bbttxu]
fayimora has quit [Client Quit]
cdempsey has joined #ruby
mneorr_ has quit [Remote host closed the connection]
xaxisx has joined #ruby
geekfactor has quit [Remote host closed the connection]
nipra has quit [Read error: Operation timed out]
geekfactor has joined #ruby
fbernier has joined #ruby
jdripper has joined #ruby
FND has joined #ruby
pu22l3r_ has quit [Remote host closed the connection]
pu22l3r has joined #ruby
banisterfiend has quit [Read error: Connection reset by peer]
fmcgeough has joined #ruby
tommyvyo_ has joined #ruby
ajonsson has joined #ruby
banisterfiend has joined #ruby
wangr has joined #ruby
peregrine81 has joined #ruby
vectorshelve has quit [Quit: Page closed]
mneorr has joined #ruby
fermion has joined #ruby
akem has quit [Read error: Connection reset by peer]
<relix>
but apparently it's not working - i.e. they aren't seen as equal in the Array#-() method
<relix>
is there another method I should be overriding?
<bwlang>
what's the ruby idiom to deal with an array or single value passed parameter as an array?
nlc has joined #ruby
digitalcakestudi has quit [Ping timeout: 252 seconds]
rizzylt has quit [Ping timeout: 260 seconds]
mucker has joined #ruby
<relix>
never mind, the error must be somewhere else, I tried manually subtracting arrays like that and it works
dphase- is now known as dphase
theRoUS has quit [Ping timeout: 260 seconds]
banister_ has quit [Read error: Connection reset by peer]
rizzylt has joined #ruby
<relix>
ha, the comparison method is never even called
burgestrand has quit [Quit: Leaving.]
<relix>
I have it forced to return true and it still doesn't remove any items
heeton has joined #ruby
banister_ has joined #ruby
<FND>
given n hashes (database records actually) with a common set of keys (attributes), how can I determine which keys' values are nil for all records?
lopin has quit [Ping timeout: 245 seconds]
<FND>
e.g. A = { :foo => "lorem", :bar => nil, :baz => "ipsum" }; B = { :foo => nil, :bar => nil, :baz => "..." }; result == [:baz]
<relix>
FND: merge them all
abionic has quit [Ping timeout: 245 seconds]
<heeton>
Anyone know of an example of before_filter (like rails controllers) being used on a normal ruby object?
<FND>
relix: d'oh! that should work
<heeton>
(I.e. inserting some code before/after a call to a method)
<FND>
thanks
<relix>
FND: np
lopin has joined #ruby
<relix>
heeton: alias a method and then call the old method from the before/around/after_filter ?
cha1tanya has quit [Ping timeout: 256 seconds]
<heeton>
relix: was thinking that, but then I think I'd need the method defined before the filter
<heeton>
That might not always be the case
<heeton>
Though, I could go that way...
<FND>
except, relix, `merge` doesn't skip fields with `nil` values
<relix>
FND you can use the method #compact to remove nil values I think?
<relix>
so merge the compact'ed hashes
<tommylommykins>
is it possible to perform deconstruction outside of a set of arguments
<relix>
then check the difference between the keys of the final hash, and the keys of one of the original hashes
darthdeus has joined #ruby
<relix>
heeton: oh yeah, that's right, it'd get messy fast
dev_ has quit [Ping timeout: 248 seconds]
<afallows>
If I only need a single table with a very small number of rows (~100) at any given time, what's the best DB solution that I can get up and running quickly in Ruby?
Guest29062 has quit [Quit: derp herp]
<FND>
relix: hashes don't have a `compact` method
jcromartie has joined #ruby
<relix>
FND: f*ck
apeiros_ has quit [Remote host closed the connection]
<relix>
FND then you'll have to do the reject thingy yes
kenperkins has joined #ruby
<relix>
FND sorry, the API sometimes gets messy in my head
<FND>
ditto :)
<relix>
it's hard to remember some of the subtle details :D
<relix>
so, what could be the reason that this: thread.participants-[message.from]
<relix>
doesn't call the User#==() method, but this: thread.participants.delete(message.from)
<relix>
does
sahli has quit [Remote host closed the connection]
lorandi has joined #ruby
adamramadhan has quit [Ping timeout: 260 seconds]
Vert has quit [Ping timeout: 252 seconds]
<jedmtnman>
afallows: single access user?
a_a_g has quit [Quit: Leaving.]
<jedmtnman>
afallows: also relational or datastore?
<FND>
relix: that's very interesting indeed - I would guess it's some internal optimization
<afallows>
jedmtnman: Single access, and I don't have a preference. I am woefully undereducated on databases, I just need to keep a persistent record.
krusty_ar_ has joined #ruby
<jedmtnman>
sqlite is pretty simple
bwlang has quit [Ping timeout: 240 seconds]
<jedmtnman>
its the default that comes with rails, and its pretty quick, but its limited to one user at a time
<jedmtnman>
and it relational
krusty_ar has quit [Ping timeout: 245 seconds]
<jedmtnman>
afallows: if the data is not relational, it might be reasonable just to store it in a flat file.
<jedmtnman>
as a list of ruby hash objects, maybe.
<afallows>
I think the advantage of using sqlite or similar would be that the structure is already implemented. As opposed to devising a flat file format and parsing process myself.
ben_alman has quit [Excess Flood]
erichmenge has joined #ruby
erichmenge has quit [Client Quit]
Guest85767 has quit [Read error: Connection reset by peer]
<jedmtnman>
afallows: well, you aren't parsing it, you're just reading it.
Guest85767 has joined #ruby
blacktulip has quit [Remote host closed the connection]
xanaru has quit [Remote host closed the connection]
<jedmtnman>
flat file has structure [{id:1, post:"foo"},{id:2, post:"bar"}]
<jedmtnman>
in code
<jedmtnman>
MyPosts = File.read('posts.rb')
<jedmtnman>
MyPosts.each {...}
seitensei has joined #ruby
<jedmtnman>
(metacode)...
erichmenge has joined #ruby
nanderoo has quit [Read error: Connection reset by peer]
d2s has left #ruby [#ruby]
<afallows>
Hm. I'll have to consider that. I'm only expecting to have one table, which sort of defeats the purpose of relational DBs
ryan0x2 has quit [Remote host closed the connection]
<afallows>
I think my coworkers/supervisors might just be DB-happy, they recommended that I use a DB
<jedmtnman>
yah, not to exactly promote all the ideas in the linked post, but one interesting one is to not worry so much about the persistence layer up front, just use something that works
bwlang has joined #ruby
<jedmtnman>
DB's are required when you need to have atomic reads and writes. A flat file, however can be versioned and is plain text readable, which may also be useful
<jedmtnman>
shoot, you can just use rubys csv lib if you want
kenperkins has quit [Quit: Computer has gone to sleep.]
<afallows>
I almost want to. The only thing I might get out of a (R)DB is that entries need unique IDs and I can just tell the DB "Do that" and it will do it.
Guest85767 has quit [Ping timeout: 252 seconds]
sonicpond has joined #ruby
<jedmtnman>
afallows: well, if you keep your entries in a list, the vector index is a unique id.
iamjarvo has joined #ruby
eurek has joined #ruby
<afallows>
True enough
<jedmtnman>
also you can generate an id, based on something random:
tomb__ has quit [Quit: Computer has gone to sleep.]
uris has joined #ruby
bwlang_ has joined #ruby
ryan0x2 has joined #ruby
Guest85767 has joined #ruby
<jedmtnman>
the other major advantage to a 'real' DB is that it can run as a process and its easy to access it, even from another machine. so if many people are using it (and esp if you want to enforce rights and privileges) then even if it is a small db, its worth doing something like running a mysql server
Helius has quit [Remote host closed the connection]
arturaz has quit [Ping timeout: 260 seconds]
<jedmtnman>
and any of those dbs mentioned have very good ruby drivers and finally afallows, you may consider just writing a little rails app so you have a gui to maintain the data.
bwlang has quit [Ping timeout: 245 seconds]
bwlang_ is now known as bwlang
<jedmtnman>
you can probably write the rails app faster than you can figure out how to communicate with a db through plain ruby if you are new.
theRoUS has joined #ruby
<jedmtnman>
for a small db, its just a few generator commands away from doing basic db actions and if you don't care about privacy, host on heroku for free.
<jedmtnman>
if you do care about privacy, hooking up authentication and authorization is a bit more difficult
<jedmtnman>
but then you could still host it for free
ryan0x2 has quit [Remote host closed the connection]
rizzylt has quit [Remote host closed the connection]
PaciFisT has joined #ruby
banister_ has quit [Read error: Connection reset by peer]
fearoffish has joined #ruby
jprovazn has quit [Quit: Leaving]
<afallows>
Thanks for all your advice, jedmtnman - for the record, this DB is for a Sinatra app. I don't know if that colors the choices at all.
eurek has quit [Quit: Computer has gone to sleep.]
<jedmtnman>
no, we use sinatra all the time. if your that comfortable with ruby, I'd just do a mysql db and if possible host it on a sep server from your app.
banisterfiend has joined #ruby
eurek has joined #ruby
lolmaus has quit []
<jedmtnman>
afallows: google for the mysql gem and you can pick from any number of orms like ActiveRecord if you want abstraction
<afallows>
For this particular implementation, I expect it to be on the same server as the app - The app is small, simple, and on a VPN.
<afallows>
It's also on an AWS instance.
jprovazn has joined #ruby
<afallows>
No need to run two instances for one small app.
chson has joined #ruby
xaq has joined #ruby
<jedmtnman>
still i'd probably use mysql for any prod work over sqlite and run it on the same instance if you are serving a web app.
<jedmtnman>
i mean that if… to be a prefixed statement :)
mohits has joined #ruby
mohits has quit [Changing host]
mohits has joined #ruby
Morkel has joined #ruby
<hoelzro>
mysql == frown town
carlyle has joined #ruby
seitensei has quit [Ping timeout: 252 seconds]
<jedmtnman>
hoelzro: its simple and standard and easy to support.
siksia has quit [Ping timeout: 252 seconds]
bwlang_ has joined #ruby
Guedes_out is now known as Guedes
<jedmtnman>
I'm not a huge fan, but its fine for what he's doing it sounds like
mucker has quit [Quit: leaving]
<hoelzro>
it's popular, and a lot of devs know it
<jedmtnman>
even a lot of non-devs know it
<hoelzro>
that's about all I'll give it =)
<jedmtnman>
(at least the syntax)
<hoelzro>
however, the same could be said of PHP =P
<jedmtnman>
no. no one knows php, just cmd-c, cmd-p
<afallows>
I think it will be. I won't run afoul of any of the major flaws of MySQL with such a small project.
apeiros_ has joined #ruby
<afallows>
PHP makes my heart hurt.
zz_chrismcg is now known as chrismcg
<jedmtnman>
afallows: no. mysql hosts data for some pretty important projects.
<hoelzro>
my favorite feature of MySQL is how you can insert data that doesn't fit and it'll just keep chugging along.
<jedmtnman>
hoelzro: postgresql fan?
<apeiros_>
"feature"
<hoelzro>
jedmtnman: I like PostgreSQL, but I haven't used it much. I just hate MySQL.
darthdeus has joined #ruby
seitensei has joined #ruby
<hoelzro>
granted, it pays the bills, but I still hate it =)
<apeiros_>
hoelzro: you haven't had a chance to use oracle yet, yes? :)
<afallows>
I hate things that pay the bills. :|
siksia has joined #ruby
<hoelzro>
apeiros_: nope
bwlang has quit [Ping timeout: 265 seconds]
bwlang_ is now known as bwlang
<apeiros_>
hoelzro: you'd hate it even more, trust me.
<jedmtnman>
afallows: I just finished "7 databases in seven weeks" its worth a read, regardless of your db experience.
<jedmtnman>
we use mysql, couchdb, and neo4j in house.
dv310p3r has joined #ruby
<afallows>
jedmtnman: That's definitely a book I'd like to pick up, but haven't, and it would be pretty far down my current reading list.
<hoelzro>
jedmtnman: which DBs are covered?
<afallows>
My team actually uses MongoDB in-house, but I wasn't planning to use that here - not sure it's worth the overhead.
mickn has joined #ruby
<jedmtnman>
hoelzro: off the top of my head: postgresql, couchdb, redis ...
<jedmtnman>
neo4j
<jedmtnman>
pretty good survey
<hoelzro>
sounds neat
<afallows>
Redis, Neo4J, CouchDB, MongoDB, HBase, Riak, and Postgres
<jedmtnman>
afallows: well for what you're saying if you already have a mongo instance running…. maybe use that.
<afallows>
jedmtnman: There isn't already a MongoDB install running on this particular instance for this app.
<jedmtnman>
its a good follow up to their 7 languages in 7 weeks book
<afallows>
It's just the DB of choice for the other projects in the team.
internet_user has joined #ruby
<afallows>
SLSW is an excellent book. I really, really liked Io.
<jedmtnman>
well, but you can communicate with the instance from anywhere afallows
<jedmtnman>
afallows: just sayin, i know you know that
<afallows>
Yeah.
DefV has quit [Read error: Connection reset by peer]
linusoleander has quit [Quit: linusoleander]
<jedmtnman>
afallows: I really enjoyed the prolog chapter and while I probably would choose a diff jvm targeted lang for me, the scala chapter was refreshing.
<Hanmac>
banisterfiend: "Sollbruchstelle"
<afallows>
Databases are very new to me, though, and I'm not perfectly clear on the existing usage of MongoDB on the team. Full disclosure, I'm an intern working on a support project to help the full-timers improve their workflow.
djdb has quit [Remote host closed the connection]
<jedmtnman>
afallows: its a pretty simple interface if you know javascript and json
peregrine81 has quit [Quit: Computer sleeping.]
heftig has quit [Quit: leaving]
<jedmtnman>
you can store more than one db on a prod server, so if they already have that infrastructure, you might be able to take advantage of it and the mindshare.
seitensei has quit [Read error: Operation timed out]
seitensei has joined #ruby
akem has joined #ruby
pu22l3r has joined #ruby
<afallows>
I might, but it's also possible I couldn't. We're developing apps in a very modular structure, where each functional piece is its own (collection of) AWS instance(s), and each piece kind of manages its data its own way. I think the design-consistent implementaiton would be to use my own small DB for this new piece.
ph^ has quit [Remote host closed the connection]
Ripp___ has joined #ruby
Ripp__ has quit [Ping timeout: 244 seconds]
MissionCritical has quit [Ping timeout: 244 seconds]
awarner has joined #ruby
ryan0x2 has joined #ruby
mensvaga has joined #ruby
nilg` has quit [Read error: Connection reset by peer]
lopin has quit [Ping timeout: 244 seconds]
g0bl1n has joined #ruby
dekroning has quit [Ping timeout: 260 seconds]
devdazed has quit [Quit: Bye]
lopin has joined #ruby
sspiff has quit [Remote host closed the connection]
jrist-mtg is now known as jrist
peregrine81 has joined #ruby
devdazed has joined #ruby
TrahDivad has joined #ruby
nebiros has joined #ruby
xclite has joined #ruby
<TrahDivad>
Hi people. I remember seeing somewhere that you could call all the methods in a block on an object so you didn't have to prefix fix on every line. Did I dream this?
<nebiros>
hi, there's a way to send a password when I execute "git pull" command using PTY module?
mdhopkins has joined #ruby
billiamii has joined #ruby
<hoelzro>
nebiros: why not use an SSH key instead?
kenperkins has joined #ruby
<apeiros_>
TrahDivad: instance_eval?
<nebiros>
hoelzro: yeah, I think is better :\
siksia has quit [Ping timeout: 260 seconds]
Konboi has joined #ruby
Jan_ has joined #ruby
franksort has quit [Quit:]
kenperkins has quit [Ping timeout: 252 seconds]
<TrahDivad>
apeiros_: I'll check it out
axl_ has joined #ruby
statix is now known as stat1x
siksia has joined #ruby
chico_chicote has joined #ruby
freeayu has quit [Read error: Connection reset by peer]
stat1x is now known as statix
jrallison has joined #ruby
mohits has quit [Read error: Operation timed out]
pygospa has quit [Ping timeout: 244 seconds]
mickn has quit [Quit: Leaving]
Sheehan has joined #ruby
pl_ab has quit [Quit: pl_ab]
CheeToS has joined #ruby
jcromartie has quit [Quit: jcromartie]
pygospa has joined #ruby
bbttxu has quit [Quit: bbttxu]
heeton has quit [Ping timeout: 260 seconds]
heeton has joined #ruby
kevinbond has joined #ruby
tk___ has joined #ruby
keanehsiao has joined #ruby
andrewhl has quit [Remote host closed the connection]
afallows has quit [Quit: Lost terminal]
freeayu has joined #ruby
afallows has joined #ruby
jcromartie has joined #ruby
jcromartie has quit [Client Quit]
ajonsson is now known as ajonsson|away
nascro has quit [Quit: Programming is hard.]
bbttxu has joined #ruby
<makkura>
TrahDivad: http://pastie.org/4038299 Found a discussion for the same thing. instance_eval is the way to go, it seems
rippa has joined #ruby
<TrahDivad>
makkura: Thanks! That's exactly what I was looking for
abionic has quit [Read error: Connection reset by peer]
bwlang_ has joined #ruby
abionic has joined #ruby
abionic has quit [Read error: Connection reset by peer]
abionic has joined #ruby
mdw has quit [Remote host closed the connection]
abionic has quit [Read error: Connection reset by peer]
abionic has joined #ruby
abionic has quit [Read error: Connection reset by peer]
Aaton_off is now known as Aaton
abionic has joined #ruby
bwlang has quit [Ping timeout: 250 seconds]
bwlang_ is now known as bwlang
freeayu has quit [Quit: 离开]
zomgbie has joined #ruby
tatsuya__ has quit [Remote host closed the connection]
yannis has quit [Quit: yannis]
abionic has quit [Read error: Connection reset by peer]
andrewhl has joined #ruby
burgestrand has joined #ruby
abionic has joined #ruby
berserkr has quit [Quit: Leaving.]
mdw has joined #ruby
Criztian has quit [Remote host closed the connection]
maesbn has quit [Remote host closed the connection]
abionic has quit [Read error: Connection reset by peer]
oooPaul has joined #ruby
emmanuelux has joined #ruby
blacktulip has joined #ruby
Y0Gi has left #ruby [#ruby]
abionic has joined #ruby
otters has quit [Ping timeout: 245 seconds]
test34- has joined #ruby
test34- has quit [Changing host]
test34- has joined #ruby
blischalk has joined #ruby
a_a_g has quit [Ping timeout: 256 seconds]
abionic has quit [Read error: Connection reset by peer]
abionic has joined #ruby
abionic has quit [Read error: Connection reset by peer]
baroquebobcat has joined #ruby
test34 has quit [Ping timeout: 252 seconds]
khakimov has quit [Quit: Computer has gone to sleep.]
lkba has joined #ruby
tatsuya_o has joined #ruby
axl__ has joined #ruby
gmvsea has joined #ruby
axl_ has quit [Ping timeout: 244 seconds]
axl__ is now known as axl_
rmascarenhas has quit [Quit: leaving]
hoelzro is now known as hoelzro|away
mayankkohaley has joined #ruby
becom33 has quit [Read error: Connection reset by peer]
bwlang_ has joined #ruby
flype has joined #ruby
GreaterCore has joined #ruby
looopy has quit [Remote host closed the connection]
siksia has quit [Ping timeout: 248 seconds]
<GreaterCore>
hello, i have some issues with Ruby Mail and hoping somebody could enlighten me
wvms has quit [Quit: wvms]
looopy has joined #ruby
Emmanuel_Chanel has quit [Quit: Leaving]
cj3kim has joined #ruby
dentarg has joined #ruby
<apeiros_>
GreaterCore: just ask your question. if somebody in the know sees it, he/she'll certainly help.
<GreaterCore>
have anyone experience not being able to extract the body from an email sent from a mobile client (blackberry or iphone)?
Advocation has joined #ruby
<dentarg>
ftp.ruby-lang.org seems down
<dentarg>
:(
bwlang has quit [Ping timeout: 256 seconds]
bwlang_ is now known as bwlang
<GreaterCore>
i am using Net::POP3 to connect to gmail and download new mails, but incoming mobile emails does not seem to have a body
jcromartie has joined #ruby
zomgbie has quit [Read error: Connection reset by peer]
<GreaterCore>
it appears to be there when i look directly at the mail (string), but running mail.html_part or mail.text_part returns false (which imho implies that it could not extract the body)
<GreaterCore>
i did google for it, and it might be due to the possibility of the email not being in multipart
poga has joined #ruby
<GreaterCore>
if so, how would i be able to extract the body from the email?
kenperkins has quit [Read error: Connection reset by peer]
indian has joined #ruby
g0bl1n has quit [Quit: Ex-Chat]
<GreaterCore>
i am this close to writing my own parser when Net::POP3 Mail object trips over such emails
siksia has joined #ruby
mohits has joined #ruby
mohits has quit [Changing host]
mohits has joined #ruby
schovi has quit [Remote host closed the connection]
<dentarg>
so, is there a mirror of ftp.ruby-lang.org?
bbttxu has quit [Quit: bbttxu]
cha1tanya has quit [Quit: Leaving]
fmcgeough has quit [Read error: Connection reset by peer]
lopin has quit [Ping timeout: 252 seconds]
Eldariof-ru has quit [Read error: Operation timed out]
axl__ has joined #ruby
fmcgeough has joined #ruby
rushed has joined #ruby
GreaterCore_ has joined #ruby
alfism has joined #ruby
GreaterCore_ has quit [Client Quit]
axl_ has quit [Ping timeout: 252 seconds]
axl__ is now known as axl_
GreaterCore has quit [Ping timeout: 260 seconds]
zomgbie has joined #ruby
thecreators has joined #ruby
thone_ has joined #ruby
bluenemo has quit [Remote host closed the connection]
n1x has joined #ruby
kenperkins has joined #ruby
thone has quit [Ping timeout: 252 seconds]
senny has quit [Remote host closed the connection]
jcromartie has quit [Quit: jcromartie]
cj3kim has quit [Quit: This computer has gone to sleep]
Sheehan has quit [Quit: Sheehan]
lkba has quit [Quit: Bye]
lkba has joined #ruby
uris has quit [Quit: leaving]
zomgbie has quit [Read error: Connection reset by peer]
eywu has joined #ruby
ipoval has joined #ruby
Solnse has joined #ruby
blischalk has quit [Quit: blischalk]
Morkel has quit [Quit: Morkel]
Sheehan has joined #ruby
ekaleido has quit [Remote host closed the connection]
d3c has quit [Quit: Sleep]
ajonsson is now known as ajonsson|away
<dentarg>
no one cares about ruby-lang.org?
MasterIdler has joined #ruby
tomb__ has joined #ruby
robotmay_ has quit [Remote host closed the connection]
uris has joined #ruby
Jackneill has quit [Remote host closed the connection]
jrist-mtg is now known as jrist
ipoval has quit [Client Quit]
bier has quit [Ping timeout: 244 seconds]
enroxorz has quit [Read error: Connection reset by peer]
Paul-Atreides has joined #ruby
Paul-Atreides has joined #ruby
Paul-Atreides has quit [Changing host]
<heeton1>
Are there any gems or snippets available that provide before_filter like functionality to normal ruby objects?
Limb_ is now known as Limb
Araxia_ has joined #ruby
looopy has quit [Remote host closed the connection]
jrist is now known as jrist-afk
Kartagis has quit [Ping timeout: 246 seconds]
maletor has joined #ruby
<makkura>
heeton1: Off hand, none that I see. Though I see a SO suggesting to simply use ActiveModel callbacks (exactly as rails does). The AR:CallBacks section actually has some details on doing that
<mensvaga>
yeah, I'm doing the latest 1.9.3 stable
<mensvaga>
It finished without errors.
<bricker88>
Here is my question: I am attempting to extend a class with a module, but it doesn't seem to be working… the Module is loaded (verified in the console) but this class method isn't being recognized for some raosn. https://gist.github.com/2883551
<bricker88>
reason*
<mensvaga>
I need to get the full list of compilation stuff somebody wants me to use now.
williamcotton_ has joined #ruby
williamcotton has quit [Ping timeout: 252 seconds]
williamcotton_ is now known as williamcotton
Guest85767 has quit [Ping timeout: 265 seconds]
<shevy>
bricker88 I dont think that works
<shevy>
I've never seen include used inside a method
zomb1e has quit [Remote host closed the connection]
<apeiros_>
shevy: yehuda shows examples that are bad
stepnem has quit [Ping timeout: 260 seconds]
<shevy>
yeah
zomb1e has joined #ruby
<apeiros_>
and he goes on to show how to do it better
<shevy>
I see
Solnse has quit []
<shevy>
well actually
<shevy>
apeiros_ showed how to do it better now
<shevy>
:)
Karmaon has joined #ruby
maesbn has quit [Remote host closed the connection]
binaryplease has quit [Quit: WeeChat 0.3.7]
jenrzzz-mac has quit [Quit: jenrzzz-mac]
ken_barber has quit [Remote host closed the connection]
<apeiros_>
shevy: hm? I only stated that his pasted code was correct…
<bricker88>
I guess this is something to do with the Rails stack then
yosinof has quit [Quit: Leaving]
fermion has quit [Quit: P]
<apeiros_>
bricker88: I doubt it
affix has quit [Excess Flood]
<apeiros_>
I've done a couple of acts_as_* that way and I haven't encountered a NameError
<bricker88>
apeiros_: hm
<apeiros_>
bricker88: do you use something like pry or irb_drop? if so, drop in right before your acts_as call
stepnem has joined #ruby
pawdro has quit [Quit: Konversation terminated!]
<apeiros_>
then check .methods and ActsAsStandalone.instance_methods
<apeiros_>
what could be a problem is rails' autoloading and auto-vivification of modules
affix has joined #ruby
bwlang_ has joined #ruby
<apeiros_>
i.e., that your ActsAsStandalone seems loaded because the module is there, but actually it's only an empty shell, which rails auto-vivified
hukl has joined #ruby
pawdro has joined #ruby
chienpo has joined #ruby
<bricker88>
apeiros_: Good idea, I will play around with it
peregrine81 has joined #ruby
a_a_g has quit [Ping timeout: 245 seconds]
a_a_g1 has joined #ruby
looopy has joined #ruby
weasels has joined #ruby
otters has quit [Quit: Page closed]
tayy has quit [Remote host closed the connection]
weasels has quit [Remote host closed the connection]
bwlang has quit [Ping timeout: 250 seconds]
bwlang_ is now known as bwlang
otters has joined #ruby
albemuth has joined #ruby
havenn has joined #ruby
fserb has joined #ruby
<bricker88>
apeiros_: Just a quick check on it and it doesn't seem like the acts_as_standalone method is part of that module. Once I required the file, it was included as an instance method. So is it possible that Rails just isn't properly requiring the file?
<bricker88>
(by "Rails" I mean "me")
dekroning has joined #ruby
<bricker88>
hm, I have it autoloading a directory in /lib but I wonder if it loads files recursively…. let's find out, shall we
limed has quit [Ping timeout: 240 seconds]
khakimov has quit [Quit: Computer has gone to sleep.]
<apeiros_>
bricker88: possible.
<apeiros_>
you can check $LOADED_FEATURES to check whether your file has been loaded at all
<apeiros_>
do you have `module ActsAsStandalone` somewhere else in your code?
<apeiros_>
if so, that'll stop rails from even loading your file
<apeiros_>
(because the constant is defined at that point…)
akem has quit [Read error: Connection reset by peer]
user__ has joined #ruby
<bricker88>
apeiros_: No, I don't have it anywhere. Using your suggestion, it appears as if the file isn't being loaded at all.
<bricker88>
anywhere else*
jedmtnman1 has joined #ruby
<apeiros_>
sadly, there's no const_added :(
<apeiros_>
ah
<apeiros_>
you could do: ActsAsStandalone = "Foo"
<apeiros_>
now module ActsAsStandalone will cause a warning, telling you where it gets defined…
<apeiros_>
actually even an exception :D
<bricker88>
Good idea
bluenemo has quit [Remote host closed the connection]
null- has joined #ruby
jedmtnman has quit [Ping timeout: 252 seconds]
bluenemo has joined #ruby
bluenemo has quit [Changing host]
bluenemo has joined #ruby
Bosma has joined #ruby
<apeiros_>
just do it early enough ;-) (e.g. on the top in config/application.rb)
n1x has quit [Quit: "off to reading/learning SICP"]
aruntomar has joined #ruby
bwlang_ has joined #ruby
<bricker88>
No warning, I just think the file isn't getting loaded at all
ringotwo has joined #ruby
<aruntomar>
i tried installing ruby on 4 different machines and still getting this error. git://gist.github.com/2883705.git
krusty_ar_ has quit [Read error: Connection reset by peer]
ryan0x2 has quit [Remote host closed the connection]
krusty_ar has joined #ruby
paul__ has joined #ruby
<aruntomar>
i should have sent this link: https://gist.github.com/2883705 . by the way, i'm trying it with rvm and i've previous install ruby on many of my machines.
<bricker88>
apeiros_: I think I just need to require the file in an initializer
bwlang has quit [Ping timeout: 248 seconds]
bwlang_ is now known as bwlang
<GeekOnCoffee>
aruntomar: the website is down
pdtpatrick has joined #ruby
MrGando has joined #ruby
<aruntomar>
GeekOnCoffee, oh..., ok.
<GeekOnCoffee>
unfortunately I don't have a solution for you
one8zero has joined #ruby
<bricker88>
apeiros_: yeah, I just added `require "acts_as_standalone"` to the top of the base controller class and it works fine now - Thanks for your help!
one8zero has quit [Remote host closed the connection]
one8zero has joined #ruby
<apeiros_>
bricker88: yw, wonder where/why the module got created, though
<tds>
is there a way to see if a method is defined in an object's class, but not the object's ancestors?
piotr_ has joined #ruby
<banisterfiend>
tds: obj.method(name).owner
axl__ has joined #ruby
<tds>
thanks banisterfiend
jenrzzz-mac has joined #ruby
Emmanuel_Chanel has quit [Quit: Leaving]
Jeff23 is now known as Jeffery
Jeffery is now known as Jeff23
Squarepy__ has quit [Ping timeout: 260 seconds]
waazzuup has quit [Quit: waazzuup]
theRoUS has joined #ruby
axl_ has quit [Ping timeout: 260 seconds]
axl__ is now known as axl_
Y_Ichiro has joined #ruby
workmad3 has quit [Ping timeout: 248 seconds]
one8zero has quit [Ping timeout: 265 seconds]
one8zero_ is now known as one8zero
stephenjudkins has quit [Quit: stephenjudkins]
cdempsey has quit [Quit: Quitting!]
d34th4ck3r has joined #ruby
Jeff23 is now known as Cider
jenrzzz-mac has quit [Ping timeout: 248 seconds]
jimeh has joined #ruby
Emmanuel_Chanel has joined #ruby
darthdeus has quit [Read error: Connection reset by peer]
Bela-Lugosi has quit [Read error: Connection reset by peer]
darthdeus has joined #ruby
Squarepy__ has joined #ruby
Bela-Lugosi has joined #ruby
Bela-Lugosi has quit [Changing host]
Bela-Lugosi has joined #ruby
bwlang_ has joined #ruby
ktilcu has joined #ruby
fserb has quit [Quit: ttyl]
TheFuzzball is now known as Guest12323523423
locriani has joined #ruby
kenneth has joined #ruby
Guest12323523423 is now known as TheFuzzball
Squarepy_ has quit [Ping timeout: 260 seconds]
sako has joined #ruby
bwlang has quit [Ping timeout: 265 seconds]
bwlang_ is now known as bwlang
<sako>
hey guys, where would an error in unicorn.rb after_fork hook be logged to?
<sako>
/tmp/unicorn.stderr.log?
TheFuzzball is now known as luyang123
luckyruby has joined #ruby
heeton1 has joined #ruby
<heeton1>
How do you check if a method is public or private?
<kenneth>
heeton1: pry can tell you i believe
<heeton1>
In the code I mean
eph3meral has joined #ruby
<kenneth>
heeton1: if it's after a private statement it's private
luyang123 is now known as TheFuzzball
<heeton1>
Yes.. but is there a way to programmatically check that?
<kenneth>
or do you mean at runtime (retrospection)
<banisterfiend>
heeton1: not easily
<banisterfiend>
heeton1: you have to check private_methods, public_methods, protected_methods
<banisterfiend>
and see to which one it belongs
<banisterfiend>
that's what pry does, too
Vainoharhainen has quit [Read error: Connection reset by peer]
<shevy>
heeton1 perhaps if you use .send
Vainoharhainen has joined #ruby
Squarepy_ has joined #ruby
Paul-Atreides has joined #ruby
Paul-Atreides has quit [Changing host]
Paul-Atreides has joined #ruby
Bela-Lugosi has quit [Read error: Connection reset by peer]
kpshek has joined #ruby
<heeton1>
Cheers everyone
<heeton1>
I'm doing this within method_added
one8zero has quit [Quit: one8zero]
<heeton1>
and it seems it isn't actually in the lists of public/private methods yet at that point
<banisterfiend>
heeton1: you could write a private? public? protected? class extension for Method/UnboundMethod
<banisterfiend>
to make life easier
<heeton1>
*it's an instance method
waazzuup has joined #ruby
nilg`` has joined #ruby
<heeton1>
banisterfiend: not sure what you mean
one8zero has joined #ruby
nilg` has quit [Read error: Connection reset by peer]
<banisterfiend>
heeton1: nevermind :)
chico_chicote has quit [Ping timeout: 245 seconds]
ringotwo has quit [Read error: Connection reset by peer]
ringotwo_ has joined #ruby
<Khyron320>
Hey guys, i just need a bit of direction on how to parse data that looks like this:
<kenneth>
hey all, so i've got a rack app which also launches an event machine as part of the config.ru (works fine). i'd like to use web sockets in the event machine and i'm having trouble figuring out how this should be done
<Khyron320>
or what to google to find a good guide
marten has quit [Remote host closed the connection]
kirun has joined #ruby
BrianE has quit [Remote host closed the connection]
amar_key has quit [Remote host closed the connection]
relix has quit [Remote host closed the connection]
ziyadb has quit [Remote host closed the connection]
Spaceghostc2c has quit [Remote host closed the connection]
denysonique has quit [Remote host closed the connection]
notbrent has quit [Read error: Connection reset by peer]
DavidTiger has quit [Read error: Connection reset by peer]
cesario has quit [Read error: Connection reset by peer]
moeSeth has quit [Read error: Connection reset by peer]
srid has quit [Read error: Connection reset by peer]
randym has quit [Remote host closed the connection]
pkondzior has quit [Remote host closed the connection]
jrgifford has quit [Remote host closed the connection]
Dr4g has quit [Remote host closed the connection]
anildigital_work has quit [Remote host closed the connection]
jhowarth has quit [Read error: Connection reset by peer]
kapowaz has quit [Read error: Connection reset by peer]
MoMo has quit [Read error: Connection reset by peer]
SeanTAllen has quit [Read error: Connection reset by peer]
aquaranto has quit [Remote host closed the connection]
<Khyron320>
the value i would care about is 138000.0
patricksroberts has quit [Read error: Connection reset by peer]
blooberr has quit [Remote host closed the connection]
ctevie has quit [Remote host closed the connection]
dekz has quit [Remote host closed the connection]
Squarepy_ has quit [Changing host]
Squarepy_ has joined #ruby
MetaCosm has quit [Remote host closed the connection]
svnlto has quit [Remote host closed the connection]
si14 has quit [Remote host closed the connection]
Squarepy_ is now known as Squarepy
_marvin has quit [Remote host closed the connection]
amar_key has joined #ruby
NimeshNeema has quit [Remote host closed the connection]
dkannan has quit [Remote host closed the connection]
relix has joined #ruby
<kenneth>
what i've got so far is this: fork. child launches event-machine on a random available port in a port range. parents waits for child to report port id thru a pipe, stuffs it into a global variable and launches the rack web app
lectrick has quit [Remote host closed the connection]
NotreDev has quit [Quit: NotreDev]
mayankkohaley has joined #ruby
NimeshNeema has joined #ruby
tvw has joined #ruby
<heeton1>
banisterfiend: haha, we're crossing over on twitter too ;)
<kenneth>
the web app process can respond to the html client with the port id of its sibling web socket process, which can then be connected to directly
<kenneth>
does that make sense, or is it just plain insane?
werdnativ has quit [Read error: Connection reset by peer]
werdnativ_ is now known as werdnativ
x0F_ is now known as x0F
gregorg has quit [Read error: Connection reset by peer]
mayankkohaley has quit [Ping timeout: 245 seconds]
icyfenix has quit [Ping timeout: 245 seconds]
mayankkohaley_ is now known as mayankkohaley
mneorr_ has joined #ruby
darthdeus has quit [Quit: Leaving...]
aruntomar has quit [Quit: Leaving]
Tricks has quit [Read error: Connection reset by peer]
<rakm>
fbernier you want to push one array into the other and then use .uniq method
mneorr_ has quit [Remote host closed the connection]
jimeh has quit [Ping timeout: 245 seconds]
icyfenix has joined #ruby
nilg``` has quit [Ping timeout: 260 seconds]
BrianE has joined #ruby
fserb has joined #ruby
timonv has joined #ruby
aquaranto has joined #ruby
jhowarth has joined #ruby
SeanTAllen has joined #ruby
<carloslopes>
rakm: hmm but i think that if he do this way, it will not return in the desired order
<carloslopes>
d/do/does
iamjarvo has quit [Quit: Leaving.]
<yxhuvud>
fbernier: what do you want to happen if the entries are different at a spot?
kaneda has joined #ruby
demian`_ has quit [Quit: demian`_]
<fbernier>
yxhuvud: it will never happen
<banisterfiend>
heeton1: oh that was you, hehe, cool.
kaneda is now known as Guest40233
<yxhuvud>
a.zip(b) {|el_a, el_b| el_a || el_b}
jrajav has quit [Quit: burgermouth]
<carloslopes>
fbernier: result = array1 + array2; result.sort
<carloslopes>
fbernier: this works
linduxed has quit [Ping timeout: 252 seconds]
user__ has quit [Read error: Connection reset by peer]
<rakm>
carloslopes ahh, it looks like he's using boolean logic to get the truthy value if there is one and nil if there is one. fbernier is that right?
linduxed has joined #ruby
<rakm>
in that case, don't use .uniq
<rakm>
or .sort
<carloslopes>
fbernier: ops... result = array1 + array2; result.uniq!.sort!
<carloslopes>
fbernier: this is correct :)
yoklov has joined #ruby
albemuth has quit [Ping timeout: 248 seconds]
ctevie has joined #ruby
ctevie has quit [Changing host]
ctevie has joined #ruby
ronniy has quit [Remote host closed the connection]
iamjarvo has joined #ruby
Tricks has joined #ruby
allsystemsarego has joined #ruby
Eldariof-ru has quit []
<fbernier>
carloslopes: id does not because it does not keep my nil elements
jrajav has joined #ruby
AxonetBE has joined #ruby
<carloslopes>
fbernier: hmm yeah.. this is true :/
albemuth has joined #ruby
lectrick has joined #ruby
bosphorus has joined #ruby
cesario has joined #ruby
pkondzior has joined #ruby
<yxhuvud>
oops. my solution should have been a.zip(b).map {|el_a, el_b| el_a || el_b}
tatsuya_o has joined #ruby
theRoUS has quit [Ping timeout: 260 seconds]
Resure has quit [Remote host closed the connection]
bradhe has joined #ruby
indian has joined #ruby
banisterfiend has quit [Ping timeout: 252 seconds]
allsystemsarego has quit [Client Quit]
<bradhe>
I keep seeing at '->' a la CoffeeScript. I've been writing Ruby for about a year and a half full time, is there a lexeme I'm unfamiliar with??
banisterfiend has joined #ruby
<eph3meral>
bradhe, pastie.org ?
<eph3meral>
bradhe, -> is not anything ruby related that I know of
bwlang has quit [Ping timeout: 265 seconds]
<lectrick>
ok i think so much more could be done with the lowly 'require' call.
<eph3meral>
or is a lambda/block type of some kind
fbernier has quit [Ping timeout: 260 seconds]
<eph3meral>
anonymous proc maybe? i'm not positive
<lectrick>
shevy: as much as I love cookies, are you talking about a real thing? lol
<eph3meral>
I do think I've seen that before
otters has quit [Quit: Leaving]
<yxhuvud>
eph3meral: it IS a lambda. using new syntax from 1.9.
hemanth has quit [Read error: Connection reset by peer]
<eph3meral>
yxhuvud, ahh, ok cool
<shevy>
lectrick well the require call, not sure what you mean with it :D
weasels has quit [Client Quit]
<eph3meral>
yeah, nice, didn't know there was a shorthand for lambda :)
<eph3meral>
knew about the new hash shorthand syntax
otters has joined #ruby
hemanth has joined #ruby
pawdro has joined #ruby
fbernier has joined #ruby
<lectrick>
->(lambdavars){ some code }
Spaceghostc2c has joined #ruby
<carloslopes>
lectrick: ugly :(
Nahra has quit [Quit: leaving]
<lectrick>
i'm ok with it
one8zero has quit [Quit: one8zero]
Axsuul has joined #ruby
iamjarvo has quit [Quit: Leaving.]
<carloslopes>
lectrick: imho :)
<lectrick>
anyway shevy, we have an issue in production where the same code is getting loaded twice. While this shouldn't cause problems normally (even if it's not supposed to happen due to how "require" works), it does in this case, sigh.
AxonetBE has quit [Quit: Leaving.]
MetaCosm has joined #ruby
Dr4g has joined #ruby
bglusman has quit [Remote host closed the connection]
<bradhe>
I tink it looks nice
banisterfiend has quit [Read error: Connection reset by peer]
<lectrick>
basically, the following code will be successful the first time you run it, but fail the second time: module Hashie; class Hash < Hash; end; end
bglusman has joined #ruby
<bradhe>
moving the vars out of the block is kinda wonky though
<lectrick>
The fix is to do module Hashie; class Hash < ::Hash; end; end but the problem is that something is loading the module def twice
MoMo has joined #ruby
sparrovv has quit [Ping timeout: 248 seconds]
<carloslopes>
bradhe: maybe i need to familiarize with it :/
Criztian has quit [Read error: Operation timed out]
<banisterfiend>
lectrick: maybe u can replace your require with require File.expand_path(that_file)
kirun has joined #ruby
<banisterfiend>
lectrick: it could be because the same file is being referred to in different ways, which causes rquire to think it's a different file
<banisterfiend>
i.e require ".././hello" vs require "../hello"
<lectrick>
Anyone ever try "ap $:" and see the ivar peculiarity there? (assuming you have awesome_print gem)
<lectrick>
banisterfiend: since "require" only stores absolute paths, that should no longer matter, although it may have in prior Rubies
jrist-gym is now known as jrist
<lectrick>
at least in 1.9.2, $" only contains absolute paths of files loaded so "require"s with different file paths should still resolve to the same thing
<banisterfiend>
Yeah i've seen it/heard of it being an issue before
Yarou_ has quit [Quit: Leaving]
<banisterfiend>
lectrick: yes it should, but i wouldn't put it passed require being buggy
<fbernier>
Anyone know how I could turn [1, nil, 2, 3, nil] and [nil, 4, 2, nil, nil] into [1, 4, 2, 3, nil] ? Arrays will aleays be the same length and if both values exist they'll always be the same.
friskd has quit [Quit: friskd]
sepp2k has quit [Ping timeout: 252 seconds]
<banisterfiend>
lectrick: and unfortunately we have to work around ruby bugs, my libraries are full of workarounds for ruby bugs
havenn has quit [Remote host closed the connection]
bglusman has quit [Ping timeout: 246 seconds]
sepp2k has joined #ruby
Ecco_ has joined #ruby
<Ecco_>
Hi everyone
<Ecco_>
I'm writing a test where I need to define a class
<banisterfiend>
Ecco_: Class.new
friskd has joined #ruby
<Ecco_>
how can I destroy the class afterward ?
davidw has joined #ruby
mensvaga has quit [Quit: Leaving.]
<banisterfiend>
Ecco_: just assign the class to a local,and it'll die when it goes out of scope
<Ecco_>
sweet
<Ecco_>
so a = Class.new do
<Ecco_>
end
<Ecco_>
?
davidw is now known as Guest72442
<lectrick>
banisterfiend/shevy : a simple require enhancement: make it check a Hash, where the key is the hash of the absolute path to the file and the value is an array of the last modified time and any modules or classes defined in it
<banisterfiend>
lectrick: require has been enhanced in the funnyfalcon patches
<jrajav>
fbernier: => [1, nil, 2, 3, 4]
<banisterfiend>
i'm not sure what approach he used
<yxhuvud>
fbernier: I have already answered you.
<fbernier>
jrajav: I'd like to keep the nil in place
<lectrick>
and only do the require if the path hash doesn't exist, or if it exists but the file has been modified since it was recorded.
Paul-Atreides is now known as enroxorz
<jrajav>
Yeah what didn't work about yxhuvud's method
NotreDev has joined #ruby
<lectrick>
banisterfiend: i could look up what he did
<Ecco_>
banisterfiend: Excellent, it worked
<Ecco_>
thanks a lot :-)
<yxhuvud>
(the second one. the first had a bug)
<banisterfiend>
Ecco_: np
mdhopkins has joined #ruby
<Ecco_>
I can't believe how fast you answered :-)
<fbernier>
yxhuvud: I think I pinged time out and didn't see your second method
<Ecco_>
I've been googling this for like 30 minutes before asking
<Ecco_>
:-)
<yxhuvud>
[22:10] <yxhuvud> oops. my solution should have been a.zip(b).map {|el_a, el_b| el_a || el_b}
<lectrick>
Oh my other idea was to maintain a separate global hash of namespaced class/module names pointing to an array of all the files that opened that class or module, in the order they were loaded (although you could construct this info using the idea I already mentioned)
<banisterfiend>
Ecco_: unfortunately google is not a very good natural langauge parser yet
psycho_one has quit [Ping timeout: 245 seconds]
<fbernier>
yxhuvud: Cool I really didnt see this pass. Thank you I'll try this out
randym has joined #ruby
<Ecco_>
indeed :-)
Konboi_ has quit [Remote host closed the connection]
minijupe has joined #ruby
AlbireoX`Laptop has quit [Remote host closed the connection]
xaxisx has left #ruby [#ruby]
minijupe has left #ruby [#ruby]
<jrajav>
Google needs to buy Wolfram Alpha :(
enroxorz is now known as enroxorz[soon-to
enroxorz[soon-to is now known as enroxorz[zzz]
xaxisx has joined #ruby
<fbernier>
yxhuvud: Does exactly what it should. Thanks again.
nisstyre has joined #ruby
looopy has quit [Remote host closed the connection]
G has quit [Remote host closed the connection]
G has joined #ruby
rippa has quit [Ping timeout: 244 seconds]
enroxorz[zzz] is now known as enroxorz[0]
banisterfiend has quit [Read error: Connection reset by peer]
<lectrick>
wait, modules can't inherit from other modules? how did I not know this till now?
enroxorz[0] has left #ruby ["Leaving"]
theRoUS has joined #ruby
theRoUS has joined #ruby
theRoUS has quit [Changing host]
<shevy>
lectrick modules are like crippled classes
<lectrick>
indeed
d34th4ck3r has quit [Remote host closed the connection]
<shevy>
I used to think modules are mostly used because you group things into the same namespace
banister_ has joined #ruby
<shevy>
module Foo; class Bar
<shevy>
then I saw that apeiros_ did class Foo; class Bar
fbernier has quit [Ping timeout: 246 seconds]
<shevy>
when I asked him, he said the latter gave him more options
<shevy>
so now, I still wonder why we even have modules at all in ruby ... :(
demian`_ has joined #ruby
anildigital_work has joined #ruby
<apeiros_>
shevy: because classes can't be included
<banister_>
shevy: mixins
<apeiros_>
I prefer including over inheritance in most situations
<TTilus>
my rule of thumb is to use include and composition
Amnesia has left #ruby [#ruby]
Bosma has quit [Ping timeout: 244 seconds]
<TTilus>
deep inheritance hierarchies make things prittle
<TTilus>
thats my experience
davidpk has joined #ruby
rmascarenhas has quit [Quit: leaving]
<apeiros_>
inheritance also has many pitfalls
<apeiros_>
does a Square inherit from a Rectangle or the Rectangle from the Square?
<jrajav>
They both inherit from Shape, duh
mnaser has joined #ruby
AlbireoX`Laptop has joined #ruby
azm has quit [Ping timeout: 248 seconds]
robdodson has joined #ruby
zeromodulus has joined #ruby
kylemcgill has joined #ruby
<TTilus>
but where doe dot inherit from?
<jrajav>
That classic OO "debunking" example assumes that you have a reason to establish a hierarchy between Square and Rectangle (or the more standarad Circle and Ellipse) in the first place. It only shows that some people have trouble applying OO, or overapply it, not that OO is somehow fundamentally flawed
<apeiros_>
from Apeiron, of course
<apeiros_>
since everything derives from it
<TTilus>
or is it jus zero-radius jrajav?
carloslopes has quit [Quit: Leaving]
<apeiros_>
jrajav: agreed.
<jrajav>
TTilus: Why have you assumed that the Shape generic needs more than one vertex, or any volume? ;)
<TTilus>
jrajav: oo is more than inheritance, actually its mostly other things than inheritance :)
<jrajav>
I know. And OO isn't everything, either
<TTilus>
and inheritance has good amount of legit uses
<jrajav>
Inheritance tends to get the most attention since it's one of the main "business reasons" to use a language that implements OOP
awarner has quit [Remote host closed the connection]
notbrent has joined #ruby
<TTilus>
from my experience i have noticed i (it might be just me) do more robust designs when doing less inheritance and more modules and composition
<jrajav>
Yup yup
<jrajav>
Lots of developers get too caught up in inheritance frenzy and forget about good decoupling
<jrajav>
Kind of ironic
<TTilus>
"business reason" is a smell in itself =D
sepp2k has quit [Remote host closed the connection]
<jrajav>
"Code reuse" and such
stephenjudkins has joined #ruby
<kirun>
Requirements change enough inside a project, never mind reusing any of it.
<TTilus>
component based silver bulletization
<jrajav>
That's the best buzzword I've heard all week
fserb has quit [Quit: ttyl]
<TTilus>
thats so ninetees u know, last season
jrallison has quit [Ping timeout: 252 seconds]
ktilcu has quit [Quit: ktilcu]
hukl has quit [Ping timeout: 245 seconds]
<TTilus>
now its silver cloud bullet paas html5zy nodeization
<bricker88>
Sorry to crosspost but I didn't get any response in #ror… just having a strange issue with cucumber/controller inheritance that I'm hoping someone can shed some light on. https://gist.github.com/2884660 Maybe it's a question for the cucumber devs but I thought I'd ask anyways
jrallison has joined #ruby
<TTilus>
bricker88: tried #cucumber already?
<bricker88>
No, I will hop over there and ask as well
AlbireoX`Laptop has quit [Remote host closed the connection]
secondplanet has joined #ruby
<TTilus>
bricker88: in case david or aslak is online
<jrajav>
TTilus: I'm a scaling prototype-based mobile cloud silver bullet developer myself
rdesfo has joined #ruby
yxhuvud has quit [Ping timeout: 248 seconds]
<TTilus>
jrajav: u forgot event-based nonblockingness
<Sigma00>
and nosql
<TTilus>
omg we forgot nosql!
<jrajav>
no.sql
<jrajav>
node.sql?
<jrajav>
sql.io
<TTilus>
norwegian sql?
<jrajav>
Hey sql.io isn't registered :3
bfig has quit [Ping timeout: 245 seconds]
<TTilus>
wtflol?!
one8zero has joined #ruby
<TTilus>
that real?
<jrajav>
It doesn't load at least. I have no idea how to check .io names
<jrajav>
Godaddy doesn't have em :(
Gavilan has joined #ruby
sparrovv has joined #ruby
one8zero has quit [Client Quit]
mohits has quit [Read error: Connection reset by peer]
bglusman has quit [Remote host closed the connection]
<lectrick>
banister_: caller just returns an array equivalent to a stack trace
bglusman has joined #ruby
<lectrick>
banister_: that binding_of_caller looks very nice, almost like it should be stock ruby, although you don't recommend it for production apps :O
<banister_>
but i probably wouldnt use it in real code outside of debugging
Guedes has quit [Quit: Saindo]
telling has joined #ruby
tommyblue has quit [Quit: Coyote finally caught me]
okc_frie` has joined #ruby
blacktulip has quit [Remote host closed the connection]
zomgbie has quit [Ping timeout: 244 seconds]
cousine has joined #ruby
libertyprime has quit [Client Quit]
libertyprime has joined #ruby
cousine has quit [Remote host closed the connection]
okc_frienemy has quit [Ping timeout: 240 seconds]
jenrzzz-mac has quit [Quit: jenrzzz-mac]
iocor has quit [Quit: Computer has gone to sleep.]
telling has quit [Ping timeout: 245 seconds]
CannedCorn has joined #ruby
shadoi has quit [Remote host closed the connection]
vandemar has quit [Ping timeout: 260 seconds]
shadoi has joined #ruby
sridatta has joined #ruby
TrahDivad has quit [Quit: TrahDivad]
tommyvyo has joined #ruby
<sridatta>
hey all, i'm using EventMachine's `start_tls` to initiate an SSL client handshake but my server outputs this error: "SSL23_GET_CLIENT_HELLO:unknown protocol". Other language clients work. any clues?
adeponte has quit [Remote host closed the connection]
jenrzzz-mac has joined #ruby
chico_chicote has joined #ruby
flagg0204 has joined #ruby
mvangala_mac has joined #ruby
flagg0204 has quit [Client Quit]
fserb has quit [Quit: ttyl]
bluenemo has quit [Remote host closed the connection]
bluenemo has joined #ruby
bluenemo has quit [Changing host]
bluenemo has joined #ruby
demet8 has joined #ruby
Yarou has quit [Quit: Leaving]
bluenemo has quit [Client Quit]
Yarou has joined #ruby
Yarou has quit [Changing host]
Yarou has joined #ruby
joaoqalves has joined #ruby
zomb1e has quit [Quit: I'm tired. Real tired.]
uris has quit [Quit: leaving]
siksia has quit [Ping timeout: 256 seconds]
chienpo has quit [Quit: Leaving.]
flagg0204 has joined #ruby
trend has quit [Read error: Connection reset by peer]
trend has joined #ruby
ank has quit [Ping timeout: 260 seconds]
milestone has quit [Quit: milestone]
test34 has joined #ruby
kpshek has quit []
lkba has quit [Ping timeout: 245 seconds]
tatsuya_o has quit [Remote host closed the connection]
aantix has joined #ruby
siksia has joined #ruby
josefig has quit [Quit: Textual app]
test34- has quit [Ping timeout: 245 seconds]
theRoUS_ has quit [Ping timeout: 245 seconds]
IrishGringo has quit [Quit: ChatZilla 0.9.88.2 [Firefox 12.0/20120420145725]]
aantix has quit [Read error: Connection reset by peer]
oooPaul has quit [Quit: Ciao for now!]
sabooky has joined #ruby
ank has joined #ruby
mnaser has joined #ruby
mnaser has quit [Changing host]
mnaser has joined #ruby
ank has quit [Remote host closed the connection]
<sabooky>
If I have an erb template say... template = ERB.new "The value of x is: <%= x %> and y is: <%= y %>" how can I list the variables defined in that template? ex ["x", "y"]
<sabooky>
If ERB doesn't support this, do you guys know of a good templating language that does?
aantix has joined #ruby
IrishGringo has joined #ruby
<sabooky>
Writing a command line tool that allows the user to pass in values and to create files based on the templates.. want to error out to the user when he doesn't provide values.. and want to also be able to lookup the required values for a template and show that back to the user.
mikepack has quit [Remote host closed the connection]
khakimov has joined #ruby
minijupe has joined #ruby
kenneth has quit [Ping timeout: 250 seconds]
<heftig>
execute the template with a Binding where self is a Blank Slate that has method_missing
brianpWins has quit [Quit: brianpWins]
minijupe has quit [Client Quit]
<heftig>
have method_missing record which calls it sees
<heftig>
point is that "x" will call self#x when x is not a defined local variable
fivetwentysix has joined #ruby
tvw has quit [Remote host closed the connection]
baroquebobcat has quit [Quit: baroquebobcat]
xaq has quit [Remote host closed the connection]
<sabooky>
trying to do it.. quickly reading through the documentation (never used erb before)
nari has joined #ruby
<sabooky>
heftig: I think I got it..
<sabooky>
I created a small class with 2 methods, get_binding which returns binding
<sabooky>
And a method missing which puts the method that was called
<sabooky>
just for testing atm..
<sabooky>
is that what you meant?
vandemar has joined #ruby
kenneth has joined #ruby
billiamii has joined #ruby
<heftig>
probably. i never really delved into ERB myself
zenom has joined #ruby
<sabooky>
heftig: seems to work pretty good
<heftig>
nice.
<sabooky>
Not 100% sure how to do it with instance_exec
<sabooky>
could you give me a quick example of using that
<heftig>
foo.instance_exec { ... } runs the block with self set to foo
<sabooky>
oh, so I have to add method_missing to the template object
<heftig>
not sure what you mean
<zenom>
I have a file that has columns, but also has spaces, no quotes or commas. https://gist.github.com/c132bfa393bf57599f3b what is the best way to split that? Only way I could think of (which is a little more painful) is look for rows that start with letters and join them, then leave the number /date columns alone.
geekfactor has quit [Remote host closed the connection]
<sabooky>
heftig: ok, one last check.. I think I understand both now.. could you review if this makes sense: template = ERB.new "The value of x is: <%= x %> and z is: <%= z %>"; def template.method_missing(x) puts x end; template.instance_exec(template) {|t| t.run(binding)}
fbernier has joined #ruby
<sabooky>
although.. hmm I probably don't want to override method_missing on the template object.. since that might be destructive
Sheehan has quit [Quit: Sheehan]
<zenom>
heftig: would I use match with that?
nlc has joined #ruby
<sabooky>
heftig: hmm.. I actually need to head out of the office.. thanks for you help
<heftig>
zenom: yes.
<heftig>
sabooky: use another object with method_missing on it
libertyprime has quit [Quit: Lost terminal]
<heftig>
not the template object itself
<zenom>
heftig: I think that will work, thanks a ton.
<sabooky>
heftig: gotcha, thanks!
<zenom>
Haven't had to do much stuff with things like that
nat2610 has quit [Read error: Connection reset by peer]
vlad_starkov has quit [Remote host closed the connection]
<heftig>
sabooky: class CallPrinter < BasicObject; def method_missing(meth, *args, &blk); puts meth; end; end
libertyprime has joined #ruby
ringotwo_ has quit [Ping timeout: 252 seconds]
<heftig>
ah whoops
<heftig>
that won't work
<heftig>
needs to be ::Kernel.puts meth
Liothen_ has quit [Remote host closed the connection]
<bricker88>
There has to be a better way to do this, right? ["ModuleName", attrib.to_s.singularize.camelize].join("::").constantize
Liothen has joined #ruby
Liothen has quit [Changing host]
Liothen has joined #ruby
xaxisx has joined #ruby
theRoUS has joined #ruby
peregrine81 has quit [Quit: Goodbye.]
<heftig>
sabooky: class CallPrinter < BasicObject; def method_missing(meth, *args, &blk); ::Kernel.puts meth; end; def __binding; ::Kernel.binding; end; end