<banisterfiend>
Eiam: well that's what it is, and it's not particularly confusing about when it's valid, the rule is simple "last parameter in an argument list"
fbernier has quit [Read error: Connection reset by peer]
ehlu has joined #ruby
<Eiam>
sure, so glance at a function with 5 parameters enclosed in (), and it looks like 5 parameters
<Eiam>
but wait, its really the last parameter beacuse its all just one object
<Eiam>
anyway, I'm ranting. I see this all the time, have been staring at this contstruct for over a year and I *still* don't like it =) so there.
<banisterfiend>
Eiam: not really, because normal parameters dont look like that
<TheEmpty>
Eiam: no because they are tASSOC not objects
<banisterfiend>
Eiam: so you would not confuse them for normal parameters, at least i never did, and since you're the only one i've heard complaining about it, i guess it didnt confuse many other peole either
<TheEmpty>
^^^
<banisterfiend>
Eiam: why not what? :b => "a", :c => "d" don't look like normal parameters, so im not going to confuse them for such
jamescarr has joined #ruby
mmitchell has joined #ruby
dankest has quit [Quit: Leaving...]
<Eiam>
guess I don't see what you mean by the word normal
<banisterfiend>
Eiam: :b => "a" <---- normal parameters dont look like that
nicoulaj has quit [Remote host closed the connection]
<banisterfiend>
Eiam: they dont have a key/value association
sailias has quit [Quit: Leaving.]
pskosinski has quit [Quit: Learn Life's Little Lessons]
<Eiam>
banisterfiend: myFunc({:b => "a"}) looks suspciously like what you just posted
_bart has quit [Quit: _bart]
ffranz has quit [Quit: Leaving]
ekristen has joined #ruby
<banisterfiend>
Eiam: except it's enclosed in {} was are strikingly obvious
<banisterfiend>
which are*
mmitchell has quit [Remote host closed the connection]
joeycarmello has quit [Remote host closed the connection]
<Eiam>
right. its strikingly obvious when your data structure is a hash. so why break the rule and invent a new rule for some special case where you can define a hash without making it strikingly obvious? =0
<Eiam>
oh, thats right, DRY/magic it up when you can, more special rules
<banisterfiend>
Eiam: no, because they're a nice way of faking named parameters
_bart has joined #ruby
ekristen has quit [Client Quit]
karupanerura has quit [Excess Flood]
jimeh has quit [Quit: Computer has gone to sleep.]
<banisterfiend>
Eiam: adding real named parameters probalby required a significant amount of internal changes, these 'fake' naemd parameters are mostly good enough to tide us over until we get proper language support (which we get in 2.0)
<Eiam>
one of these days I'm going to find a language that I really really love, that just fits with my brain
<Eiam>
one day.
Goles has joined #ruby
<chrisftw_tired>
i ahve a simple question
<Eiam>
ruby is as close as i've come, but a lot of things about it still bother me =)
<chrisftw_tired>
how do I put speech marks inside a string array?
<Eiam>
I don't get the question, that works fine for me
<chrisftw_tired>
thanks
<banisterfiend>
Eiam: scala has a lot more than ruby, iirc
<chrisftw_tired>
but twitter doesnt like '
<chrisftw_tired>
it wants "
<chrisftw_tired>
(im using an api)
pskosinski has joined #ruby
<Eiam>
tried escaping them then? \"
<Eiam>
banisterfiend: I'm working my way through scheme atm
love_color_text has joined #ruby
x82_nicole has quit [Quit: Computer has gone to sleep.]
<chrisftw_tired>
["\"Eliam\""]
joofsh has quit [Remote host closed the connection]
<apeiros_>
Eiam: are you hand-crafting JSON?
* Quadlex
shudders
<apeiros_>
if so: STOP DOING THAT. use a JSON library. one even comes with ruby.
<Eiam>
apeiros_: haha, as it so happens I am currently hand crafting what is translated into JSON via "fake named parameters"
<apeiros_>
in that case, see last message.
_bart has quit [Quit: _bart]
<Eiam>
but its merely to prototype an idea as I tweak if its even possible. once i work out of its possible, the machine will totally generate it for me =)
<apeiros_>
yeah, even then. it's a bad idea. don't do it.
<Eiam>
so yes, this annoyance will go away as soon as I'm done prototyping to see if it works =)
<apeiros_>
using a proper json library is easier anyway.
jlast has joined #ruby
jamescarr has quit [Quit: jamescarr]
jamescarr has joined #ruby
kokainepizza has quit [Quit: My pooter is sleep.]
<Eiam>
*shrug*
<Eiam>
I'm not going to bust out a json library to twiddle with a single line of code and a single function call
<apeiros_>
oh dear
<apeiros_>
because `require 'json'` is so hard. have fun with your broken output.
blazes816 has joined #ruby
<waxjar>
there's a json library in the std. lib.
Chryson has quit [Quit: Leaving]
jlast has quit [Ping timeout: 244 seconds]
<waxjar>
basically turns hashes into json and vice versa.
<Eiam>
okay so you suggest I just say myFunc({:a =>"b"}.to_json) instead of doing myFunc(:a => "b") ?
<apeiros_>
no
<Eiam>
later on myFunc (which technically isn't mine, its another library function someone else wrote, calls args.to_json anyway..
<apeiros_>
I suggest that wherever you handcraft json, you use .to_json instead.
yshh has joined #ruby
jeffreybaird has joined #ruby
<Eiam>
and again, thats what I just showed as an example then. my hand crafted json being to_json'd
<atmosx>
shit
<Eiam>
and you said no..
<atmosx>
almost 3:00 am
<atmosx>
Good night fellow rubyistS! :-)
dankest has joined #ruby
atmosx has quit [Quit: And so the story goes…]
<apeiros_>
walltalk. pointless. as said, have fun with your broken output.
nricciar has quit [Ping timeout: 245 seconds]
<Eiam>
I just don't get what you are suggesting, I just gave an example of what I thought you said, and you said no thats not what I said
<Eiam>
then said the same thing I just said, so yeah, clearly walltalk
<the_jeebster>
who has the right to tell you what you can and can't be doing at the end of the day. it's just an advantage of power at the end of the day
<the_jeebster>
humans weren't meant to be 'governed'
<Eiam>
and you said I was young or on drugs...
<the_jeebster>
ha, whatever. seriously. why should I go to jail if I feel like peeing out in the woods and somebody calls the authorities?
Umren|2 has quit [Read error: Connection reset by peer]
<Eiam>
I didn't say you should go to jail for peeing in the woods =0
<the_jeebster>
no but the government does
<blazes816>
i was wondering where you were last weekend jeebster
<the_jeebster>
this is why I like portugal for certain social standpoints. fiscal, not so much
<ossareh>
'lo. I think I'm being super dense - I'm not clear on how to create a method on an object that can be called in both the static and non-static manner.
mtweiou has quit [Quit: Page closed]
Goles has joined #ruby
jblack has quit [Ping timeout: 244 seconds]
wallerdev has quit [Quit: wallerdev]
<ossareh>
ah, nvm - I am being dense :D
wallerdev has joined #ruby
v0n has joined #ruby
horofox has quit [Quit: horofox]
ltsstar has quit [Quit: ltsstar]
pavilionXP has joined #ruby
pavilionXP__ has quit [Read error: Connection reset by peer]
<shevy>
ossareh static and non static?
asteve has joined #ruby
<shevy>
perhaps you mean "def foo" vs. "def self.foo"
joeycarmello has joined #ruby
<Eiam>
vs class << self def foo ?
SeanLazer has quit [Quit: SeanLazer]
Goles has quit [Ping timeout: 252 seconds]
thufir_ has quit [Quit: Leaving.]
tommyvyo has quit [Quit: Computer has gone to sleep.]
Xeago has quit [Remote host closed the connection]
SeanLazer has joined #ruby
<banisterfiend>
Eiam: def self.foo is more or less equivalent to class << self def foo ;)
<Eiam>
#ruby was not mentioned however =( only #rails
<Eiam>
banisterfiend: I know =p except when its not equivalent
<Eiam>
i've forgot whatever that special case was and decided that class << self works best for how I think so that what I use
asteve has quit [Changing host]
asteve has joined #ruby
pavilionXP__ has joined #ruby
pavilionXP has quit [Read error: Connection reset by peer]
alexspeller has quit [Remote host closed the connection]
pavilionXP__ has quit [Max SendQ exceeded]
mmokrysz has joined #ruby
<Eiam>
banisterfiend: no need to elucidate the answer, I've read more than one article about the difference more than once, i just forget stuff like that after awhile.
io_syl has quit [Ping timeout: 272 seconds]
Kuifje has quit [Ping timeout: 255 seconds]
JarJar has quit [Quit: Leaving]
<banisterfiend>
Eiam: you can set visibility and aliases etc inside a class << self
<Eiam>
I'm sure details like that help with mastery. I can't help but let things like that slide out of my brain, I rarely have to deal with the alternative forms, and the answer to refresh the difference is a quick google away
lateau has quit [Remote host closed the connection]
lateau` has joined #ruby
alexspeller has joined #ruby
alexspeller has quit [Read error: Connection reset by peer]
nkts has quit []
mmitchell has joined #ruby
mmokrysz has quit [Quit: Leaving.]
io_syl has joined #ruby
RagingDave has quit [Quit: Ex-Chat]
ryanh has joined #ruby
<shevy>
is there a general simple way to split up a file into subsections ... nothing but based on identifiers, that are the headers
nopper has quit [Ping timeout: 260 seconds]
hotovson has quit [Remote host closed the connection]
<shevy>
like ... "NOTE 1\n we have to eat chicken \nblabla NOTE 2\n chicken is good"
joofsh has joined #ruby
<shevy>
like, split that file into "NOTE" keyword subsections hmm
iamjarvo has quit [Ping timeout: 248 seconds]
nopper has joined #ruby
jjbohn has joined #ruby
iamjarvo has joined #ruby
Virunga has quit [Remote host closed the connection]
<Quadlex>
...Sigh
hotovson has joined #ruby
<Quadlex>
When did Apple discontinue airline adapters?
alanjc has joined #ruby
jblack has joined #ruby
<waxjar>
shevy, read the full file into a string, then call split on it? or is that too naive
zeade has joined #ruby
ryez has quit [Ping timeout: 240 seconds]
hotovson has quit [Ping timeout: 248 seconds]
shevy has quit [Ping timeout: 248 seconds]
dhruvasagar has joined #ruby
pskosinski has quit [Quit: Learn Life's Little Lessons]
bbloom has quit [Ping timeout: 248 seconds]
yoshie902a has joined #ruby
smarx007 has quit [Ping timeout: 260 seconds]
jjbohn has quit [Quit: Leaving...]
lateau` has quit [Read error: Connection reset by peer]
<yoshie902a>
What code would convert this text/string into a nested hash? I'm not sure how to deal with the nesting. http://pastie.org/5619195
samphippen has quit [Quit: Computer has gone to sleep.]
smarx007 has joined #ruby
<apeiros_>
yoshie902a: looks like ordinary yaml
<apeiros_>
ie., YAML.load, or YAML.load_file
<yoshie902a>
apeiros_: unfortunately, I tried and it's not yaml
<apeiros_>
then I'd find out what format it is
<apeiros_>
else, look into StringScanner (part of stdlib)
<apeiros_>
(else = if all else fails)
<yoshie902a>
apeiros_: it's just a standard format, plus or minus fields from a government filing
cableray has joined #ruby
<apeiros_>
"standard format" means nothing. you need a name if you want to find an existing lib for it.
lateau has joined #ruby
jrist is now known as jrist-afk
<yoshie902a>
apeiros_: There is no lib for it. I need to figure out the logic to write the code. "standard" in terms of all the filings are formatted the same.
Goles has joined #ruby
<apeiros_>
ok
love_color_text has quit [Remote host closed the connection]
smarx007 has quit [Ping timeout: 244 seconds]
<apeiros_>
yoshie902a: btw., works fine if you substitute the leading tabs with 2 spaces
<yoshie902a>
havenn: when I converted to YAML, I got this http://pastie.org/5619536, not really a clean looking hash that I was looking for. I used Psych.parse(c) c is my string
xpen_ has quit [Ping timeout: 248 seconds]
locriani has quit [Read error: Connection reset by peer]
xpen_ has joined #ruby
locriani has joined #ruby
otters has quit [Remote host closed the connection]
elico has joined #ruby
fungoat has joined #ruby
xpen has quit [Ping timeout: 276 seconds]
cha1tanya has joined #ruby
jamescarr has joined #ruby
yaroslav has quit [Quit: yaroslav]
<havenn>
yoshie902a: The ALLCAPs string thing is you are starting with is an odd format. >.> This at least gets it down to symbols and strings, but you still need to parse it into a nested Hash: a.squeeze("\t").split("\t").map { |s| s.end_with?(':') ? s.gsub(' ', '_').downcase.delete(':').to_sym : s }
<havenn>
s/is you/that you/
theRoUS has quit [Ping timeout: 248 seconds]
bigmac has quit [Quit: Leaving]
jduan1981 has quit [Ping timeout: 248 seconds]
zeade has joined #ruby
otters has joined #ruby
<yoshie902a>
havenn: what is s/is you/ that you/?
<havenn>
yoshie902a: Oh, just shorthand correction. I wrote 'is you' above but meant 'that you'.
<yoshie902a>
never mind, got it sub
<yoshie902a>
I tried but it does not seem to work.
x82_nicole has joined #ruby
<yoshie902a>
it just creates an array
x82_nicole has quit [Client Quit]
zeade has quit [Client Quit]
MattRb has quit [Quit: MattRb]
mjolk has quit [Quit: returning some videotapes]
maletor has joined #ruby
xpen has joined #ruby
<havenn>
yoshie902a: Yeah, if it was a flat hash you could just do Hash[array] with the array, but you've got hashes within hashes so you'd have to have some logic to parse the array into a nested hash.
<havenn>
yoshie902a: I didn't see it was nested through all the caps and \t's until I parsed it. :P
<yoshie902a>
havenn: the logic is what I'm having trouble with.
cyong has joined #ruby
Takehiro has joined #ruby
<yoshie902a>
Yah, I noticed you squeezed the "\t", so you wouldn't see the nesting
<shevy>
I don't even get it... they got rid of /etc/inittab, yet in the replacement, the script refers to it still
<shevy>
a_a_g I think some sed replacement going on there
<shevy>
"# Check for default runlevel in /etc/inittab"
benlieb has quit [Quit: benlieb]
<shevy>
why do they get rid of inittab in the first place, yet still refer to it ...
<a_a_g>
its not going to work if there is no inittab file there
<a_a_g>
its probably an artifact left over
<shevy>
yeah
<shevy>
it's not really important, it just annoys me
<a_a_g>
i rarely touch inittab et al manually
koshii has joined #ruby
<shevy>
there is no inherent beauty in any of that
<shevy>
I mean, in the whole of linux...
<a_a_g>
ah yes. thats true
<a_a_g>
give freebsd a try. they keep things simple
elico has joined #ruby
<shevy>
I am going to eventually!
yacks has quit [Ping timeout: 276 seconds]
<shevy>
unfortunately, linux seems to allow much more tinkering...
<a_a_g>
linux is a unix clone for the 386 created by i386 hackers. freebsd is a unix for the 386 created by unix hackers
<shevy>
I liked linux from scratch (minus the time one had to invest)
<shevy>
yeah but I am not a hacker, I am clueless. I am a tinker, I kick on things until they work or fail
<shevy>
with ruby it works very well so far
ks` has joined #ruby
sambio has quit []
<a_a_g>
if you just want to configure the runlevels, you can use sysv-rc-conf
<shevy>
hmm, apt-get install it?
<shevy>
ok did that
infinitiguy has quit [Quit: Leaving.]
<shevy>
sysv-rc-conf
<shevy>
Segmentation fault
Hanmac_ has quit [Ping timeout: 245 seconds]
<shevy>
but the latter one is my fault ;)
a_a_g has quit [Quit: Leaving.]
jlast has quit [Ping timeout: 248 seconds]
browndawg has joined #ruby
stevechiagozie has joined #ruby
sayan has joined #ruby
cascalheira has quit [Ping timeout: 248 seconds]
elico has quit [Remote host closed the connection]
jrajav has quit [Quit: I tend to be neutral about apples]
cj3kim has joined #ruby
elsifaka has joined #ruby
stevechi1gozie has joined #ruby
mpfundstein has joined #ruby
joeycarmello has joined #ruby
stevechi1gozie has quit [Client Quit]
<davidokner>
Which was the online Ruby training compnay that gives you those little trophies to show your ability to employers to show you can program?
love_color_text has quit [Remote host closed the connection]
elsifaka has quit [Quit: Veloma e!]
akl_ has joined #ruby
dawkirst has left #ruby [#ruby]
dawkirst has joined #ruby
vlad_starkov has quit [Remote host closed the connection]
mengu has joined #ruby
cdt has joined #ruby
guns has joined #ruby
yshh has quit [Remote host closed the connection]
mjolk has joined #ruby
pcarrier has joined #ruby
mjolk is now known as Guest59052
blacktulip has joined #ruby
kloeri_ is now known as kloeri
robbyoconnor has quit [Ping timeout: 255 seconds]
r0bby has joined #ruby
r0bby is now known as robbyoconnor
Fox_candy has joined #ruby
lkba has quit [Quit: Bye]
mrdtt has quit [Ping timeout: 252 seconds]
hamfz__ has quit [Ping timeout: 248 seconds]
lateau` has joined #ruby
jlast has joined #ruby
h4mz1d has quit [Ping timeout: 248 seconds]
lateau` has quit [Read error: Connection reset by peer]
havenn has joined #ruby
AlbireoX has quit [Remote host closed the connection]
guns has quit [Quit: guns]
lolcathost has joined #ruby
AlbireoX has joined #ruby
Takehiro has joined #ruby
Guest59052 has quit [Quit: This computer has gone to sleep]
lateau has joined #ruby
browndawg has quit [Ping timeout: 248 seconds]
lateau has quit [Read error: Connection reset by peer]
browndawg has joined #ruby
lateau has joined #ruby
methoddk has joined #ruby
AlbireoX has quit [Ping timeout: 240 seconds]
krz has quit [Quit: krz]
ehlu has quit [Quit: WeeChat 0.3.8]
ehlu has joined #ruby
Solnse2 has joined #ruby
Solnse has quit [Ping timeout: 264 seconds]
mailo has joined #ruby
ehlu has quit [Client Quit]
ehlu has joined #ruby
havenn has quit [Ping timeout: 265 seconds]
pwelch has joined #ruby
pwelch has quit [Client Quit]
jlast has quit [Ping timeout: 264 seconds]
norc has joined #ruby
<norc>
Are there any sleek lightweight markup languages like haml/slim but where whitespace is not relevant?
alexspeller has joined #ruby
browndawg has quit [Read error: Connection reset by peer]
Fox_candy has quit [Read error: Connection reset by peer]
<norc>
Other than erb ;)
<norc>
(which really isnt a markup language anyway)
tanathos has joined #ruby
tanathos has left #ruby [#ruby]
vlad_starkov has joined #ruby
peter_paule has joined #ruby
peter_paule has quit [Client Quit]
Driscoll has joined #ruby
fyolnish has quit [Remote host closed the connection]
lateau has quit [Ping timeout: 248 seconds]
jonahR_ has joined #ruby
karasawa has quit [Ping timeout: 264 seconds]
karasawa has joined #ruby
jonahR has quit [Ping timeout: 255 seconds]
jonahR_ is now known as jonahR
dennis_ has joined #ruby
hotovson has quit [Remote host closed the connection]
Solnse2 has quit [Ping timeout: 248 seconds]
<Paradox>
norc, markdown
<apeiros_>
markdown is whitespace sensitive
lkba has joined #ruby
<Paradox>
doh yeah it is
xandy is now known as xAndy
Kuifje has joined #ruby
cha1tanya has quit [Read error: Connection reset by peer]
jlast has joined #ruby
cha1tanya has joined #ruby
joeycarmello has quit [Ping timeout: 248 seconds]
browndawg has joined #ruby
ryez1 has joined #ruby
Takehiro has quit [Remote host closed the connection]
Spami has joined #ruby
Spami has quit [Changing host]
Spami has joined #ruby
emergion has joined #ruby
blaxter has joined #ruby
io_syl has quit [Quit: Computer has gone to sleep.]
Driscoll has quit [Ping timeout: 276 seconds]
wermel has joined #ruby
Astral_ has joined #ruby
jlast has quit [Ping timeout: 248 seconds]
Astralum has quit [Ping timeout: 264 seconds]
Virunga has joined #ruby
Xeago has joined #ruby
vlad_starkov has quit [Remote host closed the connection]
includex has joined #ruby
berserkr has quit [Ping timeout: 248 seconds]
koshii has joined #ruby
jds has quit [Remote host closed the connection]
subbyyy has joined #ruby
wallerdev has quit [Quit: wallerdev]
horofox has joined #ruby
kerozene has joined #ruby
jonahR has quit [Quit: jonahR]
joeycarmello has joined #ruby
wreckimnaked has quit [Read error: Operation timed out]
horofox has quit [Quit: horofox]
Takehiro has joined #ruby
dawkirst has quit [Read error: Connection reset by peer]
<kerozene>
not sure if this problem is specific to compass so let me know if it's the wrong channel. basically, a gem I just installed can't be found: http://pastie.org/private/xlzfp99zv4btnswdsb8adq (compass-normalize)
<kerozene>
any ideas?
dawkirst has joined #ruby
kn330 has joined #ruby
lateau has joined #ruby
Takehiro has quit [Ping timeout: 240 seconds]
sepp2k has joined #ruby
Yaku has quit []
jlast has joined #ruby
cha1tanya has quit [Ping timeout: 248 seconds]
hack has quit [Ping timeout: 248 seconds]
pen has joined #ruby
fyolnish has joined #ruby
larssmit has joined #ruby
pavilionXP has quit [Quit: Forget progress by proxy. Land on your own moon.]
pavilionXP has joined #ruby
matip_ has joined #ruby
<matip_>
Hello guys
fyolnish has quit [Read error: Connection reset by peer]
<clocKwize>
I'm having massive amounts of trouble moving the table to the left!
<clocKwize>
to the right*
<ccooke>
dpg: your regex is broken
<clocKwize>
i want 2 tables next to each other
<dpg>
ccooke: thanks for pointing that out!
Squarepy has joined #ruby
<dpg>
ccooke: It's 4am here, mind showing me where? :\
Squarepy has quit [Changing host]
Squarepy has joined #ruby
jds has joined #ruby
<ccooke>
dpg: the square brackets. Your regex actually says "match any one character in the set '\~video src="(.+)"\~'
<dpg>
oh god. you're right. hahahaah
<ccooke>
dpg: hence t only returning a v
Takehiro has joined #ruby
<dpg>
but now m is passing in the entire string, and not just the interpolate
<dpg>
from the (.+)
<dpg>
how do I use the interpolate \1 inside the block? am I missing something obvious?
<dpg>
or how do I just pass the first interpolate into the block?
Squarepy has quit [Read error: Connection reset by peer]
<dpg>
or do I have to perform another regexp on it?
<dpg>
ccooke: thanks for your help. I'll figure this out I guess. :)
jlast has quit [Ping timeout: 260 seconds]
hack has joined #ruby
josemota has joined #ruby
berserkr has joined #ruby
mjolk has joined #ruby
mjolk is now known as Guest90672
eka has joined #ruby
josemota has quit [Client Quit]
statarb3 has joined #ruby
statarb3 has quit [Changing host]
statarb3 has joined #ruby
<ccooke>
dpg:no problem :-)
jonahR has joined #ruby
Goles has joined #ruby
Squarepy has joined #ruby
<Hanmac>
dpg you need $1 ?
<dpg>
oh god. you're awesome.
<dpg>
Hanmac: you win.
qb has joined #ruby
<dpg>
ccooke: you win too!
<dpg>
thanks a ton. :)
Squarepy has quit [Changing host]
Squarepy has joined #ruby
<dpg>
Is there a particular reason ruby just doesn't use \1 again?
whitedawg has joined #ruby
<apeiros_>
\1 is not a variable
<matip_>
I have a few auto generated regexps like /a(.)c/ and /b(.)/ and a string like "abc". I want to get "b" but also "c". do you know any way to achieve that?
<apeiros_>
would need new syntax for no good reason
<matip_>
right now I'm doing (?:a(.)c|b(.)). but it don't work as I expect in some cases as the one mentioned above ^
<matip_>
it doesn't work *
jwang has quit [Ping timeout: 248 seconds]
* apeiros_
really wants to setup a bot which smacks everybody who says "doesn't work"
jwang has joined #ruby
<bnagy>
or regexp
<dpg>
mtfk: /a[bc]/
<dpg>
matip_: /a[bc]/
Guest90672 has quit [Ping timeout: 255 seconds]
<dpg>
the brackets say "grab anything in here"
<matip_>
dpg, it's autogenerated, I can't fusion it that easily
<matip_>
apeiros_, it doesn't, try it ;)
jonahR has quit [Quit: jonahR]
<Squarepy>
matip_, you don't try ;)
<apeiros_>
bnagy: well, since rubys class is named Regexp, that's excusable IMO
<matip_>
think about it like that: a = 'a(.)c'; b = 'b(.)'; str = 'abc'; ...
<apeiros_>
matip_: "it doesn't work" is a horribly bad problem description and you should really do better than that.
billy_ran_away has quit [Ping timeout: 248 seconds]
<apeiros_>
srsly
beneggett has quit [Ping timeout: 248 seconds]
SiegeX has quit [Ping timeout: 248 seconds]
segv- has joined #ruby
<matip_>
doesn't work means, it doesn't match what I want to retrieve
<apeiros_>
"it doesn't work" can mean about everything from "my computer explodes when I do it" to "I go blind by the output"
<bnagy>
apeiros_: oh I just mean that about 95% of the people asking for regexp help are just doing it completely wrong in the first place
<apeiros_>
matip_: no, "doesn't work" does NOT mean "it doesn't match"
dpg has left #ruby [#ruby]
<apeiros_>
1+"hi" doesn't work - oh you mean it doesn't match?
<apeiros_>
bnagy: ah
<matip_>
it's obvious what it means provided I put the regexp and the string being used
<apeiros_>
matip_: NO it's not
beneggett has joined #ruby
<apeiros_>
but hey, I can give you obvious help: you're doing it wrong
SiegeX has joined #ruby
yoshie902a has joined #ruby
<matip_>
nice, I reached the same conclusion :P
<apeiros_>
or: you should do it right
<apeiros_>
of course it's obvious what "do it right" means in this context
<bnagy>
matip_: requests for help should go I am doing X and I want to to do Y but it's doing Z instead
<apeiros_>
so there's no need for me to elaborate.
Gooder has joined #ruby
billy_ran_away has joined #ruby
<matip_>
bnagy, well, I already said I'm doing X, want to get Y but it's not working like that
mjolk2 has joined #ruby
Elhu has quit [Quit: Computer has gone to sleep.]
<bnagy>
also, simplified regexp questions are almost always useless
<matip_>
a = 'a(.)c'; b= 'b(.)'; str = 'abc'
<bnagy>
but anyway, what's your input and what output do you want?
<matip_>
I want "b" and "c" back
<matip_>
my first try was to combine both regexps like that: /(?:a(.)c|b(.))/
<bnagy>
those two expressions _will_ match 'b' and 'c'
<matip_>
(I have more than two regexps and they don't always intersect)
<matip_>
> "abc".scan /(?:a(.)c|b(.))/
<matip_>
=> [["b", nil]]
<bnagy>
run them in sequence
<bnagy>
signs your regexp is stupid - ? and |
Virunga has quit [Remote host closed the connection]
<matip_>
sure, but if you run them in sequence you have another problem...
<bnagy>
that it will work? I hate that problem
<bnagy>
also that as it gets complex it is 95% likely to be faster? Sucks too.
stevechiagozie has joined #ruby
<matip_>
/(.)bc/ /(.)b/ "abc"
<matip_>
you don't want "a" twice
<apeiros_>
s/you/I/
<bnagy>
run uniq on the array then
<bnagy>
Not. That. Hard.
fermion has joined #ruby
<bnagy>
anyway I need to go do something useful like make dinner o/
<matip_>
...it just won't work in the real case. I can show you more cases in which your solution sucks
<matip_>
never mind..
jlast has joined #ruby
<apeiros_>
don't worry, I stopped minding when I realized that your problem description won't go beyond "no work! y?!"
norc has quit [Read error: Connection reset by peer]
rasmusth_ has quit [Quit: leaving]
wreckimnaked has joined #ruby
hack is now known as harsh
harsh is now known as hack
joeycarmello has quit [Ping timeout: 255 seconds]
mikecmpbll has quit [Quit: Computer has gone to sleep.]
Takehiro has quit [Remote host closed the connection]
hack has quit [Quit: WeeChat 0.3.9.2]
nomenkun has joined #ruby
JonnieCache has joined #ruby
lolcathost has quit [Quit: brb gaize]
lolcathost has joined #ruby
eykosioux_ has joined #ruby
ryanh has quit [Quit: Computer has gone to sleep.]
jlast has quit [Ping timeout: 248 seconds]
Takehiro has joined #ruby
landho has quit [Read error: Connection reset by peer]
assurbanipal has quit [Read error: Connection reset by peer]
nomenkun has quit [Ping timeout: 260 seconds]
landho has joined #ruby
postmodern has quit [Quit: Leaving]
pavilionXP has quit [Ping timeout: 240 seconds]
dennis_ is now known as koderde
jslowe has joined #ruby
pavilionXP has joined #ruby
Xeago has quit [Remote host closed the connection]
Zai00 has joined #ruby
<kerozene>
not sure if this problem is specific to compass so let me know if it's the wrong channel. basically, a gem I just installed can't be found: http://pastie.org/private/xlzfp99zv4btnswdsb8adq (compass-normalize) any ideas?
v0n has joined #ruby
Xeago has joined #ruby
<Hanmac>
kerozene do you use bundler or something like that?
Virunga has joined #ruby
<kerozene>
nope
samuel02 has joined #ruby
mmitchell has joined #ruby
felipe has joined #ruby
<kerozene>
$ bundle / rbenv: bundle: command not found / The `bundle' command exists in these Ruby versions: / 1.9.2-p290
wereHams1er is now known as wereHamster
wereHamster has quit [Changing host]
wereHamster has joined #ruby
<Hanmac>
keroszene you could try to ask in the sass channel #sass
<kerozene>
good idea. thanks
ryez1 has left #ruby [#ruby]
mikecmpbll has joined #ruby
cha1tanya has joined #ruby
<waxjar>
kerozene, are you using rubinius perhaps?
<kerozene>
nope
joeycarmello has joined #ruby
alexander___ has joined #ruby
<waxjar>
ah ok. i ran into the exact same error last night with rubinius, sadly i haven't been able to fix it
<kerozene>
rats
<alexander___>
Is there a specific data structure for storing ip addresses + ports (sth like InetSocketAddress in Java)?
<alexander___>
Well, I need to store the port number, too...
Neomex has joined #ruby
willob has joined #ruby
Neomex has quit [Client Quit]
Neomex has joined #ruby
Neomex has quit [Client Quit]
jlast has joined #ruby
<Hanmac>
use an array [addr,port]
<waxjar>
Struct.new :ip, :port
<samuel02>
I'm constructing a graph and need two simple object to represent a vertex and an edge, I did this: https://gist.github.com/4452424 , but it turns out to not be a very smart structure due to cross referencing
<samuel02>
what's a smarter way of doing it?
stevechiagozie has quit [Quit: Computer has gone to sleep.]
<alexander___>
Ok, well that's not as elegant as in Java, but ok :(
<csmrfx>
but have yet to find the ruby-literal-mixin-pureness
<Hanmac>
its Class: all the way down :D
billy_ran_away has quit [Ping timeout: 264 seconds]
<csmrfx>
alexander___: you can compare, but basically I wanted to bring up literal style programming and mix-ins
<csmrfx>
which is what JonnieCache perhaps would like to work with
<apeiros_>
csmrfx: you can do {foo: ->{ …code… }, bar: "value"} in ruby too
<csmrfx>
(not sure if it can be called "literal style programming", actually)
<apeiros_>
but it suffers from the same deficiencies as in js too
<apeiros_>
monkey-patch Hash and you can then even do: o.foo.()
alexander___ has quit [Quit: Page closed]
<csmrfx>
apeiros_: you can't actually quite do that in javascript
Jackneill has joined #ruby
Jackneill has quit [Changing host]
Jackneill has joined #ruby
<apeiros_>
o0
billy_ran_away has joined #ruby
<apeiros_>
of course you can…
<csmrfx>
although you can place function references as values in a hash
<apeiros_>
o = {foo: function() { …code… }}; o.foo()
<csmrfx>
same way as you could place a block as a value in ruby, yes
SeySayux has quit [Read error: Connection reset by peer]
Villadelfia has quit [Read error: Connection reset by peer]
<apeiros_>
ruby equiv: o = {foo: ->{ …code… }}; o.foo.()
niklasb has joined #ruby
<apeiros_>
that's the core principle of js…
<csmrfx>
apeiros_: except you cant put ...code... there, only a function definition or reference in js
<apeiros_>
not sure what you mean by that…
<csmrfx>
anyway, I am nitpicking
<apeiros_>
that's how it works everywhere…
<apeiros_>
it's no different in ruby either…
<csmrfx>
I mean code is arbitrary code sequence. Not same as being forced to have a function definition.
Zai00 has quit [Quit: Zai00]
<csmrfx>
semantics schmemantics, I know
<apeiros_>
you mean, like: {foo: (1+1)} ? that works fine
<csmrfx>
umm, well if it can be evaled on the spot
pen has quit [Remote host closed the connection]
Villadelfia has joined #ruby
<apeiros_>
ok, I've no idea what you're talking about
<csmrfx>
Essentially I am saying that you can only have one type of "code" as a object property in js
lewis1711 has joined #ruby
<csmrfx>
and same goes (a little less) for ruby
<apeiros_>
as opposed to?
<lewis1711>
so using the "method", one can do something like "f = method :method_name; f.call". however, how would I do it for a method that's a member of some module? say, Math.sqrt
<apeiros_>
and what's "a type of code"?
<apeiros_>
lewis1711: the same way
SeySayux has joined #ruby
krawchyk has joined #ruby
<csmrfx>
apeiros_: as opposed to your example with "... code ..."
<apeiros_>
Math.method(:sqrt).call(100)
<waxjar>
lewis1711: Math.method :sqrt
pen has joined #ruby
<apeiros_>
csmrfx: I still have no idea what you're talking about
<csmrfx>
apeiros_: type of code is a function definition or reference for js, and a block or ref for ruby (I think)
<lewis1711>
oh, I was doing "method :Math.sqrt"
<lewis1711>
thanks
jaygen has joined #ruby
Astral_ has quit [Ping timeout: 255 seconds]
<apeiros_>
csmrfx: you're aware that a function definition in javascript returns a reference to the defined function? it's always a reference in the object.
<csmrfx>
apeiros_: Ok, let me put it in simpler way: "No, you cant, apeiros, your examples are incorrect and will cause Syntac Error"
<apeiros_>
the concept of variables vs. objects is the same in ruby & js
tommyvyo has joined #ruby
<apeiros_>
csmrfx: BS
<csmrfx>
apeiros_: I am aware, that is why you can use *either* definition or ref in js
jaygen has quit [Read error: Operation timed out]
<apeiros_>
my examples work just fine here. no idea what you do wrong.
<csmrfx>
apeiros_: ok, show me an js *or* ruby example where a object or hash value (respectively) is arbitrary code instead of function def/ref or block (respectively)
<csmrfx>
apeiros_: if you have no idea, you need to do more homework
<apeiros_>
again, wtf are you talking about?
<apeiros_>
what should that arbitrary code be?
<csmrfx>
saying, what you are saying is incorrect
<csmrfx>
stop saying that
<apeiros_>
as said, x = {foo: 1+1} # works, arbitrary code, no function ref
<csmrfx>
ie:
lateau has quit [Ping timeout: 255 seconds]
<apeiros_>
also, x = {foo: function() {}} # works, references a function
<csmrfx>
>> { foo: { p "bar" } }
<eval-in>
csmrfx: Output: "/tmp/execpad-c4cb9c8de628/source-c4cb9c8de628:1: syntax error, unexpected tSTRING_BEG, expecting keyword_do or '{' or '('\n{ foo: { p \"bar\" } }\n ^\n/tmp/execpad-c4cb9c8de628/source-c4cb9c8de628:1: syntax error, unexpected '}', expecting $end\n{ foo: { p \"bar\" } }\n ^\n" (http://eval.in/5946)
willob has quit [Quit: Leaving.]
<csmrfx>
whoops
<apeiros_>
csmrfx: maybe you do your homework and give a proper explanation?
kn330 has quit [Remote host closed the connection]
<csmrfx>
same with js: >> oo = { foo: { alert("bar") }} => SyntaxError: missing : after property id
invisime has joined #ruby
lewis1711 has left #ruby [#ruby]
pskosinski has joined #ruby
<apeiros_>
ok, you obviously have no clue about syntax
<csmrfx>
apeiros_: Well I was just pointing an incorrectness in your example, thats all.
<apeiros_>
oo = {foo: alert} # works
<banisterfiend>
csmrfx: are you really making an argument based on syntax?
akl_ has quit [Ping timeout: 248 seconds]
<csmrfx>
sure
<apeiros_>
oo = {foo: function() { alert("bar") } # works
<csmrfx>
like I said
<apeiros_>
oo = {foo: alert("bar")} # works
<csmrfx>
you can use a function def or ref
<apeiros_>
of course, if you use broken syntax, it can't work…
<csmrfx>
but you cant just slap in a object with some code, like in your pseudocode
enroxorz-work has joined #ruby
<apeiros_>
{alert()} is not valid, no matter what, since {} starts an object literal and requires key:value, but you don't provide key/value
<apeiros_>
csmrfx: yes, you can. if you don't fail at syntax 101
<csmrfx>
sure, alert would put the ref to alert -function as value, alert() the return value
<csmrfx>
like I said
<waxjar>
{ foo: { p "bar" } } fails because { p "bar" } isn't a valid Hash.
<csmrfx>
but not some "... code ..."
<apeiros_>
csmrfx: I think you're confused.
<csmrfx>
*only* functions
<csmrfx>
now, I said all I need to say
<csmrfx>
back to rubyland.
<chiel>
thank god
yoshie902a has joined #ruby
<csmrfx>
waxjar: yes, it fails, even if apeiros claimed it would work earlier
<apeiros_>
(right, that one was the thing about "monkey patch Hash")
<csmrfx>
ok, fair enough, block *or* lambda
Pip has joined #ruby
<csmrfx>
(wont work in js, though)
<Pip>
What does puts 20 means?
alinpandichi has left #ruby [#ruby]
<apeiros_>
csmrfx: learn js. works perfectly there.
<csmrfx>
Pip: output "20"
chimkan__ has joined #ruby
yshh has joined #ruby
<csmrfx>
apeiros_: now I am wondering if you are trolling. Output from ff console: >>> {foo: ->{ …code… }, bar: "value"}
<Pip>
cschneid, So it converts 20 into "20" before it gets printed out?
<csmrfx>
apeiros_: X SyntaxError: syntax error
<apeiros_>
csmrfx: are you stupid or something?
<waxjar>
lol
<apeiros_>
*of course* you have to replace …code… with actual code…
<apeiros_>
sorry dude, but…
<apeiros_>
oh, you inserted the ruby code in js?
<csmrfx>
apeiros_: which one of us keeps making claims about some snipepts that would supposedly work in js and ruby when you can easily tell they do not.
<apeiros_>
lmao even more so…
<ThaDick>
Pip: puts outputs whatever value to stdout
xemu has joined #ruby
<apeiros_>
csmrfx: dude, LEARN. TO. READ.
<csmrfx>
Just going by what you wrote, man.
<csmrfx>
No need to shout.
<ThaDick>
Pip: puts "foo" outputs foo, puts "bar" outputs bar
<Pip>
ThaDick, That's not what I asked
<waxjar>
pip, it calls to_s on any object it's passed
<apeiros_>
csmrfx: that's what I wrote. now read. closely.
chimkan_ has quit [Ping timeout: 256 seconds]
<apeiros_>
and again, for the really really slow dudes like you, "…code…" is placeholder for actual code, like "1+1" in ruby or "return 1+1" in js
* Hanmac
sings: "and for the best advice, you shoudl read it twice"
<apeiros_>
Hanmac: I think csmrfx should read it even thrice
iamjarvo has joined #ruby
samphippen has joined #ruby
<csmrfx>
apeiros_: calling me slow, after you claimed javascript has classes and whatnot?
<waxjar>
you might want to repeat your the Hash monkey-patch thing, too :P
<csmrfx>
lol
<waxjar>
*no your
<apeiros_>
csmrfx: again, learn to read, I claimed js has prototypes, which are semantically close to classes
<csmrfx>
want me to copypaste??
<apeiros_>
I have a backlog myself just fine…
dhruvasagar has quit [Ping timeout: 252 seconds]
jlast has joined #ruby
<apeiros_>
14:20 apeiros_: it does
<apeiros_>
14:20 apeiros_: well, it has prototypes
<csmrfx>
prototypes are really not close to classes, imho
<csmrfx>
15:23 <@apeiros_> csmrfx: you can do {foo: ->{ …code… }, bar: "value"} in ruby too
<csmrfx>
oops
<Hanmac>
haha you fooled yourself
<csmrfx>
ok, this has been a real treat, I will now go elsewhere to try to regain the 5 IQ points I've lost during ths discussion.
<apeiros_>
csmrfx: they provide similar mechanics for both inheritance and method lookup chains as classes do. but yes, they work in a different manner.
<Pip>
Does "" work for string ?
<apeiros_>
Pip: yes
<apeiros_>
"".class # => String
ananthakumaran has quit [Quit: Leaving.]
<csmrfx>
apeiros_: you are going to be really disappointed if you expect similarity between prototypal and class based inheritance
Xeago has joined #ruby
<apeiros_>
csmrfx: you mean, after claiming nothing but BS, you're finally giving up? :-p
Banistergalaxy has quit [Ping timeout: 255 seconds]
jjbohn has joined #ruby
<Pip>
Do you guys use irb usually?
<yoshie902a>
Pip: I used irb all the time for testing
mpereira has joined #ruby
yoshie902a has left #ruby [#ruby]
<csmrfx>
a lot of irb
<Pip>
yosafbridge, Do you use it with coloring representation?
Banistergalaxy has joined #ruby
lusory has joined #ruby
BRMatt has joined #ruby
dawkirst_ has joined #ruby
djdb has quit [Quit: Ухожу я от вас (xchat 2.4.5 или старше)]
maxmanders has quit [Remote host closed the connection]
Elhu has joined #ruby
kalusn has joined #ruby
kalusn has quit [Client Quit]
kalusn has joined #ruby
xcvd`` has joined #ruby
dawkirst_ has quit [Client Quit]
maxmanders has joined #ruby
<Pip>
:S
SeanLazer has joined #ruby
ananthakumaran has joined #ruby
jaywastaken has joined #ruby
jaywastaken has quit [Changing host]
jaywastaken has joined #ruby
fyolnish has quit [Remote host closed the connection]
jslowe has quit [Ping timeout: 252 seconds]
yfeldblum has joined #ruby
elico has quit [Ping timeout: 260 seconds]
phantasm66 has joined #ruby
sailias has joined #ruby
elico has joined #ruby
jeffreybaird has joined #ruby
elsifaka has joined #ruby
mikecmpbll has quit [Quit: Computer has gone to sleep.]
yshh has quit [Remote host closed the connection]
<nmeum>
Pip: I prefer pry :p
Gooder has quit [Ping timeout: 256 seconds]
<tommyvyo>
I'm writing a gem which is an API client, I'd like the object model methods to be similiar to ActiveRecord… I'm doing good I think, so far, but a problem I'm running into is the each object needs to know about the API client object
<tommyvyo>
so make like a global variable, API_KEY and API_URL, and then have the class attribute always just initialize a new client with those variables?
<Pip>
nmeum, with color support?
jds has quit [Remote host closed the connection]
ortuna has quit [Client Quit]
koshii has quit [Ping timeout: 256 seconds]
jds has joined #ruby
<banisterfiend>
tommyvyo: those aren't global variables, those are constants :)
pavilionXP has joined #ruby
jlast has joined #ruby
whowantstolivefo has quit [Ping timeout: 248 seconds]
<tommyvyo>
dawww
* tommyvyo
newb
<Pip>
WARNING: You don't have /home/pip/.gem/ruby/1.9.1/bin in your PATH,
<Pip>
gem executables will not run.
jjbohn has quit [Read error: Connection reset by peer]
jjbohn_ has joined #ruby
alexspeller has quit [Remote host closed the connection]
joeycarmello has joined #ruby
fyolnish has joined #ruby
infinitiguy has joined #ruby
pavilionXP has quit [Ping timeout: 255 seconds]
alexspeller has joined #ruby
<shevy>
Pip odd path
<shevy>
you manage all your gems in your home dir?
<Pip>
shevy, I don't know
<Pip>
shevy, it's the first time I install a gem
<shevy>
I myself install all gems into ruby's sitedir
eykosioux_ has quit [Quit: eykosioux_]
<shevy>
for instance, /usr/lib/ruby/gems/1.9.1/
matip__ has joined #ruby
<Pip>
shevy, How did you install your ruby ?
<Pip>
I see
mikecmpbll has joined #ruby
<Pip>
the gemrc must say something about it
<shevy>
I compile from source into /usr prefix usually (though, actually, I compile into standalone versioned directories, then either symlink to /usr or copy it, but for all technical reasons, the prefix I prefer is /usr)
wreckimnaked has quit [Read error: Operation timed out]
<Pip>
shevy, What does your gemrc say?
dweeb has joined #ruby
matip__ has left #ruby [#ruby]
<shevy>
admittedly I dont have one as I dont need one :\
<Pip>
shevy, You do
<shevy>
do you have a variable like GEM_HOME or GEM_PATH ?
spleeze has joined #ruby
<Pip>
no
<shevy>
nope, I dont, there is no gemrc nor .gemrc on my computer
<shevy>
hmm let's see for GEM_HOME
<shevy>
ah yes
<shevy>
"GEM_HOME is an environment variable that tells RubyGems where to find or install gems from."
<shevy>
what does "gem env" give you?
atmosx has joined #ruby
<shevy>
"GEM_PATH provides the locations (there may be several) where gems can be found."
<shevy>
"GEM_HOME is where gems will be installed (by default)."
matip_ has quit [Ping timeout: 252 seconds]
<shevy>
hmm you could try to set these variables, they might make a difference
<atmosx>
and when these two are different
<atmosx>
weird things happen!
<shevy>
and for $PATH variable, you could simply append /home/pip/.gem/ruby/1.9.1/bin to it
<shevy>
atmosx hehe
<Pip>
Why 1.9.1?
solidoodlesuppor has joined #ruby
Hanmac has quit [Quit: Page closed]
<Pip>
We are using 1.9.3 ruby now
<shevy>
Pip no, that is the C API version, not ruby version
ortuna has joined #ruby
<Pip>
oh
emocakes has joined #ruby
<shevy>
ruby 1.9.3 will have 1.9.1 as site dir
<shevy>
I do not know how you installed your ruby
<shevy>
I myself will never need a ~/.gem directory
<atmosx>
yeah I never understood that
<atmosx>
why 1.9.1 is used in x.x.3
<shevy>
hehe
<shevy>
yeah
<shevy>
why 1.9.1 for instance
<shevy>
why not 1.9
<Pip>
shevy, I installed it from my package manager
amaya_the has joined #ruby
<shevy>
debian package manager usually delivers a crippled ruby
<shevy>
mkmf for example is not in it by default
<nmeum>
Pip: just run sudo gem install <gem>
ryannielson has joined #ruby
<Pip>
nmeum, that will install to /root/.gem
<Pip>
I have --user-install in gemrc file
<nmeum>
no, It shouldn't install gems to /root/.gem
ltsstar has joined #ruby
<Pip>
nmeum, read what I said
<nmeum>
well run sudo gem install --no-user-install <gem> :p
<Pip>
okay
<csmrfx>
shevy: it is not the ruby that is crippled
landho has quit [Read error: Connection reset by peer]
<shevy>
csmrfx, why not? a from source compilation of ruby provides you with mkmf
<csmrfx>
Debian relies on apt-get 100%. With that philosophy, even ruby gems should be installed from apt-get. This is an ongoing conflict. Solution: if all the gems you need are in debian repos and can be apt-getted, use debian ruby.
landho has joined #ruby
v0n has joined #ruby
jlast has quit [Ping timeout: 260 seconds]
<csmrfx>
Otherwise, compile your own ruby even on debian.
<chiel>
debian's ruby is horrible
<csmrfx>
again, there is nothing wrong with the debian version of ruby
<csmrfx>
The problem is with *rubygems*
<shevy>
mkmf is not part of rubygems
<csmrfx>
mmkay
<csmrfx>
shevy: tell me, do you need mkmf with plain ruby?
<shevy>
csmrfx yes
<JonnieCache>
god state machines are the best thing ever
<csmrfx>
shevy: with plain vanilla ruby without rubygems?
<JonnieCache>
if you are a programmer and you arent using state machines all the damn time then stop what youre doing and go and look them up
<shevy>
csmrfx yes
jrist-afk is now known as jrist
wreckimnaked has joined #ruby
<JonnieCache>
all the shitty old projects i have to fix are shit because they arent state machines
<apeiros_>
apt's ruby was at times ~3y behind
<JonnieCache>
(or rather because theyre crappy half implemented state machines made by people who are doing it without realising it)
<apeiros_>
so yes, there was something wrong with apt's ruby. maybe they're now more up to date.
<csmrfx>
shevy: really? what do you need mkmf for if you only use vanilla ruby?
<shevy>
csmrfx every time I install a ruby addon that I want to, if it requires mkmf
jlast has joined #ruby
<csmrfx>
apeiros_: well debian squeeze comes with 1.9.3
<csmrfx>
Understand that rubygems and apt-get *do the same thing*
<atmosx>
there must like 15 web frameworks for ruby
<csmrfx>
shevy: even multiple versions
<banisterfiend>
JonnieCache: you mean via the state_machine gem?
<shevy>
atmosx, yeah but I think there is a big gap between their qualities
<atmosx>
shevy: well, sometimes it's hard to see
<atmosx>
I mean, I don't think that everyone can really evaluate all of them
<shevy>
there is rails, then there is a big gap... then probably comes sinatra, ramaze... camping being somewhere lower on that list
<atmosx>
I'm playing with sinatra but I could have done my app using camping.io easily
<csmrfx>
Who knows, maybe in near future debian apt-gotten rubygems can actually mix and match apt-getted gems and gem installed gems without explosions
can0n has quit [Quit: Leaving]
<atmosx>
and the code would not be considerably smaller
<atmosx>
anyway
tommyvyo has joined #ruby
<shevy>
atmosx, yeah, one would have to cherry pick the useful things
<atmosx>
Any ideas on the *easiest way* to a very BASIC auth method for script clients that connect to http server?
<csmrfx>
Finally, I use rvm for ruby on debian dev machines.
<atmosx>
actually to thin (rack) server
<csmrfx>
does it support .htaccess?
<atmosx>
csmrfx: I use rvm everywhere can't imagine life without it
<atmosx>
rvm + vim = Ruby (love)
doodlehaus has joined #ruby
daniel_- has joined #ruby
Jackneill has quit [Read error: Connection reset by peer]
<csmrfx>
I do the apt-get ruby+rubygems on machines thatjust need to support the simple things that are already in the debian repos (it *is* much faster after all)
<shevy>
csmrfx why do you use RVM?
Jackneill has joined #ruby
Jackneill has joined #ruby
Jackneill has quit [Changing host]
<csmrfx>
shevy: I use it when I need in-developement gems or need to do stuff that hasn't hit the debian repos yet
xcvd`` has quit [Quit: Leaving]
can0n has joined #ruby
Liothen has quit [Remote host closed the connection]
subbyyy has quit [Quit: none 0.3.9.2]
subbyyy has joined #ruby
dbck has joined #ruby
breakingthings has joined #ruby
solidoodlesuppor has joined #ruby
kpshek has joined #ruby
haxrbyte has quit [Ping timeout: 265 seconds]
browndawg has joined #ruby
wreckimnaked has quit [Read error: Operation timed out]
vital101 has joined #ruby
ExxKA has joined #ruby
maxmanders has quit [Remote host closed the connection]
bguery has joined #ruby
<bguery>
hi
adambeynon has joined #ruby
jonahR has joined #ruby
<bguery>
I'm trying to change the port of unicorn in unicorn.rb, the file seems to be read correctly, but I still get the same error (adding listener failed addr=0.0.0.0:8080 (in use)) when I set listen 3001 in my config
<bguery>
any ideas?
asteve has joined #ruby
philcrissman has joined #ruby
<apeiros_>
bguery: lsof -i :3001
<apeiros_>
tells you what already uses port 3001
sepp2k has quit [Quit: Leaving.]
<bguery>
apeiros_, well, the problem is not the fact that the port 3001 is used or not (it is not) but why does my config is not used?
thatRD has joined #ruby
sepp2k has joined #ruby
<apeiros_>
in that case, you didn't properly change the config
<bguery>
I just moved from listen 8080 to listen 3001
karasawa has quit [Ping timeout: 248 seconds]
wreckimnaked has joined #ruby
thone has joined #ruby
<apeiros_>
looks fine. so the obvious things: a) did you save the changes? b) did you edit the correct file? c) do you really start a unicorn which uses that config?
<Pip>
What's the difference between ri and rdoc?
bean has joined #ruby
<apeiros_>
Pip: rdoc generates docs, ri reads docs
vital101 has left #ruby [#ruby]
stopbit has joined #ruby
joofsh has quit [Remote host closed the connection]
rondale_sc has joined #ruby
_nitti has joined #ruby
daniel_- has quit [Ping timeout: 255 seconds]
<Pip>
apeiros_, what is ri documentation?
joofsh has joined #ruby
thone_ has quit [Ping timeout: 252 seconds]
<banisterfiend>
anyone here used 0mq?
<apeiros_>
Pip: ?
<Pip>
--[no-]ri Generate RI documentation for the gem on
<Pip>
install
jamescarr has joined #ruby
<apeiros_>
ah, on gem install? --ri vs. --rdoc? good question, don't know.
<Pip>
:D
<Pip>
thanks
<apeiros_>
you could ask drbrain over in #ruby-lang
kalusn has quit [Quit: kalusn]
<apeiros_>
he maintains rubygems
maxmanders has joined #ruby
<csmrfx>
Pip are you on debian?
<Pip>
NobbZ, Arch
<csmrfx>
ok, nm
benlieb has joined #ruby
lolcathost has quit [Quit: When I come back, please tell me in what new ways you have decided to be completely wrong.]
alexspeller has quit [Ping timeout: 252 seconds]
lolcathost has joined #ruby
atmosx has quit [Quit: And so the story goes…]
alexspeller has joined #ruby
horofox_ has joined #ruby
theRoUS has joined #ruby
xcvd`` has joined #ruby
m4n has quit [Ping timeout: 240 seconds]
jekotia has joined #ruby
jslowe has quit [Ping timeout: 246 seconds]
karl________ has joined #ruby
thatRD has quit [Quit: thatRD]
thatRD has joined #ruby
miskander has joined #ruby
<karl________>
what is '~=' called?
haxrbyte has joined #ruby
tagrudev has quit [Remote host closed the connection]
haxrbyte has quit [Remote host closed the connection]
pavilionXP has joined #ruby
nwertman has quit [Ping timeout: 248 seconds]
haxrbyte has joined #ruby
<Mon_Ouie>
A typo for =~ :p
pavilionXP has quit [Max SendQ exceeded]
elico has quit [Ping timeout: 240 seconds]
<karl________>
Mon_Ouie: erps yup
<karl________>
=~
yale has joined #ruby
<Mon_Ouie>
I think I'd call it the pattern matching operator most of the time
yshh has joined #ruby
<Myconix>
Yeah
pavilionXP has joined #ruby
joeycarmello has quit [Read error: Operation timed out]
reinaldob has joined #ruby
clocKwize has quit [Quit: clocKwize]
<Myconix>
like "string" =~ /pattern/ would check to see if string had the word pattern in it
<karl________>
know off the top of your head how to make it do any case?
<Myconix>
.downcase
<karl________>
ie foo, Foo, FoO
<karl________>
ah
<Myconix>
on the string
adrock has joined #ruby
<Myconix>
like "sTrInG".downcase =~ /pattern/
solidresolve has quit [Remote host closed the connection]
<karl________>
thx Myconix :)
<Myconix>
Though, I don't think that =~ is case sensitive anyway
<Myconix>
no problem
<adrock>
When using RVM, why does one version of Ruby show up as [ruby-]1.9.3-p194
<adrock>
and another version show up as [ruby-]1.9.3-[p327]
solidresolve has joined #ruby
<adrock>
what the significance of the brackets?
<Myconix>
dunno
kerozene has quit [Ping timeout: 245 seconds]
<Myconix>
never worked with RVM so I can't say
<Mon_Ouie>
/foo/i
yshh has quit [Ping timeout: 260 seconds]
<Mon_Ouie>
It's not related to the method, it's related to regular expressions in general
<karl________>
thx Mon_Ouie just found that myself
<llaskin>
apeiros_: for selenium, when using one browser to drive a huge test....its the only way to make sense of it.
benlieb has quit [Ping timeout: 248 seconds]
<llaskin>
without passing the driver instance into each method.
<apeiros_>
llaskin: no, it's not
fourq has joined #ruby
<apeiros_>
k, your code, you have to deal with it
<apeiros_>
in order to not having to pass stuff around is why we have objects
<TheEmpty_>
reactormonk: what?
<apeiros_>
they store state…
<reactormonk>
any fucking reason ruby guys tend to choose cute names like 'homebrew'? Doesn't make it simpler to google -.-
nga4 has quit [Ping timeout: 248 seconds]
<csmrfx>
reactormonk: yes, to piss you off
<banisterfiend>
reactormonk: just add 'osx' to your search
<llaskin>
so given a slightly modified gist of here: https://gist.github.com/4453659, my ideal goal is that if I call Navigation.new.bpool it would run the Manage#Initialize and if I called Navigation.new.analysis it would run Overview.initialize
<chiel>
i think last time i googled for homebrew it was the first result... but google does mess with results i guess
<TheEmpty_>
mongrel, thin, unicorn, etc.
yaroslav has joined #ruby
<llaskin>
also add in gem
<apeiros_>
chiel: yupp, it personalizes
<llaskin>
homebrew ruby gem
<csmrfx>
thin sometimes does give troubles
<reactormonk>
banisterfiend, are there git packages for homebrew?
eldariof has joined #ruby
joeycarmello has quit [Ping timeout: 248 seconds]
<apeiros_>
that'd be kinda funny
<csmrfx>
nowadays *everything* should be named uniquely so you can find it on google, really. Maybe thin could be called ruthin
theRoUS has quit [Ping timeout: 276 seconds]
<apeiros_>
since homebrew depends on git :)
<llaskin>
apeiros_: any thoughts on my dilemma?
<apeiros_>
llaskin: I don't see what your problem is
<llaskin>
calling different initialize methods based on which module the method being called belongs to
<llaskin>
"my ideal goal is that if I call Navigation.new.bpool it would run the Manage#Initialize and if I called Navigation.new.analysis it would run Overview.initialize"
<apeiros_>
llaskin: you described what you want - just code it?
<reactormonk>
apeiros_, oh, reasonable.
<TheEmpty_>
I like giving my libraries bland names like, "Just Another Crappy Game Engine"
<llaskin>
apeiros_: can you give a suggestion how to code that? I'm unsure.
<apeiros_>
llaskin: why did you create those modules? do you really use them elsewhere?
x82_nicole has quit [Quit: Computer has gone to sleep.]
<llaskin>
perhaps my organization is bad. how would you organize this? as I am pretty sure I've made clear before, I'm not the most skilled developer(though I hope I am learning)
x82_nicole has joined #ruby
<apeiros_>
llaskin: that's not really an answer to my question…
Gooder has quit [Ping timeout: 240 seconds]
<llaskin>
I do call them from test scripts(or at least plan to)
clocKwize has joined #ruby
clocKwize has quit [Client Quit]
<llaskin>
figured it would be best to split Navigation into classes based on which "subtab" was being utilized....hence the different module names
<apeiros_>
ok, I'll rephrase: do you include or extend those modules into anything else besides Navigation?
<llaskin>
i include the Navigation class, but no, I don't include the modules themselves elsewhere.
<apeiros_>
then drop the modules.
<apeiros_>
put the code directly into Navigation
mrdtt has joined #ruby
<apeiros_>
when you're done, show again and we can help you to refactor/improve the code
dsabanin has joined #ruby
<apeiros_>
also, if I were you, I'd avoid abbreviations like 'bpool'
<llaskin>
apeiros_: I do. this was more for just hiding exactly what a bpool is....
<apeiros_>
to what avail? hide it from whom?
<llaskin>
you.
<llaskin>
and/or the rest of this chatroom/public.
<apeiros_>
oh, you want help with your code but don't want to show your code - forget it.
miskander has quit [Quit: miskander]
<apeiros_>
either you're prepared to show it all or I'm out by default.
landho has quit [Read error: Connection reset by peer]
joeycarmello has joined #ruby
<llaskin>
ok the difference between saying "budget_pool" or "bpool" was the difference here
Pip has joined #ruby
<Squarepy>
barf_pool
landho has joined #ruby
aganov has quit [Remote host closed the connection]
ThaDick has quit [Quit: zzzZZZ ...]
hack has quit [Quit: WeeChat 0.3.9.2]
pskosinski has quit [Quit: Learn Life's Little Lessons]
cirwin has joined #ruby
jjbohn has joined #ruby
<TheEmpty_>
Don't lie, it's a Bachelor Pool
jaywastaken_ has joined #ruby
cha1tanya has quit [Quit: Leaving]
pskosinski has joined #ruby
miskander has joined #ruby
baroquebobcat has joined #ruby
jaywastaken has quit [Ping timeout: 240 seconds]
<apeiros_>
TheEmpty_: bachelorette pool you mean?
<shevy>
benis_pool
peregrine81 has joined #ruby
woolite64 has joined #ruby
dweeb has quit [Quit: Computer has gone to sleep.]
<TheEmpty_>
No, see he's make a website called datearubiest
<TheEmpty_>
There are no bachelorettes stored in a pool because there aren't that many there.
d2dchat has joined #ruby
sayan has joined #ruby
sayan has quit [Changing host]
sayan has joined #ruby
kalusn has joined #ruby
kalusn has quit [Client Quit]
bruticus has quit [Quit: bruticus]
io_syl has joined #ruby
<TheEmpty_>
I thought it would be cool to see if that was a thing, http://imgur.com/I4KPa
Squarepy has quit [Quit: Leaving]
amaya_the has quit [Quit: ChatZilla 0.9.89 [Firefox 17.0.1/20121128204232]]
<breakingthings>
TheEmpty_brb registering domain.
alex__c2022_ has joined #ruby
Jackneill has quit [Quit: Leaving]
alex__c2022 has quit [Ping timeout: 248 seconds]
alex__c2022_ is now known as alex__c2022
elaptics is now known as elaptics`away
main_ has joined #ruby
pavilionXP has joined #ruby
Jackneill has joined #ruby
Jackneill has quit [Changing host]
Jackneill has joined #ruby
<TheEmpty_>
Haha, maybe I should do that and do something like http://t.co/xwixsGRf
<TheEmpty_>
"If you want to be my girlfriend, please do not hesitate to get in touch."
<rismoney>
i want a method that takes a hash of say 'name', and 'type' without defaults, but must use those key names of name,type
ericwood has quit [Quit: leaving]
ltsstar has quit [Quit: ltsstar]
ThaDick has joined #ruby
<TheEmpty_>
name = options[:name] or raise "name parameter needed"
generalissimo has joined #ruby
<TheEmpty_>
name = options.delete(:name) or raise "name parameter needed"
anykey__ has joined #ruby
fbernier has joined #ruby
xAndy is now known as xandy
anykey__ is now known as ericwood
jds has quit [Remote host closed the connection]
ffranz has joined #ruby
elaptics`away is now known as elaptics
<apeiros_>
options.fetch(:foo) # raises on its own
<hoelzro>
but the exception it raises won't likely explain the problem
theRoUS has joined #ruby
theRoUS has quit [Changing host]
theRoUS has joined #ruby
<apeiros_>
options.delete(:foo) { raise … } # only raises if the key is really missing
<TheEmpty_>
fetch will allow a nil or false value, mine won't
<TheEmpty_>
so depends on use
<apeiros_>
options.delete(:foo) or raise # raises if :foo is present but has a value of nil/false to
<TheEmpty_>
I didn't know about fetch, would have responded with that otherwise
ChampS666 has joined #ruby
<apeiros_>
it all depends on what precisely he wants
<apeiros_>
allow nil/false?
<apeiros_>
raise a custom exception?
<apeiros_>
defaultize nil? defaultize nil/false? defaultize when not present?
a_a_g has joined #ruby
Dreamer3 has quit [Quit: Computer has gone to sleep.]
<TheEmpty_>
he said no defaults, probably doesn't want nil or false, so yeah maybe my method
<apeiros_>
"probably" :-p
<TheEmpty_>
If you're requiring a name and type, I don't think nil or false are wanted
pskosinski has quit [Quit: Learn Life's Little Lessons]
* apeiros_
prefers on people elaborating their needs
<TheEmpty_>
rismoney: WE DEMAND ANSWERS
<apeiros_>
WE DO!
samphippen has quit [Quit: Computer has gone to sleep.]
alvaro_o has joined #ruby
ericjhedberg has joined #ruby
Spaceghostc2c has quit [Excess Flood]
<JonnieCache>
TheEmpty_: that link is amazing
<JonnieCache>
TheEmpty_: i imagine hes married by now
Spaceghostc2c has joined #ruby
miskander has quit [Quit: miskander]
<shevy>
wtf
skryking has left #ruby ["Konversation terminated!"]
Takehiro has quit [Read error: Connection reset by peer]
Takehiro_ has joined #ruby
bruticus has joined #ruby
blazes816 has joined #ruby
hoelzro is now known as hoelzro|away
miskander has joined #ruby
nga4 has joined #ruby
lolcathost has quit [Ping timeout: 276 seconds]
nga4_ has joined #ruby
stkowski has joined #ruby
<TheEmpty_>
OMG, I didn't know it had background music too XD
adeponte has joined #ruby
<JonnieCache>
fortunately it didnt play for me
<JonnieCache>
i think im muted. maybe i didnt wait long enough for it to download
<TheEmpty_>
First time was on my macbook air where I have that stuff disabled. It's quicktime so you might need to authorize it too
jjbohn has quit [Quit: Leaving...]
infinitiguy has quit [Read error: Connection reset by peer]
infinitiguy has joined #ruby
JohnBat26 has joined #ruby
<TheEmpty_>
My Facebook feed tells me Valentines is around the corner. Guess I'll have to take my GF to a nice resturant and dress up :( Well at least she doesn't eat much. And doesn't demand too much. That and she's my hand (or should I have gone with "she's built in ruby"?)
koshii_ has quit [Ping timeout: 248 seconds]
daniel_- has joined #ruby
lolcathost has joined #ruby
jjbohn has joined #ruby
peregrine81 has quit [Quit: Computer sleeping.]
cousine has joined #ruby
includex has quit [Quit: Leaving...]
ltsstar has joined #ruby
jaywastaken has joined #ruby
jaywastaken has joined #ruby
jaywastaken has quit [Changing host]
alexspeller has quit [Ping timeout: 252 seconds]
blaxter has quit [Quit: foo]
jaimef has joined #ruby
daniel_-_ has joined #ruby
alexspeller has joined #ruby
Neomex has joined #ruby
a_a_g1 has joined #ruby
Neomex has quit [Client Quit]
jaimef has quit [Client Quit]
jaywastaken_ has quit [Ping timeout: 276 seconds]
daniel_- has quit [Ping timeout: 246 seconds]
a_a_g has quit [Ping timeout: 256 seconds]
mpfundstein has quit [Ping timeout: 255 seconds]
SeanLazer has quit [Quit: SeanLazer]
geekbri has quit [Remote host closed the connection]
pskosinski has joined #ruby
jds has joined #ruby
polymar has quit [Remote host closed the connection]
joofsh has quit [Remote host closed the connection]
xandy is now known as xAndy
cirwin has quit [Quit: commut...ting!]
rakl has joined #ruby
koderde has quit [Quit: Leaving]
haxrbyte has quit [Read error: Connection reset by peer]
koderde has joined #ruby
alexander___ has joined #ruby
jaimef has joined #ruby
nwertman has joined #ruby
vikhyat has quit [Remote host closed the connection]
jaimef has quit [Client Quit]
banisterfiend has quit [Remote host closed the connection]
jaimef has joined #ruby
otters has joined #ruby
zeade has joined #ruby
gyre007 has quit [Read error: Connection reset by peer]
gyre007 has joined #ruby
yale has quit [Ping timeout: 260 seconds]
jaimef has quit [Client Quit]
t0rc has joined #ruby
gyre007 has quit [Read error: Connection reset by peer]
jaimef has joined #ruby
gyre007 has joined #ruby
ober has quit [Remote host closed the connection]
jaimef has quit [Client Quit]
ananthakumaran has quit [Quit: Leaving.]
gyre007 has quit [Read error: Connection reset by peer]
DrCode has quit [Write error: Connection reset by peer]
mrdtt has quit [Quit: mrdtt]
xAndy is now known as xAndy_
mattsgarrison has quit [Remote host closed the connection]
vikhyat has quit [Remote host closed the connection]
sailias has quit [Quit: Leaving.]
sterNiX has joined #ruby
sterNiX has quit [Changing host]
sterNiX has joined #ruby
jthomp has joined #ruby
xAndy_ is now known as xAndy
xAndy is now known as xAndy_
Spaceghostc2c has quit [Excess Flood]
atno is now known as Kindari
Kindari is now known as atno
jblack has joined #ruby
mockra has joined #ruby
sterNiX has quit [Max SendQ exceeded]
sterNiX has joined #ruby
Spaceghostc2c has joined #ruby
cousine has quit [Remote host closed the connection]
jaimef has quit [Quit: Emacs must have died]
jaimef has joined #ruby
sn0wb1rd has quit [Quit: sn0wb1rd]
asteve has quit [Quit: Computer has gone to sleep.]
jduan1981 has joined #ruby
jjbohn has quit [Quit: Leaving...]
mengu has quit [Quit: Konversation terminated!]
moos3 has joined #ruby
graft has joined #ruby
<graft>
hey anyone know how to get tab-completion for files in irb?
<jaimef>
use pry :P
<graft>
sigh... yeah, i guess
gyre007 has quit [Read error: Connection reset by peer]
gyre007 has joined #ruby
timmow has quit [Quit: has left the building]
kn330 has joined #ruby
<graft>
ah, gem install bond
jduan1981 has quit [Quit: jduan1981]
rdark has quit [Quit: leaving]
jaimef has quit [Quit: Emacs must have died]
jaimef has joined #ruby
benlieb has joined #ruby
sayan has quit [Read error: Connection reset by peer]
jerius has quit []
Hanmac1 is now known as Hanmac
jaygen has joined #ruby
sayan has joined #ruby
banisterfiend has joined #ruby
Gues_____ has joined #ruby
jaygen has quit [Read error: Operation timed out]
Gues_____ is now known as Guest123
jjbohn has joined #ruby
<Guest123>
hello - does anyone know how to parse a file starting at a line that contains specific text?
<Guest123>
i.e. do a grep within the file for a particular string, and then start parsing line by line from there?
<banisterfiend>
Guest123: first read the whole file using File.readlines(file_name)
zxc has joined #ruby
<banisterfiend>
Guest123: then just search through the resulting array using find_index
<JonnieCache>
STATE MACHINE!
kenneth has quit [Quit: kenneth]
<banisterfiend>
JonnieCache: lols
akl_ has quit [Ping timeout: 252 seconds]
alex__c2022 has quit [Ping timeout: 260 seconds]
<JonnieCache>
parsers. the classic application for a FSM
benlieb has quit [Ping timeout: 272 seconds]
<banisterfiend>
JonnieCache: r u state machine crazy!
alexander___ has quit [Quit: Page closed]
<banisterfiend>
JonnieCache: u cling to FSMs like a mad man clutches a dead geranium
sailias has joined #ruby
<Guest123>
@banisterfiend I was trying to avoid reading the entire file - I wanted to start reading lines at a specific line that contained the regex match
jjbohn has quit [Client Quit]
DrCode has joined #ruby
<JonnieCache>
i have a FSM to track my geraniums too
<Gate>
banisterfiend: techically, so do you. All modern processors map to finite state machines.
<banisterfiend>
Guest123: how long is the file?
<Guest123>
~100k
<Guest123>
but I need to read it several times in a row for different inputs
<banisterfiend>
Guest123: why not memoize it?
<banisterfiend>
so you only need to read it once
<JonnieCache>
Guest123: how do you expect to find the line to start at without reading all the lines before it?
<banisterfiend>
Guest123: reading a file into memory is pretty fast
<JonnieCache>
i suppose you could use some kind of divide and conquer thing
jaywastaken_ has joined #ruby
<Guest123>
oh ok - so first pass I'll try the readlines, thanks all
<JonnieCache>
it depends on the nature of the data
zxc has quit [Client Quit]
madhadron has joined #ruby
havenn has joined #ruby
nwertman has quit [Quit: leaving]
artnez has quit [Quit: artnez]
jaywastaken has quit [Ping timeout: 255 seconds]
art_man1 has joined #ruby
<TheEmpty_>
Isn't there a seek() method?
sterNiX has quit [Quit: Lagging Off]
radic has joined #ruby
otters has quit [Ping timeout: 252 seconds]
radic_ has quit [Ping timeout: 276 seconds]
<banisterfiend>
TheEmpty_: sure but he'd have to know where to seek() to
jerius has joined #ruby
maletor has joined #ruby
<TheEmpty_>
Seek and test that data, if you pass it, jump up and read from there. Depends on filesize (I suck with 100k, I work in "big" and "not big" :P)
miskander has quit [Quit: miskander]
slainer68 has quit [Remote host closed the connection]
atmosx has joined #ruby
JMcAfreak has joined #ruby
yshh has quit [Remote host closed the connection]
otters has joined #ruby
daniel_-_ has quit [Quit: WeeChat 0.3.9.2]
<banisterfiend>
TheEmpty_: seek(n) + check, followed by seek(n+100) + check
peregrine81 has joined #ruby
pskosinski has quit [Ping timeout: 272 seconds]
<banisterfiend>
TheEmpty_: sounds messy and maybe even slower than File.readlines() right from the get-go
wreckimnaked has quit [Read error: Operation timed out]
kinginky has joined #ruby
yshh has joined #ruby
<asuka>
/win 28
sn0wb1rd has joined #ruby
nwertman has joined #ruby
kurioscreative has joined #ruby
love_color_text has joined #ruby
cpruitt has quit [Quit: cpruitt]
zigomir has quit [Quit: zigomir]
brendan_ has quit [Read error: Connection reset by peer]
bruticus has quit [Quit: bruticus]
froy has quit [Quit: kablam!]
brendan_ has joined #ruby
yshh has quit [Ping timeout: 255 seconds]
breakingthings has quit []
punkrawkR has quit [Ping timeout: 245 seconds]
jamescarr has quit [Quit: jamescarr]
punkrawkR has joined #ruby
assurbanipal has joined #ruby
filipe has quit [Remote host closed the connection]
jduan1981 has joined #ruby
kenneth has joined #ruby
francisfish has quit [Remote host closed the connection]
<rismoney>
the story is I previously had 5 string arguments, and now i want them to be a hash to manage them better. but they are all req'd, and i want to use its keyname, so its kind of ideal to be a symbol
jds has joined #ruby
a_a_g has joined #ruby
<reactormonk>
5 string arguments? whut?
<reactormonk>
What's this method for?
alex__c2022 has joined #ruby
<rismoney>
lol - it looked like this before def ip_props (res_name, res_grp, ip_addr, ip_subnetmask, ip_network)
panpainter has joined #ruby
nomenkun_ has joined #ruby
nomenkun has quit [Read error: Connection reset by peer]
<reactormonk>
rismoney, well, you could group the ip_* stuff into a struct if you require the same kind of arguments somewhere else.
the_jeebster has joined #ruby
<rismoney>
so now i think i want it def ip_props (hash_ip_props={})
wermel has quit [Remote host closed the connection]
mensvaga has joined #ruby
<reactormonk>
well, either you go with a struct or with a hash - depends which design philosophy you follow
<rismoney>
ip=hash_ip_props[:ip] or raise "ip needed"
<rismoney>
this is a singleton method, and nothing else requires ip crap
<reactormonk>
ok, fine
infinitiguy has quit [Read error: Connection reset by peer]
infinitiguy has joined #ruby
ExxKA has quit [Quit: This computer has gone to sleep]
a_a_g has quit [Quit: Leaving.]
<mensvaga>
Is there a way to catch all methods called on an object?
jjbohn has quit [Quit: Leaving...]
<mensvaga>
like object.this_method_doesnt_exist
<banisterfiend>
mensvaga: method_missing
yshh has quit [Ping timeout: 264 seconds]
<mensvaga>
BUT have a way to get the name of the method that's called, and potentially dispatch it to another method?
<mensvaga>
I'll read up on method_missing
griffindy has joined #ruby
jstirnaman has joined #ruby
PragCypher has quit [Ping timeout: 248 seconds]
<reactormonk>
mensvaga, everything's there.
<reactormonk>
mensvaga, and don't forget to redefine respond_to? as well
<graft>
also you can't pass hash args like that unless they're the last argument
<doug>
ah
<graft>
otherwise you should put them in a paren
<doug>
yeah, in this case, it's mock model: def mock_model(model_class, options_and_stubs = {})
jrist is now known as jrist-afk
<graft>
okay, so *args is more hash parameters?
_alejandro has joined #ruby
<doug>
oughta be
sepp2k has joined #ruby
<doug>
what's the right way to pass those through?
<graft>
then do def intermediary hash; another_method hash.merge( :time_zone => '' ); end
jaywastaken has quit [Ping timeout: 276 seconds]
love_color_text has quit [Remote host closed the connection]
<doug>
bitchin
<doug>
graft++
<mensvaga>
If I have variables in a class, say, Logger::DEBUG, Logger::ERROR, Logger::FATAL , but I want to refer to them by the value stored in a variable, how do I do that?
<mensvaga>
i.e. level = "FATAL", Logger::{level}
<reactormonk>
mensvaga, const_get
love_color_text has joined #ruby
<banisterfiend>
mensvaga: Logger.const_get(level)
ddd has quit [Quit: Leaving.]
<mensvaga>
OK. Thanks. reading up on const_get
<mensvaga>
ah.
xemu has quit [Ping timeout: 248 seconds]
<mensvaga>
Will that barf with an exception if it doesn't have one of those?
<banisterfiend>
mensvaga: of course :)
<mensvaga>
sweeeeet.
panpainter_ has joined #ruby
panpainter has quit [Read error: Connection reset by peer]
panpainter_ is now known as panpainter
love_color_text has quit [Read error: Connection reset by peer]
<reactormonk>
mensvaga, iirc a NameError
reinaldob has quit [Remote host closed the connection]
love_color_text has joined #ruby
mjolk has joined #ruby
wf2f has quit []
mjolk is now known as Guest81145
asteve has joined #ruby
fyolnish has quit [Remote host closed the connection]
zigomir has joined #ruby
blueOxigen has joined #ruby
graft has quit [Ping timeout: 264 seconds]
joeycarmello has quit [Remote host closed the connection]
froy has joined #ruby
fourq has quit [Quit: Lost terminal]
browndawg has quit [Quit: Leaving.]
bluOxigen has quit [Ping timeout: 248 seconds]
xcvd`` has quit [Ping timeout: 248 seconds]
yshh has quit [Ping timeout: 240 seconds]
kennyvb has quit [Ping timeout: 260 seconds]
jjbohn has quit [Quit: Leaving...]
rezzack has joined #ruby
jjbohn has joined #ruby
kennyvb has joined #ruby
nomenkun_ has quit [Read error: Connection reset by peer]
nomenkun has joined #ruby
marxarelli has joined #ruby
jjbohn has quit [Client Quit]
xargoon has quit [Ping timeout: 246 seconds]
havenn has quit [Remote host closed the connection]
doug has left #ruby [#ruby]
Xeago has joined #ruby
havenn has joined #ruby
havenn has quit [Read error: Connection reset by peer]
havenn has joined #ruby
xyzodiac has joined #ruby
havenn has quit [Read error: Connection reset by peer]
havenn has joined #ruby
kidoz has joined #ruby
sailias has joined #ruby
marr has quit [Ping timeout: 252 seconds]
fms has joined #ruby
graft has joined #ruby
graft has quit [Changing host]
graft has joined #ruby
lolcathost has quit [Ping timeout: 265 seconds]
gyre007 has quit [Remote host closed the connection]
luckyruby has joined #ruby
miskander has quit [Quit: miskander]
workmad3 has quit [Ping timeout: 255 seconds]
Xeago has quit [Ping timeout: 248 seconds]
xargoon has joined #ruby
infinitiguy1 has joined #ruby
infinitiguy has quit [Read error: Connection reset by peer]
fms is now known as ebobby
miskander has joined #ruby
kaen has quit [Read error: Connection reset by peer]
froy has quit [Remote host closed the connection]
Neomex has quit [Quit: Neomex]
Zai00 has quit [Quit: Zai00]
kaen has joined #ruby
diegoviola has joined #ruby
<shevy>
oh
<shevy>
apeiros_, you like to use "if condition then", if I remember correctly. can you explain briefly why you use the "then"?
love_color_text has quit [Remote host closed the connection]
meeko has joined #ruby
<shevy>
I am asking because right now, this is the first time I do something like this myself:
<shevy>
if condition # then enter main loop
<shevy>
it surprised me that I put a then as the first word in a comment, strangely enough
love_color_text has joined #ruby
ebouchut has joined #ruby
zigomir has quit [Quit: zigomir]
xnm has quit [Ping timeout: 248 seconds]
xargoon has quit [Ping timeout: 245 seconds]
xargoon has joined #ruby
<apeiros_>
shevy: read-flow is better for me
<apeiros_>
I don't use it anymore, though. we voted on it in the company and decided to use `if condition`. so I'm going with that now, even though I prefer if/then
<Kuifje>
then is required if you put the action on the same line as the if statement as far as I know
<shevy>
aha ok, interesting
<Kuifje>
otherwise ruby doesnt know where the if statement ends
froy has joined #ruby
meeko has quit [Ping timeout: 272 seconds]
kaen has quit [Read error: Connection reset by peer]
yshh has joined #ruby
jds has quit [Remote host closed the connection]
jds has joined #ruby
philcrissman has quit [Remote host closed the connection]
jaywastaken has joined #ruby
jaywastaken has quit [Changing host]
jaywastaken has joined #ruby
meeko has joined #ruby
<Mon_Ouie>
You can use semicolons too, so it's not really "required"
koshii has joined #ruby
marxarelli has left #ruby [#ruby]
<apeiros_>
I don't use one-line if/then/end
<apeiros_>
ugly IMO
<apeiros_>
if it's if/else/end, -> ?: instead
nricciar has joined #ruby
<apeiros_>
if it's if/end -> action if cond instead
Dreamer3 has joined #ruby
superguenter has joined #ruby
jaywastaken_ has quit [Ping timeout: 255 seconds]
skaczor has quit [Remote host closed the connection]
jds has quit [Ping timeout: 240 seconds]
daniel_- has quit [Ping timeout: 276 seconds]
v0n has quit [Read error: Connection reset by peer]
<graft>
argh. so, inject goes { |memo,element| } but each_with_object goes { |element,memo| } ? wtf
<graft>
that's not confusing or hard to remember at all
v0n has joined #ruby
<Mon_Ouie>
It's not a memo in the case of each_with_object
kn330 has quit [Remote host closed the connection]
<Mon_Ouie>
And easy to remember: each + *with_object* : the other object comes last
xyzodiac has quit [Quit: Computer has gone to sleep.]
_alejandro has quit [Remote host closed the connection]
<graft>
ruby-doc.org says it's a memo, and it acts exactly the same way as a memo, so why is it not a memo?
<banisterfiend>
graft: what is a memo to u
t0rc has quit [Read error: Operation timed out]
<Mon_Ouie>
It's always the same object, that's why I don't think of it as a memo
koshii has quit [Ping timeout: 240 seconds]
<banisterfiend>
if u define memo maybe u can answr the Q. yourself
<swarley>
I'm looking for something like rbcurse, except without using the ncurses library
panpainter has quit [Ping timeout: 265 seconds]
<apeiros_>
swarley: io/console + ansi escape sequences - have fun!
<graft>
by memo i would mean something that stores a previously computed value
koshii has joined #ruby
kyrylo has joined #ruby
<swarley>
apeiros_; I was hoping for something i didn't have to reinvent to get some widgets
<apeiros_>
swarley: oh, +trap("SIGWINCH") { …called when windowsize changes… }
philcrissman has joined #ruby
<kenneth>
hey there
<kenneth>
is there a way to get all object of a certain class?
<shevy>
graft when I read memo, I think of a way how the brain memorizes something in a hopefully simple way
<kenneth>
and what would the performance of that be?
<shevy>
kenneth hmm perhaps by traversing through ObjectSpace and returning all that respond to the specific .is_a? query
<bean>
that sounds disgusting
<banisterfiend>
kenneth: alternatively you can overload YourClass.new to keep track
yshh has quit [Ping timeout: 252 seconds]
<banisterfiend>
kenneth: or YourClass#initialize
<Mon_Ouie>
shevy: There's a more convenient way of doing that: ObjectSpace.each_object(YourClass)
<shevy>
ah
<shevy>
that is neat
<shevy>
bean lol
<banisterfiend>
not jruby friendly though
koshii has quit [Ping timeout: 272 seconds]
<apeiros_>
swarley: I think there's an ncurses clone in pure ruby
koshii has joined #ruby
<shevy>
awww poor heroic swarley... in the midths of curses hell...
<reactormonk>
apeiros_, whut? Isn't that slow as hell?
<apeiros_>
reactormonk: sure, but when did you need a 60fps in a terminal?
<swarley>
Lol
breakingthings has joined #ruby
<apeiros_>
ie, it doesn't matter whether it takes 50ms instead of 0.5ms to render
<reactormonk>
apeiros_, for watching my pr0n with libaa when my X broke down and no time to fix it
yaroslav has quit [Quit: yaroslav]
<apeiros_>
lol
workmad3 has joined #ruby
<apeiros_>
reactormonk: my rpg used pure ruby and map scrolling was smooth on my mbp
<apeiros_>
@120x40
<reactormonk>
apeiros_, as smooth as it can get :-)
<apeiros_>
and I didn't even optimize
<banisterfiend>
reactormonk: i bet you're into some exotic, barely-legal pr0n genres
<apeiros_>
yeah, he's into teen asciis!
<Mon_Ouie>
You'd know about those, I guess
<swarley>
Oh snap
meeko has quit [Quit: meeko]
<shevy>
apeiros_ you wrote a rpg?
<apeiros_>
shevy: working on one
<apeiros_>
currently porting what I have to html5
<reactormonk>
banisterfiend, got me some more?
<banisterfiend>
reactormonk: no, i cant handle your stuff
koshii has quit [Ping timeout: 240 seconds]
miskander has quit [Quit: miskander]
<Hanmac>
shevy i think its spelled "n-curses"
<reactormonk>
banisterfiend, why the fuck did you propose it to me then?
Hanmac has quit [Quit: Leaving.]
<banisterfiend>
reactormonk: to protect the public
Hanmac has joined #ruby
<shevy>
Hanmac as long as we can curse about both. I think there are two kinds though, I have libcurses.so and also libncurses.so
<banisterfiend>
otherwise you'd be out there on the streets abusing young women
koshii has joined #ruby
tommyvyo_ has joined #ruby
<apeiros_>
genius apple… with number type fields, arrow keys can no longer be used to select previously used values, instead the inc/dec the value…
<apeiros_>
sometimes…
panpainter has joined #ruby
<swarley>
k. How do I specify that I want x86_64 version of a package with apt-get?
tommyvyo has quit [Read error: Connection reset by peer]
tommyvyo_ is now known as tommyvyo
<Hanmac>
shevy did you hear that Obamas Plan B for the Fiscal Cliff was an One-Billion-Dollar-Coin ? (like the Dollar note in the Simpsons episode)
<shevy>
Hanmac dunno, no idea. I also don't follow any news really related to virtual currencies in general
<Hanmac>
swarley: first: what is your architecture, and what other architectures have you anabled?
workmad3 has quit [Ping timeout: 272 seconds]
<swarley>
Linux OctaviasViolin 3.2.0-34-generic #53-Ubuntu SMP Thu Nov 15 10:48:16 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
maletor has quit [Quit: Computer has gone to sleep.]
kyrylo has left #ruby ["Recharging eyes…"]
gesman has joined #ruby
<gesman>
Hello
<gesman>
Q: How can i emit array suing 123.times ... ?
<swarley>
amd64/generic
<gesman>
\using\
skcin7 has joined #ruby
atyz has joined #ruby
<swarley>
Emit an array of what?
<Mon_Ouie>
The results of the block you pass to times?
<gesman>
swarley, of 1 ... 123
<gesman>
say integers
<Mon_Ouie>
(1..123).to_a
<swarley>
gesman; 1..123 is easier than using each
Kuifje has quit [Ping timeout: 248 seconds]
<reactormonk>
banisterfiend, sorry to hear your story bro
<swarley>
err times
<Mon_Ouie>
Drop the to_a if you don't really need it to be an array
<reactormonk>
swarley, interesting name generator you use there
<Hanmac>
swarley: apt-get should use x86_64 as default ... you only need to add the arch when you want to install others like i386 ...
<swarley>
name generator?
<reactormonk>
gesman, [*1..123]
<swarley>
yeah, it says I have the amd64 package installed
<swarley>
but
<gesman>
Mon_Ouie, Thanks... I actually wanted to see if I can pass a block of code to emit each element for array
<Mon_Ouie>
You can use other methods from Enumerable like map, inject, etc. on the range object (1..123) and it doesn't need to create the whole array
<reactormonk>
swarley, hostname :-)
koshii has quit [Read error: Connection reset by peer]
<swarley>
the library is in /lib32
<banisterfiend>
Mon_Ouie: which feature excites you most from ruby 2.0
<Mon_Ouie>
Array.new(123) { |i| i * 2 }
koshii has joined #ruby
<kenneth>
hmm. i think i'll do it a different way then
<gesman>
sort of: 123.times {|n| blah(n) }
<swarley>
I'm hoping for refinements c:
<gesman>
But it does not emit array: --> 123.times {|n| blah(n) }
<Mon_Ouie>
banisterfiend: Well I haven't really paid attention to the development of 2.0
<kenneth>
other question: i want to make my own .inspect so i can get rid of a couple noisy ivars that show up, but i'd like the rest of the object's inspect to be formatted the same nice way.
nemesit has quit [Ping timeout: 248 seconds]
<kenneth>
is there an easy way to just remove an ivar from the inspect string?
<swarley>
kenneth; I think it's obj.__id__ << 8
<Hanmac>
swarley what package do you want to install exaclty? some like fglrx are not ported to multiarch yet (and install both archs at the same time)
<Mon_Ouie>
I don't think so. You could easily write once the method that returns an inspect-like string for the variables specified as argruments, and just use that whenever you need.
<swarley>
Hanmac; libncursesw5-dev
<banisterfiend>
Mon_Ouie: does ruby-dev.el not use pry-doc ?
<Mon_Ouie>
It uses YARD
jds has joined #ruby
xyzodiac has joined #ruby
<Mon_Ouie>
And Pry::Method, Pry::WrappedModule, etc.
<banisterfiend>
Mon_Ouie: ah
Guest81145 has quit [Read error: Connection reset by peer]
dougireton has joined #ruby
<Hanmac>
swarley: ncurses packages are only semi-multiarch ... that means you could co-install the lib packages but not the dev packages ...
mjolk has joined #ruby
Takehiro_ has quit [Remote host closed the connection]
<gesman>
Here's what i wanted: [*1..4].map {|n| n+5}
mjolk is now known as Guest86486
t0rc has joined #ruby
<gesman>
Thanks reactormonk and Mon_Ouie
darthdeus has joined #ruby
darthdeus has left #ruby [#ruby]
<reactormonk>
gesman, (1..4).map {|n| n+5}
llaskin has left #ruby [#ruby]
<swarley>
'%x' % (obj.__id__ << 1)
<Mon_Ouie>
Also see the Array.new line
koshii has quit [Ping timeout: 255 seconds]
<gesman>
reactormonk, yeah even better :)
<Mon_Ouie>
swarley: That's just the object id, the rest is the more important part
<Eiam>
whats the opposite of an array intersection called?
kurioscreative has joined #ruby
<Eiam>
elements that don't exist in both the arrays provided
<Eiam>
i can think of how to write it.. (ar1+ar2) - (ar1 & ar2)
<Mon_Ouie>
You'd still need a way to know what the set of all possible elements is to do that
<Eiam>
but is there actually a thing?
workmad3 has joined #ruby
<Mon_Ouie>
Oh, that don't exist in both, not either
<Eiam>
right
nomenkun has quit [Remote host closed the connection]
<banisterfiend>
Mon_Ouie: can i correct your english pls
<Mon_Ouie>
Sure, that was confusing me anyway
<Eiam>
i want the unique elements from these two arrays, or whats not in both. i was just wondering if there was an actual name for the "opposite of array intersection"
kaen has joined #ruby
<apeiros_>
Eiam: xor
<apeiros_>
exclusive or
BRMatt has quit [Ping timeout: 264 seconds]
jrendell has joined #ruby
<Eiam>
ah ha. THATS what an xor is =)
<Eiam>
and looks like ruby doesn't have it
<apeiros_>
Eiam: indeed. I usually add Array#^ for that
<apeiros_>
no idea why it isn't there already, given that union and intersection are both around
<Mon_Ouie>
It does have it for sets
<Mon_Ouie>
(in the actual Set class)
<apeiros_>
I wonder whether (a + b) - (a & b) is faster or slower than (a | b) - (a & b)
yshh has joined #ruby
yacks has quit [Ping timeout: 260 seconds]
<Eiam>
or (a-b) | (b-a) =p
miskander has joined #ruby
<kenneth>
when an object is extended with a module
<kenneth>
is there a method on the module that gets called that i can use to do some stuff?
<Eiam>
convert my arrays to sets, perform the xor, then convert back? =)
<reactormonk>
Eiam, why convert back?
<Mon_Ouie>
kenneth: Module#extended(by)
<Eiam>
i don't need a set?
<kenneth>
Mon_Ouie: awesomet hanks
panpainter has quit [Ping timeout: 264 seconds]
Morkel_ has joined #ruby
<reactormonk>
Eiam, why do you care if it's a set or an array?
<apeiros_>
banisterfiend: in pry, how can I do a multiline-codepiece?
workmad3 has quit [Ping timeout: 276 seconds]
<reactormonk>
Welcome do duck typing, buddy.
<Eiam>
i don't know, I've never used a set. I'm reading the docs on it now
<apeiros_>
i.e. that it doesn't increase the number to the left
<banisterfiend>
apeiros_: ???
jaywastaken has quit [Ping timeout: 256 seconds]
<banisterfiend>
apeiros_: that should be the default
<Mon_Ouie>
Sets are enumerable too, so many things can be done using both
<Eiam>
reactormonk: well, you can't say [1,2] ^ [2,3], you have to [1,2].to_set ^ [2,3].to_set
<apeiros_>
banisterfiend: no, the default is that upon every enter, the number increases. only if I have e.g. begin/end wrapped around, it does not
<kenneth>
Mon_Ouie: that's something i would def self.extended(by) on the module, right?
<kenneth>
Mon_Ouie: there's no doc on that method :/
Morkel has quit [Ping timeout: 240 seconds]
Morkel_ is now known as Morkel
<Mon_Ouie>
Yeah, and it gets called with object on YourModule in object.extend YourModule
<banisterfiend>
apeiros_: it only doesn't increase the number for true multiline (according to ruby) expressions. You want to not increment the expression number even after you'e typed in a complete ruby expression? so you want to embed multiple expressions into the same 'expressin number' ?
<banisterfiend>
sorry, that's a bit awkwardly phrased
<banisterfiend>
but u probably know what i mean
arturaz has joined #ruby
meeko has joined #ruby
<banisterfiend>
apeiros_: if you type 'edit' you'll go to an editor, you can type in as much ruby there as you want, and it'll be evaluated as a 'single expression' when u save/exit
zmo_ has quit [Read error: Connection reset by peer]
<Mon_Ouie>
You probably forgot to require 'set'
<apeiros_>
Eiam: require 'set'
<Eiam>
well christ i didn't require 'string' or require 'array' =0
joeycarmello has joined #ruby
jrist-afk is now known as jrist
<Eiam>
anyway yes that solved it
t0rc has quit [Ping timeout: 255 seconds]
<apeiros_>
that's the difference between core & stdlib
<apeiros_>
string/array are core
<apeiros_>
set is stdlib
Goles has quit [Quit: Computer has gone to sleep.]
<banisterfiend>
apeiros_: can u explain what u mean, it coudl be a k00 idea
<apeiros_>
interesting, (a+b)-(a&b) is the fastest, by quite a margin
hukl has quit [Quit: Leaving...]
<Eiam>
ha
* Eiam
monkey patches
<apeiros_>
banisterfiend: like in a couple of messengers, where the default is to send the message upon hitting enter, but you can edit multiple lines by using option-enter
<Mon_Ouie>
Probably because a | b needs to build yet another set
<apeiros_>
Mon_Ouie: yes
<apeiros_>
+ only concats two arrays, that's basically just memcpy
<Eiam>
so exicted my first monkey patch =)
<banisterfiend>
apeiros_: ah, well the way you do that in pry is just typing 'edit' to enter arbitrary code in an editor
<apeiros_>
if Set was written in C, I'd expect Set#^ to be the fastest. sadly, it's in ruby :(
<apeiros_>
banisterfiend: ah
jblack_ has joined #ruby
jblack has quit [Read error: Connection reset by peer]
<apeiros_>
banisterfiend: and how do I copy multiple expressions in an editor? `edit -i 2..8` ?
<Mon_Ouie>
Eiam: Oh, btw, even though you use array & other_array, as it is implemented, it does create a throw-away set (all in C that time, though)
hotovson has quit [Remote host closed the connection]
<banisterfiend>
ephemerian: exactly
<banisterfiend>
apeiros_: exactly*
<apeiros_>
Mon_Ouie: Hash actually…
<apeiros_>
banisterfiend: opened an empty editor window :(
<Mon_Ouie>
Well, a set can be implemented as a hash; they just don't bother to wrap it in another API
xAndy_ is now known as xandy
<banisterfiend>
apeiros_: which editor?
xandy is now known as xAndy
<apeiros_>
sublime
<banisterfiend>
apeiros_: weird it works for me, perhaps we dont support subtlime in the current gem version (but we do on head)
<reactormonk>
banisterfiend, well, do you do anything besides calling the editor with the path to the tmpfile?
miskander has quit [Quit: miskander]
<banisterfiend>
reactormonk: a few cute things
<reactormonk>
banisterfiend, like?
<banisterfiend>
reactormonk: not telling, it's my secret
dougireton has quit [Quit: Leaving.]
doug has joined #ruby
yshh has quit [Ping timeout: 248 seconds]
<doug>
what's the difference between !current_user.nil? and !!current_user ?
<Pip>
doug, I don't know
<Pip>
doug, Is Matz here?
miskander has joined #ruby
Takehiro has joined #ruby
<Mon_Ouie>
Except when current_user can also be false, just style
ryanjh has joined #ruby
sayan has quit [Remote host closed the connection]
ebouchut has quit [Quit: This computer has gone to sleep]
<Mon_Ouie>
(when it can be false, then current_user.nil? is false while !current_user is true)
dustint has joined #ruby
dougireton has joined #ruby
dsabanin has joined #ruby
<apeiros_>
also when current_user.! is defined
mpfundstein has quit [Quit: leaving]
ebouchut has joined #ruby
panpainter has quit [Ping timeout: 240 seconds]
meeko is now known as meeko_
mpfundstein has joined #ruby
Driscoll has joined #ruby
jds has joined #ruby
t0rc has joined #ruby
xemu has joined #ruby
mpfundstein has quit [Client Quit]
<doug>
!!current_user works when current_user is undefined?
<pasties>
doug: it does
<pasties>
doug: try this in irb - !!nil
<Mon_Ouie>
nil is defined
<karl________>
I have an array of objects (w% a b c), each object has a "addr" attribute and an array "names" (w% sue bob) attribute. How do I go about printing the "addr" attribute and the first element of the "names" array, if the "names" array contains a particular name ("sue")?
zastern has joined #ruby
<Mon_Ouie>
!!something_undefined won't work. The point was that !foo actually calls the #! method on foo.
t0rc has quit [Quit: WeeChat 0.3.9.2]
<Mon_Ouie>
Therefore, you can define foo.! to do something other than negation, in which case you can get different results from the two versions
<Hanmac>
doug: "current_user &= true" works :P
alex__c2022 has quit [Read error: Connection reset by peer]
h4mz1d has joined #ruby
panpainter has joined #ruby
hamfz__ has joined #ruby
alex__c2022 has joined #ruby
Neomex has joined #ruby
<karl________>
I'm doing:
<karl________>
a.names do |name|
<karl________>
if name =~ "sue"
_bart has quit [Ping timeout: 248 seconds]
<karl________>
puts a.addr, name
<pasties>
Mon_Ouie: While not the best solution, something like the following can be used safely (!!something rescue false)
alex__c2022 has quit [Remote host closed the connection]
<moos3>
is there away to display system command in realtime to console
<mensvaga>
Does anybody in here have experience with Logger? Can you tell me why something would get messed up if I had 2 logger objects?
<karl________>
but have problems when there are multiple names matching within the same object (multiple "sues" results in multiple prints of the same object)
jds has quit [Ping timeout: 248 seconds]
alex__c2022 has joined #ruby
<karl________>
moos3: you need to disable buffering
<Mon_Ouie>
!!something can be used safely. You should know whether or not `something` is defined.
Myconix has quit [Quit: Leaving]
<karl________>
moos3: is my guess
Takehiro has quit [Remote host closed the connection]
<moos3>
basically I wrote a wrapper for a shell command and I want to flush the ouput to the console so user can see it
<pasties>
Mon_Ouie: I agree :) was just putting forward a solution to the problem you presented
<karl________>
moos3: try putting STDOUT.sync = true at the top of your script
<moos3>
k
lkba has joined #ruby
akemrir has quit [Quit: WeeChat 0.3.9.2]
<mensvaga>
never mind on the logging thing; there was a bad file name.
emocakes has quit [Quit: emocakes]
kirun has quit [Read error: Operation timed out]
pyr0commie has joined #ruby
geekbri has quit [Remote host closed the connection]
miskander has quit [Quit: miskander]
koshii has quit [Ping timeout: 252 seconds]
koshii has joined #ruby
mpfundstein has joined #ruby
flyinprogramer has joined #ruby
miskander has joined #ruby
horofox_ has quit [Quit: horofox_]
jerius has quit [Ping timeout: 272 seconds]
MattRb has quit [Quit: MattRb]
havenn has quit [Remote host closed the connection]
havenn has joined #ruby
workmad3 has joined #ruby
<flyinprogramer>
so i'm running osx 10.8.2, using rvm and ruby 1.9.3; and i can't seem to get ruby to see my self-signed ssl certs in my keychain; i've added them to Login and System, and i've clicked on them after adding and made sure they are "Trust Always" - and google chrome seems to confirm that they're truly there, and yet still ruby throws up certificate verify failed (OpenSSL::SSL::SSLError);; if i do this: export SSL_CERT_FILE=[path to downloade
<flyinprogramer>
self-signed cert] it works, but that really isn't feasible -- any idea what i can try? i've tried restarting my terminal and restarting my machine after installing the certs, nothing seems to work :(
koshii has quit [Read error: Connection reset by peer]
froy has quit [Quit: kablam!]
koshii has joined #ruby
jjbohn has quit [Ping timeout: 272 seconds]
cyclops3590 has quit [Quit: ChatZilla 0.9.89 [Firefox 17.0.1/20121128204232]]
<yfeldblum>
karl________, %w(str1 str2 str3).any?{|s| s =~ regexp}
koshii has quit [Ping timeout: 248 seconds]
koshii has joined #ruby
elico has quit [Ping timeout: 276 seconds]
<karl________>
yfeldblum: completed that would look like "foo =~ %w(str1 str2).any?{|s| s =~ regexp}" ?
<yfeldblum>
karl________, no
s0ber has quit [Read error: Connection reset by peer]
sailias has quit [Quit: Leaving.]
<karl________>
by regexp you mean regex expression
<yfeldblum>
karl________, it's a local variable name, standing in for a regular expression
dsabanin has quit [Quit: Leaving...]
Goles_ has quit [Quit: Computer has gone to sleep.]
meeko has joined #ruby
s0ber has joined #ruby
headius has quit [Quit: headius]
Morkel has quit [Quit: Morkel]
meeko has quit [Client Quit]
dsabanin has joined #ruby
jaywastaken_ has joined #ruby
<karl________>
Could you help me do a complete example? I have an array of strings, stringArray. I want to determine if any of the elements of stringArray are equal to str1, str2, or str3. I do something like, stringArray.each do |teststring|, and then what?
Guest86486 has quit [Quit: Leaving]
<flyinprogramer>
yfeldblum: installed the cert everywhere :( no dice
mjolk has joined #ruby
<flyinprogramer>
yfeldblum: maybe if i mock out a cert directory and throw it in there it will work
<threeseven>
i haven't been doing ruby for very long, overall i must say that i'm impressed with how it let's you do whatever the fuck you want, but I also hate how it lets you do whatever the fuck you want
eldariof has quit []
havenn has quit [Ping timeout: 272 seconds]
mockra_ has joined #ruby
mockra has quit [Ping timeout: 256 seconds]
Neomex has quit [Quit: Neomex]
atyz has joined #ruby
yshh has quit [Ping timeout: 255 seconds]
<flyinprogramer>
yfeldblum: thanks for your help - that openssl wiki solved another friend's problem
_nitti has quit [Ping timeout: 240 seconds]
<Hanmac>
or h.each_with_object({}){|(k,v),h|h[k]=v+1}
<breakingthings>
Python: "There should be one-- and preferably only one --obvious way to do it."
<breakingthings>
Ruby: "There should be a few ways to do it."
<breakingthings>
Perl/LISP: "There should be lots and lots and lots of ways to do it!"
<Eiam>
Hanmac: hmm. ahh you are keeping it as an array
<Eiam>
yes, that makes more sense, removes the splat which people stumble over sometimes
<Eiam>
Hanmac: I like yours more than both of mine ;p
<Eiam>
your first one, not the second
<kenneth>
so you know how pry will use awesome print / inspect to print an object and will add newlines and indentation to make it more readable
<threeseven>
breakingthings: I wouldn't say that in LIPS there are "ways to do things" there's just LISP.
<Eiam>
except copy/pasting those objects back in sucks =(
<Eiam>
kenneth: ^
<Eiam>
my one complaint about awesomeprint
<kenneth>
is that supposed to kick in automatically or does that only work on certain things?
<diegoviola>
does the "There should be one-- and preferably only one --obvious way to do it." in Python refers only to function calls in the stdlib or also to libraries in general?
<Eiam>
threeseven: im in the process of learning scheme
<threeseven>
Eiam: Little Schemer?
<diegoviola>
what's with that mindset?
<Eiam>
threeseven: sicp
<Eiam>
diegoviola: best asked in #python probably =)
<Eiam>
Structure and Interpretation of Computer Programs
<threeseven>
Eiam: I'd do "The Little Schemer" first, it's like an afternoon's worth of work if you're not being too in depth about it and I love the tone of the book.
AlbireoX has joined #ruby
atyz has quit [Quit: Leaving...]
<threeseven>
SICP is god-tier though.
<Eiam>
threeseven: I'm not learning scheme to learn scheme, I'm learning it because sicp is taught in it. I'm more interested in re-establishing fundamentals I learned in 9th grade 15 years ago
<kenneth>
Eiam: scheme is awesome. i love all lisp though i prefer to use clojure myself
flyinprogramer has quit [Quit: flyinprogramer]
<Eiam>
the language I re-learn it in, as long as its not C++ again, is not too worrisome for me
<Eiam>
threeseven: My programming focuses more on achieving results and less on real science & organization, hence trying to go back to basics & re-learn
<asm>
similar to repl.it
<threeseven>
ahh yeah
<asm>
but more fun
<threeseven>
I'm definitely an academic programmer first.
<Eiam>
I'm definitely not
<Eiam>
haha
IceDragon has joined #ruby
<threeseven>
And a useful programmer like, fourth of fifth, after things like "Prodigious Stoner" and "Painter"
<breakingthings>
diegoviola it's a pervasive, all-encompassing idiom. any thing in python should be able to be done one way that should be considered the best way.
<threeseven>
^
<kenneth>
before i wrote my own custom inspect, it would throw in newlines etc. am i missing something?
<breakingthings>
I believe it goes from everything from language constructs, stdlib, third party libraries.
<breakingthings>
Not that they all should match, but that there should be no need to write something two different ways in two similar scenarios
atyz has joined #ruby
jlast has quit [Remote host closed the connection]
caveat- has quit [Remote host closed the connection]
dsabanin has quit [Quit: Leaving...]
tommyvyo has quit [Quit: Computer has gone to sleep.]
<diegoviola>
right
<diegoviola>
thanks
koshii has quit [Read error: Connection reset by peer]
<diegoviola>
but people actually do no?
<diegoviola>
even in python
caveat- has joined #ruby
<diegoviola>
they create different ways to achieve the same things
koshii has joined #ruby
atyz has quit [Client Quit]
dustint has quit [Remote host closed the connection]
d2dchat has quit [Remote host closed the connection]
<breakingthings>
diegoviola it's not that all libraries that do something should all be identical
<breakingthings>
but that if there is one way to do it, that should be the way to do it.
<diegoviola>
i see
<breakingthings>
eg, ruby has quite a few ways to just do a for/foreach loop.
doodlehaus has quit [Remote host closed the connection]
<arturaz>
anyway, you're probably right - its not worth it
<apeiros_>
arturaz: the performance difference between unordered and ordered hash in ruby most likely wouldn't differ by more than 1‰
picca has joined #ruby
TheEmpty_ has quit [Remote host closed the connection]
jaywastaken has joined #ruby
jaywastaken has quit [Changing host]
jaywastaken has joined #ruby
<apeiros_>
memory consumption OTOH were increased significantly. I'd like to still be able to have an unordered hash for cases where that matters
<apeiros_>
rare, but since most code could be shared…
billy_ran_away has joined #ruby
asm has left #ruby [#ruby]
alex__c2022 has quit [Quit: alex__c2022]
asteve has quit [Quit: Computer has gone to sleep.]
jaywastaken_ has quit [Ping timeout: 276 seconds]
huoxito has joined #ruby
panpainter has quit [Ping timeout: 260 seconds]
<arturaz>
apeiros_, just a switch ;)
<arturaz>
or something like OHash :)
<banisterfiend>
apeiros_: how is it increased significantly? it's just two pointers per element, that's like 8/16 bytes per element in the hash
<apeiros_>
arturaz: yeah, I'd have loved if they'd deprecated Hash (access = warning, remove in 2.0), make {}.class # => OrderedHash, and keep the old impl as UnorderedHash
atyz has joined #ruby
lepht_afk is now known as lepht
<apeiros_>
banisterfiend: it's 3x the amount than the element alone needs (ok, factor is a bit smaller since the bucket contains additional info)
koshii has joined #ruby
Goles has quit [Quit: Out.]
jgarvey has quit [Quit: Leaving]
yshh has joined #ruby
<apeiros_>
unless hashtables are limited to 2^32 entries, then it'd be only 2x the amount (never checked that… should read the source again one day…)
arturaz has quit [Remote host closed the connection]
<apeiros_>
I wonder if it would make sense to have something like Fixnum/Bignum for hashtables - I'd say most hashes contain less than 16 elements…
jerius has quit [Ping timeout: 272 seconds]
koshii has quit [Ping timeout: 255 seconds]
<banisterfiend>
apeiros_: i still dont think 16 extra bytes per element is going to hurt you unless you have truly enormous hashes
koshii has joined #ruby
<apeiros_>
banisterfiend: it's not about the *sum*, it's about the *factor*
<apeiros_>
and yes, it hurts in cases where you indeed do have large hashes. but as said, those are rare.
<apeiros_>
it also hurts if you have many big hashes
<GlenK>
so I ran "gem install factory_girl" and it tells me I need ruby 1.9.2. so I tried 'gem install factory_girl "> 3.6.2"' That didn't work either. I'm probably lost on what the "> 3.6.2" means though. any help?
ericjhedberg has quit [Remote host closed the connection]
<banisterfiend>
apeiros_: yes but it's just a pointer factor, so u have 3 times the amount of pointers, and pointers are tiny, it's not like the element itself (which could be pointing to an long string or whatever) is being duplicated
<apeiros_>
banisterfiend: and as said, I totally agree that the hash literal should be the ordered hash.
andrewhl has quit [Remote host closed the connection]
x0F has quit [Quit: Leaving]
<apeiros_>
banisterfiend: I'm aware of that
<apeiros_>
I don't know what makes you think I'm not
<apeiros_>
but 1 pointer vs. 3 pointers is a factor of 3
NimeshNeema has quit []
<banisterfiend>
but when the things themselves are tiny, it's more or less irrelevant, so the size of the hash grows O(n) in both cases (with or without ordering), but with a tiny constant in the case of ordering
lepht is now known as lepht_afk
centipedefarmer has joined #ruby
<apeiros_>
banisterfiend: you're beating dead horses :-)
<apeiros_>
*I KNOW THAT*
benlieb has quit [Quit: benlieb]
punkrawkR^Home has joined #ruby
philcrissman has quit [Remote host closed the connection]
koshii has quit [Remote host closed the connection]
koshii has joined #ruby
meeko has joined #ruby
kinginky has quit [Quit: Leaving]
ortuna has quit [Ping timeout: 255 seconds]
invisime has quit [Quit: Leaving.]
h4mz1d has quit [Ping timeout: 260 seconds]
hamfz__ has quit [Ping timeout: 272 seconds]
koshii has quit [Ping timeout: 272 seconds]
koshii has joined #ruby
yshh has quit [Ping timeout: 272 seconds]
atyz has quit [Quit: Leaving...]
yfeldblum has quit [Ping timeout: 260 seconds]
meeko has quit [Ping timeout: 272 seconds]
kennyvb has quit [Ping timeout: 248 seconds]
atyz has joined #ruby
kirun has quit [Quit: Client exiting]
atyz has quit [Client Quit]
daniel_hinojosa has quit [Ping timeout: 255 seconds]
mengu has joined #ruby
<rking>
OK guys, if you can dredge this from your 1.8 memories, how does this translate from 1.9 back: foo *x, :a => 1
kennyvb has joined #ruby
Takehiro has joined #ruby
<banisterfiend>
rking: *[*x, :a =>1]
<rking>
Oh OK
<rking>
Thankz champ
<banisterfiend>
no
<banisterfiend>
that wouldnt work
<banisterfiend>
hehe
<rking>
Well, I can just push that hash on the end of x
<rking>
Then splat
<banisterfiend>
yes
<apeiros_>
*(x+[{:a => 1}])
<rking>
Yeah, that saves me a temp actually
miskander has quit [Quit: miskander]
theRoUS has quit [Ping timeout: 264 seconds]
mmitchell has quit [Remote host closed the connection]
breakingthings has quit []
fourq has joined #ruby
fourq has quit [Client Quit]
willob has quit [Quit: Leaving.]
kennyvb has quit [Ping timeout: 245 seconds]
fourq has joined #ruby
Takehiro has quit [Ping timeout: 255 seconds]
mercwithamouth has joined #ruby
picca has quit [Remote host closed the connection]
jonahR has quit [Quit: jonahR]
alanp_ has joined #ruby
alanp has quit [Disconnected by services]
alanp_ is now known as alanp
kennyvb has joined #ruby
Russell^^ has joined #ruby
joeycarmello has quit [Read error: Connection reset by peer]
joeycarmello has joined #ruby
jstirnaman has quit [Quit: Leaving.]
moshee has quit [Ping timeout: 256 seconds]
moshee has joined #ruby
moshee has quit [Changing host]
moshee has joined #ruby
f0ster has joined #ruby
f0ster has left #ruby [#ruby]
eykosioux_ has quit [Quit: eykosioux_]
Tekhne has joined #ruby
<Tekhne>
is there a way to map/cast a model's attribute into a custom class/object automatically? (I tried #rubyonrails already.)
<Tekhne>
by model, I mean and activerecord model from Rails
koshii has quit [Ping timeout: 252 seconds]
<Tekhne>
s/and/an/
<rking>
apeiros_/banisterfiend: In the end, I'm just making a foo_extension18.rb and a foo_full_extension.rb, so I don't have to make the real one conform to 1.8 syntax when that code is actually only a bonus for 1.9. =\ Life is hard.
<blazes816>
Tekhne: I know they told you to come here but there makes more sense. regardless, you probably just want to write an accessor that wraps your attr as you want it.
infinitiguy1 has quit [Read error: Connection reset by peer]
infinitiguy has joined #ruby
fourq has left #ruby [#ruby]
x0F has joined #ruby
peregrine81 has quit [Quit: Computer sleeping.]
tilthouse has joined #ruby
jrist is now known as jrist-afk
<Tekhne>
blazes816: yea, that's what i'm doing now, but i thought i remembered there being some Rails-specific way of doing it. anyway, thanks.
philcrissman has joined #ruby
robbyoconnor has joined #ruby
Tekhne has left #ruby [#ruby]
yshh has joined #ruby
griffindy has quit [Quit: Computer has gone to sleep.]
madhadron has quit [Quit: Leaving.]
mengu has quit [Quit: This computer has gone to sleep]
nateberkopec has quit [Quit: Leaving...]
jtharris has quit [Quit: WeeChat 0.3.9.2]
philcrissman has quit [Remote host closed the connection]
<f0ster>
is there some way I can iterate over all properties/attributes on an object?
<apeiros_>
define property
<apeiros_>
instance variables?
<apeiros_>
methods?
<apeiros_>
constants?
<apeiros_>
class variables?
cantonic has joined #ruby
infinitiguy has quit [Quit: Leaving.]
<f0ster>
apeiros_: anything, I made a generic list of objects like.. @things = list.each do |x| { property: x.prop1, something: x.somethingelse }. Now I want to go through all the properties that are on each thing, without knowing their keys
<f0ster>
I assume doing the @things = {} was making a dynamic array of hashes
<apeiros_>
f0ster: {foo: "bar"} are not arbitary objects, those are Hash instances
Umren has quit [Read error: Connection reset by peer]
<apeiros_>
and you iterate over a hash by Hash#each
<apeiros_>
read the docs of Hash. other methods of interest: [], []=, .values, .keys, .each_value, .each_key
jonahR has quit [Remote host closed the connection]
segv- has quit [Quit: segv-]
<f0ster>
apeiros_: thats what I tried, it looks like my objects in my array are the same type of class that I read them from, in this case, it is Route
<f0ster>
so I get an error saying there is no "each" on Route
<f0ster>
@some_routes = Routes.each do |r| { name: route.name, ... } end
reset has joined #ruby
infinitiguy has joined #ruby
<f0ster>
I thought the type of object in the array would be generic from the @vars = {} behaviour in the do loop
bean has quit [Quit: Computer has gone to sleep.]
segv- has joined #ruby
segv- has quit [Client Quit]
infinitiguy1 has joined #ruby
<f0ster>
apeiros_: this is how I am getting the content exactly
<f0ster>
routes= Rails.application.routes.routes.map do |route| {alias: route.name, path: route.path.spec.to_s, controller: route.defaults[:controller], action: route.defaults[:action]} end
infinitiguy1 has quit [Read error: Connection reset by peer]
<f0ster>
I just want to loop over and print out all the key/values dynamically
infinitiguy1 has joined #ruby
infinitiguy has quit [Ping timeout: 252 seconds]
pavilionXP has quit [Ping timeout: 252 seconds]
<reactormonk>
f0ster, #rubyonrails
<f0ster>
reactormonk: not a rails question
<f0ster>
is it ?
<reactormonk>
f0ster, looks a lot like rails though
cha1tanya has joined #ruby
cha1tanya has quit [Changing host]
cha1tanya has joined #ruby
generalissimo has quit [Remote host closed the connection]
<f0ster>
yeah i am using rails, but my question has to do with ruby
infinitiguy1 has quit [Read error: Operation timed out]
infinitiguy has joined #ruby
schaerli has joined #ruby
n1x has joined #ruby
h4mz1d has joined #ruby
hamfz__ has joined #ruby
<f0ster>
reactormonk: or so I think, but I know little about ruby
<f0ster>
I would assume that loop is returning a generic array of hashes
jonahR has joined #ruby
<ryanf>
f0ster: it is
<ryanf>
you're talking about looping over the "routes" var after running the line you just pasted, right?
statarb3 has quit [Quit: Leaving]
<f0ster>
ryanf: yeah
pskosinski has quit [Ping timeout: 260 seconds]
<ryanf>
so if you do routes.each, the thing it's passing into the block is a hash. then if you want the keys/values from that hash, you have to call .each on it too
<ryanf>
is that not working?
<f0ster>
and so I try to do an each on each hash in the routes array, but it says undefined each on Route, so it is still a Route object and not a generic hash object
<f0ster>
correct
<ryanf>
can you just gist your actual code?
solidoodlesuppor has quit [Quit: ChatZilla 0.9.89 [Firefox 17.0.1/20121128204232]]
nateberkopec has joined #ruby
froy has joined #ruby
<f0ster>
well I am new to ruby and rails, but I am trying to dynamically make links to all of my controller actions in my rails application, so in the routes array I would do something like link_to "#{r.name} #{r.path}", or so I imagine, but path just looks like an address so I wanted to loop over everything in what I thought was the hash
fourq has quit [Quit: Lost terminal]
nemesit has quit [Quit: Leaving...]
<f0ster>
I could easily print out all the properties from each Route object because they look few, just trying to learn a ruby trick
<f0ster>
and understand more :)
Guest9041 has quit [Ping timeout: 245 seconds]
infinitiguy has quit [Read error: Operation timed out]
Guest9041 has joined #ruby
nateberkopec has quit [Client Quit]
gesman has quit []
mengu has joined #ruby
infinitiguy has joined #ruby
tommyvyo has joined #ruby
<f0ster>
ryanf: it's strange.. definitely not doing what I expect. e.g., in my routes array I can't access r.controller, but I can access r.defaults[:controller], so it's like my new hash wasnt even made, and its just an array of the original objects
infinitiguy1 has joined #ruby
yshh has joined #ruby
ltsstar has quit [Quit: ltsstar]
Vert has joined #ruby
<Eiam>
wonder how big this array is.. ap array.length > 5,048,466 =0
krisfremen has quit [Ping timeout: 252 seconds]
infinitiguy has quit [Ping timeout: 252 seconds]
RagingDave has quit [Read error: Connection reset by peer]
<ryanf>
f0ster: you're probably calling .each instead of .map