d2dchat_ has quit [Remote host closed the connection]
anonymuse has quit [Quit: Leaving.]
beilabs_ has joined #ruby
katherinem13_afk is now known as katherinem13
beilabs_ has quit [Client Quit]
beilabs_ has joined #ruby
headius has quit [Quit: headius]
nari has quit [Ping timeout: 245 seconds]
karasawa has quit [Ping timeout: 264 seconds]
karasawa has joined #ruby
Kingy has joined #ruby
rakuN has joined #ruby
jfl0wers has quit [Ping timeout: 245 seconds]
maletor has joined #ruby
heftig has quit [Quit: leaving]
jonahR has quit [Quit: jonahR]
i_s has quit [Quit: i_s]
Targen has quit [Ping timeout: 245 seconds]
reppard has joined #ruby
b1rkh0ff has quit [Ping timeout: 248 seconds]
ner0x has quit [Quit: Leaving]
aedornv has joined #ruby
robacarp has joined #ruby
heftig has joined #ruby
gyre008 has quit [Remote host closed the connection]
pu22l3r has joined #ruby
i_s has joined #ruby
pkrnj has joined #ruby
mjolk has quit [Quit: This computer has gone to sleep]
miskander has joined #ruby
hadees has joined #ruby
Vert has quit [Ping timeout: 252 seconds]
pu22l3r has quit [Read error: Connection reset by peer]
pu22l3r has joined #ruby
mrsolo has quit [Quit: Leaving]
etcetera has quit []
Nuck has quit [Ping timeout: 248 seconds]
aaronmacy has quit [Quit: Leaving.]
Nuck has joined #ruby
robotmay has quit [Read error: Connection reset by peer]
robotmay has joined #ruby
pu22l3r has quit [Remote host closed the connection]
rpminihan has quit [Ping timeout: 252 seconds]
etcetera has joined #ruby
tomzx has quit [Disconnected by services]
alvaro_o_ has quit [Quit: Ex-Chat]
karupanerura has quit [Excess Flood]
<JMcAfreak>
Wow.
<JMcAfreak>
I just made several major changes to the code in one of my files because it was returning results that weren't necessarily wrong, but weren't right.
slainer68 has quit [Remote host closed the connection]
<JMcAfreak>
And yet every time I would run it, I got the same results.
<JMcAfreak>
Until I realized I was executing the wrong file.
<JMcAfreak>
Now I get to figure out whether I just broke the file I was working on.
<Xeago>
what is mkmf?
karupanerura has joined #ruby
<Xeago>
is it makemakefile?
<Xeago>
and what should I do if ruby can't find that gem
<Xeago>
rubygems doesn't have it?
wargasm1 has joined #ruby
firefux has joined #ruby
<firefux>
Can the ensure clause have arguments and be used as a statement modifier?
<heftig>
no and no
swingha has joined #ruby
<firefux>
heftig: I'm confused by some code in a book, let me paste it
thinkclay has joined #ruby
yacks has joined #ruby
etcetera has quit []
robotmay has quit [Ping timeout: 260 seconds]
wargasm has quit [Ping timeout: 248 seconds]
<JMcAfreak>
Xeago: what is the error specifically?
Pip has quit [Quit: Leaving]
timonv_ has quit [Ping timeout: 252 seconds]
<JMcAfreak>
(if you answer in the next 10 minutes, I can help
<heftig>
just do begin; puts(exchange_rates.convert(line)); ensure; rate_mutex.unlock; end
<firefux>
heftig: maybe the ensure was supposed to be put in the next line?
<firefux>
firefux: or he was missing a ';'
<Mon_Ouie>
No, you need a begin … end to use ensure (or to be in a method body)
<JMcAfreak>
Xeago: did your problem suddenly go away?
rburton- has joined #ruby
etcetera has joined #ruby
katherinem13 is now known as katherinem13_
lkba has quit [Ping timeout: 240 seconds]
<firefux>
heftig: I think you have an extra ; there
<heftig>
firefux: no. replace ; with newlines
<firefux>
heftig: ah right
swingha has quit [Quit: WeeChat 0.3.9.2]
tjbiddle has quit [Ping timeout: 245 seconds]
tjbiddle_ is now known as tjbiddle
mmmmwww has quit [Client Quit]
hotovson_ has joined #ruby
reppard has quit [Ping timeout: 260 seconds]
bdnelson has joined #ruby
timonv has quit [Ping timeout: 245 seconds]
<JMcAfreak>
well, I'm gone
timonv has joined #ruby
truent has quit [Quit: Page closed]
katherinem13 has joined #ruby
miphe has quit [Quit: Leaving]
tjbiddle has quit [Read error: Connection reset by peer]
powerplay has quit [Quit: Leaving.]
bdnelson has quit [Client Quit]
alvaro_o has joined #ruby
<Xeago>
JMcAfreak: kinda
<Xeago>
I can dump the packets before sshd gets them
stonevil has quit [Read error: Connection reset by peer]
<Xeago>
and they are malformed
stonevil has joined #ruby
<Xeago>
and thusly get dropped
<Xeago>
it doesn't get malformed if I use a port above 1024
freeayu has joined #ruby
<Xeago>
(as 1 of the 11th to 18th bit specifically get
<Xeago>
malformed)
<shevy>
Xeago mkmf is usually provided with default ruby
sjuxax has joined #ruby
<shevy>
folks like the ubuntu dev team usually cripples it away
advorak has joined #ruby
jeffreybaird has quit [Quit: jeffreybaird]
<sjuxax>
Hello. I would like to "fork and forget" in Ruby. I am using Process.detach but my parent process still does not return until its child finishes.
ikonia has quit [Read error: Operation timed out]
enebo has quit [Quit: enebo]
tjbiddle has joined #ruby
io_syl has quit [Ping timeout: 255 seconds]
ikonia has joined #ruby
<advorak>
sjuxax, oh! I've been playing with Process recently, too ..
samuel02 has quit [Remote host closed the connection]
stopbit has joined #ruby
pskosinski has quit [Quit: Learn Life's Little Lessons]
<Xeago>
shevy: how would I install it now?
<shevy>
Xeago the ubuntu folks must have some way to decripple it
<aedornv>
Xeago: Did you compile/install Ruby from source?
<shevy>
probably via apt-get
baroquebobcat has quit [Ping timeout: 245 seconds]
<firefux>
I prefer to install ruby from source in my home dir
<shevy>
Xeago hmm I think you can do this via dpkg
<shevy>
yeah firefux
aaronmacy has joined #ruby
dukedave has quit [Ping timeout: 276 seconds]
<Xeago>
how?
<shevy>
hmm
<shevy>
dpkg --list # I think
<Xeago>
I want brew for other stuff than osx
<shevy>
yeah, that is my gripe too... brew should work on other OSes too
<shevy>
right now it is elitist :(
<Xeago>
:3
lkba has joined #ruby
<Xeago>
also
<Xeago>
ruby1.9.1 or ruby1.9.1full
<shevy>
"we use ruby, but only if you are a proper steve jobs nuthugger!"
RagingDave has quit [Quit: Ex-Chat]
yshh has joined #ruby
<shevy>
full = complete decrippling, so always go full
<Xeago>
damnit
jerius has joined #ruby
<shevy>
unless you run a "server OS"
<shevy>
then the debian folks will tell you "hey, you are a server, you won't need .h files ever"
* firefux
hugs debian
<Xeago>
it aint a server stupid kernel readers
<Xeago>
I just don't need a gui
<shevy>
hehe
<Xeago>
and the cputiming with server better suits my runlongjobs but edit at server workflow
dv_ has quit [Ping timeout: 248 seconds]
jrist is now known as jrist-afk
slainer68 has joined #ruby
<Xeago>
but damn
<Xeago>
240kb
<Xeago>
vs 140MB
sailias has joined #ruby
woolite64 has quit [Quit: Leaving]
dv_ has joined #ruby
dcope has quit [Excess Flood]
<shevy>
:P
dcope has joined #ruby
fred909 has quit [Ping timeout: 245 seconds]
<shevy>
140mb the world is coming to an end
<aedornv>
shevy: on our corporate network a 140MB download would take until the world's end to download.
icole has quit [Remote host closed the connection]
<Xeago>
shevy: only got 800MB
<aedornv>
if I had to use that connection I would cry. A river. Literally.
<Xeago>
well, now I only have 660
dougireton has quit [Quit: Leaving.]
stonevil has quit [Read error: Connection reset by peer]
stonevil has joined #ruby
<Eiam>
shevy: lol os x user = steve jobs nuthugger?
<aedornv>
anyway, I thought there was a ruby19-dev package anyway
<Eiam>
i just figured it was sane people that hate windows shell/power shell
<shevy>
Eiam no, but machomebrew -> written in ruby but only for apple users -> elitist exclusion
<Eiam>
shevy: I tried a few weeks ago to drop into 'shell' to get some shit done in windows 7 and i went into some hell hole of trying to install cygwin or powershell or something I dunno wtf was going on but I felt sorry for anyone that had to deal with it! =)
<aedornv>
I don't know why I had to use 'anyway' twice there.
<Eiam>
shevy: or "constraining your test & support matrix" =)
<shevy>
Eiam windows is pretty awful. it is possible to use some kind of bash though, and ruby works on it as well, so it is possible to workaround a few of its quirks
johnmilton has quit [Remote host closed the connection]
<Eiam>
or just buy a mac =p
timonv has quit [Ping timeout: 260 seconds]
<Eiam>
macbook airs are like $899 with a built in SSD, pretty good deal. thunderbolt too =p
<shevy>
power shell also has one good idea going for itself - piping objects
<Eiam>
(a 13" mba is my primary dev machine)
miskander has quit [Quit: miskander]
headius has joined #ruby
<shevy>
I'd wish we'd have something like piping objects in pure ruby too :(
jblack has joined #ruby
Targen has joined #ruby
<shevy>
back when I was on windows, there was one awesome tool... avisynth (+ virtualdub), it was like scripting for video/audio files
katherinem13 has quit [Quit: Lost terminal]
<shevy>
now if someone would just connect that into a shell with pipes...
katherinem13 has joined #ruby
<carlzulauf>
piping objects? like between two different ruby scripts?
yshh has quit [Remote host closed the connection]
<firefux>
Eiam: or just run a VM in windows
<shevy>
carlzulauf yeah... but I think more like on the OS level, so that it would be available to every program
dukedave has joined #ruby
<carlzulauf>
ah
dougireton has joined #ruby
timonv has joined #ruby
<shevy>
the default could be retained in unix pipes "default to text stream data"
yshh has joined #ruby
slainer68 has quit [Ping timeout: 248 seconds]
<carlzulauf>
so like if STDIN/STDOUT had complex data type support
<shevy>
yeah kinda
<shevy>
and combine that with virtual dub... so that the pipe would be like a workstation for every data you could possibly have on your computer, in a general and consistent way
jjbohn has joined #ruby
headius has quit [Ping timeout: 248 seconds]
<carlzulauf>
when you put it that way it starts to sound a little like DBus
tjbiddle has quit [Ping timeout: 256 seconds]
<carlzulauf>
I love DBus... mostly
ebobby has joined #ruby
<firefux>
Eiam: where do you find a mba for $900?
<firefux>
13"
Scriptonaut has quit [Ping timeout: 260 seconds]
rpminihan has joined #ruby
taoru has joined #ruby
<aedornv>
I hate DBus...
<carlzulauf>
i'd like to see all inter-process/inter-application/inter-server communication standardize on redis... but my dream will probably never come true
Spooner has quit [Quit: Leaving]
<Xeago>
firfux the 11" for €783.84 at discounted apple-store
<Xeago>
(online)
<carlzulauf>
that's a lot more than $900, no?
<Xeago>
it is
<Xeago>
but apple doesn't usually do conversion rates
<Xeago>
macbook for 999
<Xeago>
regardless of currency
<Xeago>
(usual)
huoxito has joined #ruby
<Xeago>
s/l)/lly)
bitcrave has quit [Ping timeout: 245 seconds]
sjuxax has left #ruby [#ruby]
<Xeago>
damnit
<Xeago>
stupid command-t not working
<Xeago>
freakin segv's
mydog2 has joined #ruby
<mydog2>
evening
xbayrockx has joined #ruby
xbayrockx is now known as wf2f
jjbohn has quit [Quit: Leaving...]
Mon_Ouie has quit [Ping timeout: 264 seconds]
browndawg has joined #ruby
jeffreybaird has joined #ruby
`brendan has joined #ruby
<ryanf>
Xeago: you probably compiled the extension against a different version of ruby from the one vim compiled against
joofsh has quit [Remote host closed the connection]
<Xeago>
I only have 1 ruby on my system
_hemanth_ has quit [Read error: Connection reset by peer]
c0rn has quit [Quit: Computer has gone to sleep.]
_hemanth_ has joined #ruby
<havenn>
Xeago: What version?
<Xeago>
1.9
<Xeago>
and indeed
c0rn has joined #ruby
<Xeago>
vim-nox does link against 1.8
<Xeago>
stupid apt
io_syl has quit [Remote host closed the connection]
io_syl has joined #ruby
taoru has quit [Remote host closed the connection]
richardjortega has quit [Read error: No route to host]
zeade has quit [Quit: Leaving.]
richardjortega has joined #ruby
hotovson_ has quit [Remote host closed the connection]
dr_neek has joined #ruby
justinleitgeb has joined #ruby
jeffreybaird has quit [Quit: jeffreybaird]
fred909 has joined #ruby
jjbohn has joined #ruby
tjbiddle has joined #ruby
fyolnish has joined #ruby
<Xeago>
gah
artOfWar_ has quit [Remote host closed the connection]
<Xeago>
match.c:51:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
stevechiagozie has joined #ruby
PragCypher has quit [Remote host closed the connection]
jeffreybaird has joined #ruby
tjbiddle_ has joined #ruby
<shevy>
Xeago the joy of being in a prison - the debian prison, you gotta love your prisons, my dear prisoner ;)
<Xeago>
I so love my osx server
<Xeago>
just because it is the same as what I use on the go
<Xeago>
but headless
<shevy>
hehe
tjbiddle has quit [Ping timeout: 276 seconds]
tjbiddle_ is now known as tjbiddle
<shevy>
I felt like that with gobolinux... it was the only distribution that, like ruby, I would have considered "elegant and beautiful" (though nixOS also had some great ideas)
ruzu2 is now known as ruzu
ruzu has quit [Changing host]
ruzu has joined #ruby
justinleitgeb has quit [Remote host closed the connection]
arya_ has quit [Ping timeout: 255 seconds]
nari has joined #ruby
syamajala has joined #ruby
tvw has quit [Remote host closed the connection]
syamajala has quit [Remote host closed the connection]
syamajala has joined #ruby
fred909 has quit [Ping timeout: 256 seconds]
taoru has joined #ruby
<Xeago>
ruby1.9.3 package is available?
syamajala has quit [Client Quit]
<Norrin>
what's wrong with rvm?
taoru has quit [Remote host closed the connection]
<swarley>
bloated. rbenv
<postmodern>
swarley, Norrin, chruby, even smaller than rbenv
<swarley>
yes, i use chruby
<postmodern>
ok i'll be quiet :)
<swarley>
Oh, also I had a small issue
<Xeago>
should I use ruby1.9.3 or ruby 1.9.1
connor__ has joined #ruby
<Norrin>
.3
<Xeago>
and 1.9.1full depends on xterm and x11shizzles?
<swarley>
postmodern; I had to modify the chruby function so that it would assign the RUBY env variable correctly
<swarley>
as is it was setting it to /opt/rubies/1.9.3
<postmodern>
Xeago, probably 1.9.3, although ubuntu names their 1.9.x packages ruby1.9.1
<postmodern>
swarley, ah you probably want to upgrade
<swarley>
Oh? I'm behind then?
<postmodern>
swarley, i had to use RUBY_ROOT instead of RUBY, since Rake uses the RUBY env variable
<swarley>
ohh, yeah. I noticed that quite soon
<swarley>
I just changed it to use bin/ruby at the end of the path.. But upgrading sounds a lot more stable
<postmodern>
speaking of which, need to prepare 0.3.2
<Xeago>
oh shit, I killed an apt-get in progress
dmiller1 has joined #ruby
<Eiam>
firefux: craigs list? refurb ?
blazes816 has quit [Quit: blazes816]
<Eiam>
firefux: you are right, lowest price i see is $911 for 11" macbook air, at macmall. 13" is 1096.
x82_nicole has quit [Quit: Computer has gone to sleep.]
maletor has quit [Quit: Computer has gone to sleep.]
ttt has joined #ruby
mockra has quit [Remote host closed the connection]
Hanmac has quit [Ping timeout: 260 seconds]
reppard has quit [Ping timeout: 264 seconds]
breakingthings has joined #ruby
pskosinski has joined #ruby
slainer68 has joined #ruby
fred909 has joined #ruby
jaequery has quit [Quit: Computer has gone to sleep.]
stonevil has quit [Quit: stonevil]
jblack has quit [Ping timeout: 276 seconds]
sn0wb1rd has quit [Quit: I will be right back]
g0bl1n has joined #ruby
squidBits has quit [Quit: whoops]
stevechiagozie has quit [Quit: Computer has gone to sleep.]
<mydog2>
hey guys.. maybe i'll have better luck than the php guys!
dougireton has quit [Remote host closed the connection]
slainer68 has quit [Ping timeout: 248 seconds]
jonahR has joined #ruby
jds_ has joined #ruby
daniel_- has quit [Ping timeout: 245 seconds]
<mydog2>
trying to find a good/sophisticated ruby landing pad site/app. looking for something that hooks into twitter/youtube/etc... as well as allowing users to login/complete a couple of forms, and read some static content..
karasawa has quit [Ping timeout: 264 seconds]
<mydog2>
any open source pointers that you've seen?
karasawa has joined #ruby
ninegrid has joined #ruby
otherj has joined #ruby
twoism_ has quit [Remote host closed the connection]
samphippen has quit [Quit: Computer has gone to sleep.]
djones__ has joined #ruby
tommyvyo has joined #ruby
cobragoa_ has quit [Remote host closed the connection]
<postmodern>
swarley, chruby 0.3.2 is out
AlchemyFalcon has joined #ruby
jds_ has quit [Ping timeout: 264 seconds]
joeycarmello has joined #ruby
etcetera has quit []
stevechiagozie has joined #ruby
<AlchemyFalcon>
why is a .each block not considered a loop? Is it that they're just two flavors of iterators?
theRoUS has joined #ruby
etcetera has joined #ruby
daniel_- has joined #ruby
eka has quit [Quit: Computer has gone to sleep.]
djones__ has quit [Ping timeout: 252 seconds]
AndChat| has joined #ruby
hadees has quit [Quit: hadees]
DatumDrop has joined #ruby
weeb1e has joined #ruby
weeb1e_ has quit [Ping timeout: 272 seconds]
<ryanf>
AlchemyFalcon: considered by whom?
<AlchemyFalcon>
ryanf: codeacademy.com
jjbohn has joined #ruby
Banistergalaxy has quit [Ping timeout: 264 seconds]
<AlchemyFalcon>
loops and blocks are two totally different sections
niklasb has quit [Read error: No route to host]
emocakes has quit [Quit: emocakes]
djones__ has joined #ruby
baphled has quit [Ping timeout: 240 seconds]
otherj has quit [Quit: otherj]
<GeekOnCoffee>
so they covered while in one section, and each in the next?
daniel_- has quit [Ping timeout: 276 seconds]
<GeekOnCoffee>
I can see why you'd cover them separately, but I wouldn't say .each isn't a loop
<AlchemyFalcon>
you know, it was kind of weird- .each was covered in the loops section very briefly, but then covered again in its own section way later after methods
headius has joined #ruby
<stevechiagozie>
.each is an iterator, which is a subset of loops
<AlchemyFalcon>
stevechiagozie: iterators are a subset of loops, and not the other way around?
<stevechiagozie>
you pass .each a block. a block is a larger concept in Ruby
<stevechiagozie>
IMO. I would put for…in (which you rarely see) as a loop
<stevechiagozie>
while, for..in, etc.
<AlchemyFalcon>
so blocks are those things which contain the meat for both methods and loops? is that gist of the concept of blocks?
Kingy has quit [Quit: Leaving]
<stevechiagozie>
You can think of a block as being somewhat like the body of an anonymous method.
<stevechiagozie>
and just like method a block can take parameters
<aedorn>
shevy: have you looked at Bodhi or elive? In terms of "elegant and beautiful" they're pretty neat. Debian based though
<AlchemyFalcon>
That makes sense. Are blocks not technically part of regular methods though?
F1skr has quit [Quit: WeeChat 0.3.9.2]
<shevy>
aedorn this is like cosmetics on a pig, the innards are debian :(
<shevy>
but enlightenment is cool
<aedorn>
hmmm what about calculate linux?
willob has joined #ruby
rpminihan has quit [Remote host closed the connection]
CaptainKnots has quit [Quit: bazinga!]
<stevechiagozie>
AlchemyFalcon: yes a method is considered a block
<aedorn>
CL13 is pretty nice in terms of aesthetics
kil0byte has joined #ruby
<shevy>
never heard of that before
<shevy>
lemme google
<stevechiagozie>
a block is simply a chunk of code enclosed between {} or do/end
kpshek has joined #ruby
<AlchemyFalcon>
oh ok. I guess I'm just over thinking it. Thanks.
jonahR has quit [Read error: Connection reset by peer]
<stevechiagozie>
AlchemyFalcon: you see the power of blocks as the class progresses (I'm assuming) as you create your own iterators or own methods that accepts blocks
jonahR has joined #ruby
<shevy>
AlchemyFalcon every method in ruby can accept a block
<AlchemyFalcon>
stevechiagozie: Unfortunately I think that's probably beyond the scope of this class. Codeacademy is really really basic, I just use it to quickly get familiar with a language.
<shevy>
you could actually put all logic into a block
butblack has joined #ruby
Axsuul has joined #ruby
<AlchemyFalcon>
if you passed a block to a method would the method definition look like this: def method( *stuff ) ...
<shevy>
def a; yield if block_given?; end; a { "here we put a natural language\nand another class interpretes this string\n" }
DatumDrop has quit [Ping timeout: 248 seconds]
<shevy>
this is a normal argument
<shevy>
def foo(*name)
willob has quit [Read error: Connection reset by peer]
<shevy>
for a block, you use {}
<shevy>
foo('whatever','here','does','not','matter') { 'here is the block!' }
kpshek has quit [Ping timeout: 245 seconds]
reppard has joined #ruby
shorts has joined #ruby
<shevy>
yield is the keyword to access the content of the block
<shevy>
block_given? is the check to query whether a block was given or not, to a method
dmerrick has quit [Quit: dmerrick]
<shevy>
I usually do: "yield if block_given?" inside a method
<AlchemyFalcon>
shevy: so the block is actually passed to the function as an argument, and is not just part of the definition?
CaptainKnots has joined #ruby
CaptainKnots has quit [Changing host]
CaptainKnots has joined #ruby
<shevy>
it is a special kind of argument
jduan1981 has quit [Ping timeout: 248 seconds]
<shevy>
all methods in ruby can always accept a block, without you having to define anything
<shevy>
foo()
<shevy>
foo() {}
<shevy>
you see?
<AlchemyFalcon>
interesting
<shevy>
it's cool, every method is more flexible whenever you want to
<shevy>
you could well use ruby without blocks for yourself
billy_ran_away has quit [Ping timeout: 255 seconds]
<shevy>
you can do something like this:
<shevy>
cliner {
<shevy>
puts 'hello world'
<shevy>
}
pac1 has joined #ruby
<shevy>
and clinere would be: def cliner; puts '=' * 80; end
<AlchemyFalcon>
totally. So just out of curiosity, how would you read "File.open('test.txt') {|handle| handle.puts 'test' }" in your head
<shevy>
oh, I dont actually do that
<shevy>
I wrote a method that just does it for me
<shevy>
save_file(data, '/test.txt')
<shevy>
I can't remember syntax ;)
jaequery has quit [Quit: Computer has gone to sleep.]
crank_ has quit [Client Quit]
<shevy>
the less I have to remember, the better
crank_ has joined #ruby
crank_ has quit [Client Quit]
<shevy>
I just want to use ruby as a lego building block
<AlchemyFalcon>
but I mean like if I'm reading some code and I want to figure out what it does, I would read a .each { |x| … } as "for each thing x, do …"
timonv_ has quit [Ping timeout: 245 seconds]
bricker`LA has joined #ruby
bricker`LA is now known as bricker
<AlchemyFalcon>
i would try to read "File.open('test.txt') {|handle| handle.puts 'test' }" as something like "open file test.txt, then " - I get stuck there because I don't really know _what_ handle is...
<AlchemyFalcon>
is handle in that case the file i've opened? similar to just setting handle = File.open(….) like you did earlier?
<shevy>
AlchemyFalcon well
<shevy>
you must first pay attention the the thing between ||
Michael_ has quit [Remote host closed the connection]
<shevy>
*to the
<shevy>
let me give you a simpler example
<shevy>
you have an array.. array = [1,2,3] ok?
<AlchemyFalcon>
so we basically create a variable when we use |thing|
<AlchemyFalcon>
ok
<shevy>
so via: array.each {|entry| puts entry }, entry would be 1, then 2, then 3
<shevy>
ok?
<AlchemyFalcon>
yep
<AlchemyFalcon>
do we at this point call entry a variable?
<shevy>
with the File.open thing, you gave that a name... can be anything... cal it x... it refers and assigns to test.txt, and via the .puts there, you write data to it
dcope has quit [Excess Flood]
<shevy>
yeah I think so
dcope has joined #ruby
<shevy>
let's call it a block variable, it probably has another name but whatever
djones__ has quit [Quit: djones__]
<AlchemyFalcon>
makes sense
<shevy>
perhaps it is a local variable, limited to the block scope only
<shevy>
but you could find out in irb
<AlchemyFalcon>
that would make sense too
<AlchemyFalcon>
how do you find that out in irb, .type?
<shevy>
a = 'hi'; [1,2,3].each {|a| puts a }; a
<shevy>
aha... a is now 3
x82_nicole has joined #ruby
<shevy>
at least in ruby 1.8.7
<shevy>
a moment AlchemyFalcon, let me test in 1.9.x
<shevy>
ok
<shevy>
in 1.9.x, a is still 'hi'
<shevy>
so I guess in 1.9.x it really is a local block variable
<AlchemyFalcon>
hmm super interesting
<shevy>
whereas in 1.8.x it would overwrite same named variables outside the block
jbw has joined #ruby
<shevy>
AlchemyFalcon yeah... I guess it may be better to use longer named variable names, in your block
alvaro_o has quit [Quit: Ex-Chat]
<shevy>
unless you are sure that there can not be any ambiguity
c0rn has quit [Quit: Computer has gone to sleep.]
<shevy>
I tend to always use the same names
<shevy>
array.each {|line| or {|entry|
<shevy>
cant remember which one I usually prefer
rakl has joined #ruby
Hanmac has joined #ruby
<AlchemyFalcon>
although in (I think I'm running 1.8.7) if you do (with a undefined) [1,2,3].each {|a| puts a}; a; irb says a is undefined
<shevy>
yeah
<shevy>
it's a bit limited
<shevy>
and not logical, in 1.8.x
snorkdude has joined #ruby
<shevy>
because why would the block be able to redefine an existing variable _outside_ the block on the one hand, yet in the other example, a would not exist at all whatsoever
hadees has joined #ruby
<shevy>
so I think they 1.9.x behaviour is more logical, and probably leads to less errors too
<AlchemyFalcon>
definitely intersting
i_s has quit [Quit: i_s]
iamjarvo has joined #ruby
Hanmac1 has quit [Ping timeout: 256 seconds]
Michael_ has joined #ruby
rmillerx has joined #ruby
DatumDrop has joined #ruby
<AlchemyFalcon>
thanks for the help shevy
willob has quit [Quit: Leaving.]
heftig has quit [Ping timeout: 256 seconds]
<shevy>
yay! go use ruby :D
MattRb has quit [Quit: This computer has gone to sleep]
<shevy>
we have to overthrow perl :P
ben_ has joined #ruby
heftig has joined #ruby
headius has quit [Quit: headius]
pu22l3r has joined #ruby
maletor has joined #ruby
jpfuentes2 has joined #ruby
Xeago has quit [Read error: Connection reset by peer]
Xeago has joined #ruby
sailias has quit [Quit: Leaving.]
dougireton has joined #ruby
dougireton has quit [Client Quit]
jds_ has joined #ruby
Xeago has quit [Read error: Connection reset by peer]
Xeago has joined #ruby
jerius has quit []
friskd_ has joined #ruby
djones__ has joined #ruby
heyitsdave has quit [Ping timeout: 252 seconds]
friskd_ has quit [Client Quit]
topriddy has joined #ruby
greenarrow has quit [Quit: IRC is just multiplayer notepad]
daniel_hinojosa has quit [Ping timeout: 240 seconds]
<aedorn>
I've successfully installed a basic Gentoo system using Ruby
<wildcard0>
did you have to compile ruby to do that?
<topriddy>
hi guys...i'm trying to install pry on my mac...tells me something about not having write permissions. i dont want to use sudo* because this seemed to have messed up my rails installation in the past...any help?
<topriddy>
i executed gem install pry
<ryanf>
topriddy: if you don't have write permissions to run gem install, you have to use sudo
greenarrow has joined #ruby
<ryanf>
just for the install part though, not to actually run pry later or anything
jds_ has quit [Ping timeout: 256 seconds]
rads has quit []
<ryanf>
it is probably a better idea to install ruby locally with rvm or rbenv though, and then you won't have to use sudo
friskd has quit [Ping timeout: 248 seconds]
c0rn has joined #ruby
moos3 has quit [Ping timeout: 260 seconds]
djones__ has quit [Client Quit]
<aedorn>
wildcard0: sort.. LiveUSB stick with Ruby and subsequent scripts on it that sets up the drive, downloads stage 3, and does the other setup to get it to a bootable state
jaequery has joined #ruby
eka has joined #ruby
arya_ has joined #ruby
<wildcard0>
cool
<topriddy>
ryanf: i already have ruby installed
DatumDrop has quit [Ping timeout: 255 seconds]
alienven1m has quit [Ping timeout: 255 seconds]
browndawg has quit [Read error: Connection reset by peer]
<topriddy>
ryanf: i installed ruby with rvm.
Xeago has quit [Read error: Connection reset by peer]
traph has quit [Quit: Lost terminal]
moos3 has joined #ruby
<topriddy>
please what do i do now?
<aedorn>
so proof of concept works... guess it's time to make something more practical
Xeago has joined #ruby
graft is now known as Guest42142
Guest75995 is now known as graft
alienvenom has joined #ruby
crackfu has joined #ruby
<bigmac>
!qwert!qwert
cha1tanya has joined #ruby
cha1tanya has joined #ruby
cha1tanya has quit [Changing host]
<ryanf>
topriddy: if you type "which ruby", what does it say?
bigmac is now known as i8igmac
<ryanf>
if you installed with rvm, you shouldn't have to use sudo
end_guy has quit [Remote host closed the connection]
<ryanf>
but if you installed it with sudo (i.e., globally instead of inside your user folder), you might need to add your user to the "rvm" group
<topriddy>
ryanf: it points to .../.rv,/rubies/ruuby-1.9.3/...
end_guy has joined #ruby
browndawg has joined #ruby
pac1 has quit [Remote host closed the connection]
<ryanf>
is the first ... your home directory?
<topriddy>
yes it is
<ryanf>
can you gist the output of "gem env"?
jduan1981 has joined #ruby
joshman_ has quit [Quit: Computer has gone to sleep.]
toekutr has left #ruby ["ERC Version 5.3 (IRC client for Emacs)"]
dougireton has quit [Ping timeout: 276 seconds]
skaczor has quit [Remote host closed the connection]
rakl has joined #ruby
dougireton has joined #ruby
connor__ has joined #ruby
katherinem13 has quit [Quit: leaving]
katherinem13 has joined #ruby
sayan has quit [Read error: Connection reset by peer]
nathancahill has joined #ruby
arya has joined #ruby
dawkirst_ has joined #ruby
_alejandro has joined #ruby
Goopyo has quit [Ping timeout: 252 seconds]
i8igmac has quit [Ping timeout: 248 seconds]
DatumDrop has joined #ruby
dawkirst_ has quit [Client Quit]
agarie has quit [Remote host closed the connection]
stopbit has quit [Quit: Leaving]
jjbohn has quit [Quit: Leaving...]
katherinem13 has quit [Quit: leaving]
headius has quit [Quit: headius]
katherinem13 has joined #ruby
joeycarmello has quit [Remote host closed the connection]
timonv_ has joined #ruby
swingha has joined #ruby
timonv has quit [Ping timeout: 245 seconds]
dougireton has quit [Quit: Leaving.]
_alejandro has quit [Remote host closed the connection]
kil0byte_ has joined #ruby
_veer has joined #ruby
_veer has quit [Changing host]
_veer has joined #ruby
kil0byt__ has joined #ruby
atno has quit [Remote host closed the connection]
kil0byte has quit [Ping timeout: 255 seconds]
generalissimo has quit [Remote host closed the connection]
ebobby has quit [Ping timeout: 264 seconds]
DatumDrop has quit [Ping timeout: 276 seconds]
kil0byte_ has quit [Ping timeout: 245 seconds]
hbpoison has quit [Ping timeout: 245 seconds]
mercwithamouth has quit [Ping timeout: 260 seconds]
shorts has quit [Remote host closed the connection]
shorts has joined #ruby
n1x has quit [Ping timeout: 245 seconds]
xybre1 has joined #ruby
shorts has quit [Remote host closed the connection]
shorts has joined #ruby
shorts has quit [Remote host closed the connection]
shorts has joined #ruby
ner0x has quit [Quit: Leaving]
tjbiddle has quit [Quit: tjbiddle]
jpfuentes2 has quit [Quit: Computer has gone to sleep.]
az7ar has joined #ruby
bluOxigen has joined #ruby
cobragoat has quit [Remote host closed the connection]
xybre1 is now known as xybr_
shorts has quit [Client Quit]
shorts has joined #ruby
ebobby has joined #ruby
templaedhel has quit [Quit: Leaving...]
h4mz1d has joined #ruby
bluOxigen has quit [Ping timeout: 256 seconds]
jduan1981_ has joined #ruby
jduan1981 has quit [Read error: Connection reset by peer]
jduan1981_ is now known as jduan1981
timonv has joined #ruby
dawkirst_ has joined #ruby
templaedhel has joined #ruby
timonv_ has quit [Ping timeout: 245 seconds]
shorts has quit [Quit: shorts]
shorts has joined #ruby
lolmaus has joined #ruby
timonv_ has joined #ruby
timonv has quit [Read error: Connection reset by peer]
yosafbridge has quit [Ping timeout: 252 seconds]
joeycarmello has joined #ruby
jazzanova has joined #ruby
arya has quit [Ping timeout: 248 seconds]
russfrank has quit [Ping timeout: 276 seconds]
<jazzanova>
how can I escape double quotes in a string?
russfrank has joined #ruby
yosafbridge has joined #ruby
sayan has joined #ruby
yacks has quit [Ping timeout: 246 seconds]
advorak has quit [Remote host closed the connection]
hbpoison has joined #ruby
arya has joined #ruby
<aedorn>
jazzanova: \"
ben_ has quit [Quit: ben_]
<jazzanova>
nevermind, i found it
<jazzanova>
.to_csv
Bry8Star has joined #ruby
kiyoura has quit [Quit: Leaving]
DatumDrop has joined #ruby
dukedave has quit [Read error: Connection reset by peer]
pu22l3r_ has quit [Remote host closed the connection]
headius has joined #ruby
opettaja has joined #ruby
headius has quit [Client Quit]
dougireton has joined #ruby
cobragoat has joined #ruby
jazzanova has quit [Quit: Page closed]
__BigO___ has quit [Remote host closed the connection]
arkiver has joined #ruby
crank_ has joined #ruby
rezzack has quit [Quit: Leaving.]
crackfu has joined #ruby
hbpoison has quit [Ping timeout: 264 seconds]
arya has quit [Ping timeout: 248 seconds]
madwilliamflint has quit []
butblack has quit [Read error: Connection reset by peer]
butblack has joined #ruby
Rydefalk has quit [Read error: Connection reset by peer]
ben_ has joined #ruby
butblack has quit [Client Quit]
Rydefalk has joined #ruby
yacks has joined #ruby
crackfu has quit [Ping timeout: 252 seconds]
dawkirst_ is now known as dawkirst
arya has joined #ruby
drago757 has quit [Quit: drago757]
frem has quit [Ping timeout: 248 seconds]
DatumDrop has quit [Ping timeout: 245 seconds]
hbpoison has joined #ruby
lkba has quit [Ping timeout: 248 seconds]
<dawkirst>
Hi, *very* new to Ruby and programming. How can I cache something for a set period of time?
fyolnish has quit [Remote host closed the connection]
lkba has joined #ruby
davidcel- has joined #ruby
timonv_ has quit [Ping timeout: 245 seconds]
cobragoat has quit [Remote host closed the connection]
erichmenge_ has joined #ruby
timonv has joined #ruby
generalissimo has joined #ruby
shorts has quit [Quit: away]
erichmenge has quit [Quit: Arrivederci!]
erichmenge_ is now known as erichmenge
dougireton has quit [Quit: Leaving.]
tps_ has quit [Quit: tps_]
jcrawford has quit [Excess Flood]
nomenkun has joined #ruby
fyolnish has joined #ruby
jjbohn has joined #ruby
cobragoat has joined #ruby
kil0byte has joined #ruby
generali_ has joined #ruby
generalissimo has quit [Read error: Connection reset by peer]
hackerdude has joined #ruby
dhruvasagar has joined #ruby
jcrawford has joined #ruby
kil0byt__ has quit [Ping timeout: 256 seconds]
karasawa has joined #ruby
macmartine has quit [Quit: Computer has gone to sleep.]
browndawg has quit [Quit: Leaving.]
jjbohn has quit [Ping timeout: 248 seconds]
EPIK has quit [Ping timeout: 260 seconds]
iamjarvo has quit [Quit: Leaving.]
BoomCow has joined #ruby
Fretta has quit [Quit: Fretta]
brandon|work has quit [Ping timeout: 272 seconds]
aaronmacy has joined #ruby
timonv has quit [Read error: Connection reset by peer]
timonv_ has joined #ruby
bitZero_1 has quit [Ping timeout: 252 seconds]
davidcelis has quit [Disconnected by services]
davidcel- is now known as davidcelis
davidcelis has quit [Changing host]
davidcelis has joined #ruby
a_a_g1 has joined #ruby
bitZero__ has joined #ruby
davidcel- has joined #ruby
MattRb has quit [Quit: This computer has gone to sleep]
DatumDrop has joined #ruby
<havenn>
dawkirst: What do you mean by cache? A variable?
io_syl has joined #ruby
io_syl has quit [Client Quit]
alup has quit [Ping timeout: 248 seconds]
davidcel- has quit [Client Quit]
kenneth has joined #ruby
tagrudev has joined #ruby
Liothen has joined #ruby
<havenn>
dawkirst: I'm not sure I understand your question, but if you mean temporarily assign an instance variable to something arbitrary, could do something like: @cache = 'temp'; Thread.new { sleep 30; @cache = nil }
io_syl has joined #ruby
a_a_g has quit [Ping timeout: 252 seconds]
MattRb has joined #ruby
bitZero__ has quit [Remote host closed the connection]
hbpoison has quit [Ping timeout: 276 seconds]
emmanuelux has quit [Remote host closed the connection]
bitZero__ has joined #ruby
subbyyy has quit [Ping timeout: 260 seconds]
crank_ has quit [Quit: crank_]
tonini has joined #ruby
hackerdude has quit [Remote host closed the connection]
jaequery has quit [Quit: Computer has gone to sleep.]
arya has quit [Ping timeout: 248 seconds]
DatumDrop has quit [Ping timeout: 276 seconds]
jjbohn has joined #ruby
maletor has quit [Quit: Computer has gone to sleep.]
BoomCow has quit [Quit: This computer has gone to sleep]
nwertman has quit [Read error: Connection reset by peer]
<shevy>
hey apeiros does halsbe also have .y files like this? listing the keywords and such
<apeiros>
shevy: I'm not using bison, so no, no .y files
connor__ has quit [Ping timeout: 260 seconds]
kil0byte has joined #ruby
voxal has quit [Quit: Page closed]
<apeiros>
for developing I use a ruby based parser.
karasawa has quit [Ping timeout: 264 seconds]
karasawa has joined #ruby
kil0byt__ has joined #ruby
moos3 has joined #ruby
yacks has joined #ruby
zeade has joined #ruby
mmitchell has quit [Ping timeout: 260 seconds]
dross has quit [Read error: Operation timed out]
a_a_g has quit [Quit: Leaving.]
companion has quit [Ping timeout: 255 seconds]
kil0byte_ has quit [Ping timeout: 276 seconds]
dross has joined #ruby
djones_ has joined #ruby
stonevil has quit [Quit: stonevil]
kil0byte has quit [Ping timeout: 252 seconds]
companion has joined #ruby
DatumDrop has joined #ruby
__BigO__ has quit [Remote host closed the connection]
zeade has quit [Ping timeout: 255 seconds]
daniel_- has joined #ruby
daniel_- has quit [Changing host]
daniel_- has joined #ruby
wubie has joined #ruby
iIlL10Oo has joined #ruby
<iIlL10Oo>
how to draw a line or a dot on the linux screen ?
<iIlL10Oo>
with out gems
<hoelzro>
iIlL10Oo: you mean in the terminal? or in X?
<Xeago>
line as a character-wide line, or a pixel?
<wubie>
If I subclass Array and override insert with: def insert(index, object); end;
<wubie>
Shouldn't that stop things being insertible in the array? (Via insert at least)
<iIlL10Oo>
Xeago: a pixel or pixel line , or wider is ok
<iIlL10Oo>
hoelzro: on X
<hoelzro>
iIlL10Oo: you'll need to use a binding to Xlib or xcb
<hoelzro>
that or implement the X wire protocol in Ruby.
<hoelzro>
I recommend the former twol
<hoelzro>
*two
<Xeago>
why not print ascii escape codes to terminal?
tvw has joined #ruby
<wubie>
Though the other (but related issue), is I'm trying this: def insert(index, object); raise Error if not self[index].nil?; self[index] = object; end; -- it raises Error every time, why?!
solidoodlesuppor has joined #ruby
solidoodlesuppor has quit [Client Quit]
<iIlL10Oo>
hoelzro: must install gems ?
<hoelzro>
iIlL10Oo: for xlib and xcb, probably
<hoelzro>
that or write a binding in C
<hoelzro>
iIlL10Oo: maybe you should describe why you're trying to draw a line on the screen?
<workmad3>
wubie: first, please consider not subclassing Array... it tends to not work correctly
Shrink has joined #ruby
<iIlL10Oo>
hoelzro: I want draw a snow screen, like on windows
<whowantstolivefo>
ezkl: ? i didnt figure out what i will do with this files.. i am newbie.. i finished reading guides in rubyonrails.page i am learnin slowly slowly
philcrissman has joined #ruby
volk_ has joined #ruby
<ezkl>
whowantstolivefo: That looks like the output of a koan to me.
kil0byte has quit [Remote host closed the connection]
<ezkl>
They message about `/home/aslan/Downloads/aslan/koans/about_asserts.rb:10` means you'll want to open that file with an editor and look at line #10
<ezkl>
You'll want to modify that line, save the file, and re-run the koans
dustint_ has joined #ruby
d2dchat has quit [Ping timeout: 252 seconds]
Fretta has quit [Remote host closed the connection]
dustint_ has quit [Client Quit]
<whowantstolivefo>
oo okay ezkl let me do it thank you
<ezkl>
whowantstolivefo: You're welcome. Have fun!
dustint has quit [Quit: Leaving]
dustint has joined #ruby
dbrgn has quit [Quit: leaving]
joofsh has quit [Remote host closed the connection]
jcrawford has quit [Excess Flood]
frogstarr78 has joined #ruby
osaut has joined #ruby
jcrawford has joined #ruby
etank has quit [Quit: WeeChat 0.3.9.2]
x82_nicole has joined #ruby
tps_ has joined #ruby
__BigO__ has joined #ruby
blaxter has joined #ruby
nari has quit [Ping timeout: 252 seconds]
obryan has joined #ruby
BizarreCake has joined #ruby
hbpoison has joined #ruby
joofsh has joined #ruby
emka has joined #ruby
boonedocks has left #ruby [#ruby]
mmitchell has quit [Remote host closed the connection]
jds_ has joined #ruby
boonedocks has joined #ruby
mmitchell has joined #ruby
RagingDave has joined #ruby
withnale has joined #ruby
dmiller has quit [Read error: Connection reset by peer]
connor_ has joined #ruby
nomenkun has quit [Remote host closed the connection]
theRoUS has joined #ruby
failshell has joined #ruby
nomenkun has joined #ruby
etank has joined #ruby
sc077 has quit [Remote host closed the connection]
jds_ has quit [Ping timeout: 256 seconds]
mafolz has quit [Quit: mafolz]
soc42 has quit [Remote host closed the connection]
stopbit has joined #ruby
ffranz has quit [Remote host closed the connection]
zommi has quit [Quit: Leaving.]
connor_ has quit [Ping timeout: 248 seconds]
d2dchat has joined #ruby
beliveyourdream has quit [Read error: Connection reset by peer]
DatumDrop has joined #ruby
adamjleonard has joined #ruby
pu22l3r has joined #ruby
ffranz has joined #ruby
v0n has quit [Quit: WeeChat 0.3.9.2]
hbpoison has quit [Read error: Connection reset by peer]
d2dchat has quit [Remote host closed the connection]
hbpoison has joined #ruby
pu22l3r has quit [Read error: Connection reset by peer]
ffranz has quit [Client Quit]
zeade has joined #ruby
v0n has joined #ruby
tagrudev has quit [Remote host closed the connection]
bean__ has joined #ruby
r3nrut has joined #ruby
crank1 has quit [Quit: Leaving.]
Raboo_ has quit [Ping timeout: 240 seconds]
carloslopes has joined #ruby
crank_ has joined #ruby
crank_ has quit [Client Quit]
crank_ has joined #ruby
olrrai has joined #ruby
Raboo has joined #ruby
AlchemyFalcon has joined #ruby
crank_ has left #ruby [#ruby]
crank_ has joined #ruby
zeade has quit [Ping timeout: 260 seconds]
hotovson_ has joined #ruby
maxmanders has joined #ruby
olrrai has quit [Client Quit]
xsarin has joined #ruby
hackerdude has joined #ruby
DatumDrop has quit [Ping timeout: 276 seconds]
daniel_- has joined #ruby
cba has joined #ruby
generalissimo has joined #ruby
w400z has joined #ruby
alta has joined #ruby
Liothen has quit [Remote host closed the connection]
karasawa has joined #ruby
tatsuya__ has joined #ruby
hackerdude has quit [Remote host closed the connection]
samphippen has quit [Quit: Computer has gone to sleep.]
jaequery has joined #ruby
alanjc has joined #ruby
Morkel has quit [Quit: Morkel]
_sillymarkets has joined #ruby
yacks has quit [Ping timeout: 260 seconds]
evanx has quit [Quit: evanx]
mockra has joined #ruby
etcetera has quit []
jjbohn is now known as jjbohn|afk
enroxorz-work has quit [Read error: Connection reset by peer]
swex_ has joined #ruby
swex has quit [Ping timeout: 252 seconds]
wallerdev has quit [Quit: wallerdev]
chrisramon has joined #ruby
djones_ has quit [Remote host closed the connection]
joeycarmello has joined #ruby
djones_ has joined #ruby
templaedhel has joined #ruby
apeiros has quit [Remote host closed the connection]
raulp has left #ruby [#ruby]
beiter has quit [Quit: beiter]
chrisramon has left #ruby [#ruby]
jjbohn|afk is now known as jjbohn
macmartine has joined #ruby
frem has joined #ruby
timonv has quit [Remote host closed the connection]
enroxorz-work has joined #ruby
fermion has joined #ruby
generalissimo has joined #ruby
_bart has quit [Ping timeout: 240 seconds]
skcin7 has joined #ruby
wallerdev has joined #ruby
hbpoison has quit [Ping timeout: 248 seconds]
alvaro_o has joined #ruby
io_syl has quit [Quit: Computer has gone to sleep.]
benlieb has joined #ruby
jonathanwallace has joined #ruby
vonsar has quit [Quit: This computer has gone to sleep]
samphippen has joined #ruby
etcetera has joined #ruby
daniel_- has joined #ruby
etcetera has quit [Client Quit]
wargasm has joined #ruby
dawkirst_ has joined #ruby
Monie has joined #ruby
zeade has joined #ruby
<dawkirst_>
hi, why is 'open("foo.jpeg", "wb") do |file|' working but 'open("foo.jpg", "wb") do |file|' is not?
nomenkun has quit [Remote host closed the connection]
<workmad3>
dawkirst_: because foo.jpeg exists, and foo.jpg doesn't maybe?
<Hanmac>
dawkirst_ they should both work ... show us a pastie of your entire code
jph_ has left #ruby [#ruby]
<dawkirst_>
workmad3, nope
<dawkirst_>
Hanmac, ok
<Mon_Ouie>
workmad3: Notice he's opening the file for *writing*, not reading ;)
Vert has joined #ruby
<workmad3>
Mon_Ouie: oh yeah... d'oh
Goles has quit [Ping timeout: 252 seconds]
* workmad3
fails @ reading
connor_ has joined #ruby
yacks has joined #ruby
mk03 has joined #ruby
kinginky has quit [Remote host closed the connection]
<Hanmac>
workmad3 i think he uses other functions that uses file.path for some kind of convert magic, and maybe the other function is too dump to understand .jpg too :D
<dawkirst_>
Hanmac, not sure about the other funcitons
benlieb has quit [Quit: benlieb]
noxoc has quit [Quit: noxoc]
<dawkirst_>
Hanmac, so with .jpg the file is opened, and written to, but it is garbled. With .jpeg it is not.
<Mon_Ouie>
And when you say it doesn't work, what do you mean?
connor_ has quit [Ping timeout: 256 seconds]
<Hanmac>
dawkirst_ what happend if you do 'File.open("foo.jpg", "wb") do |file|' ?
templaedhel has quit [Quit: Leaving...]
bitcrave has joined #ruby
<dawkirst_>
Mon_Ouie, it's garbled -- but here's something interesting, when I copy the file it's fine (it's not garbled). So it appears as if some function is using it.
hbpoison has joined #ruby
Vainoharhainen has quit [Quit: Leaving...]
templaedhel has joined #ruby
<dawkirst_>
Oof, am I making any sense?
Goles has joined #ruby
nga4 has joined #ruby
Kakera has joined #ruby
<Kakera>
how do you pass a class method as a block?
Goles has quit [Remote host closed the connection]
<Kakera>
['a','b'].map String.new
<Kakera>
this doesn't work because it actually invokes the new method
jonathanwallace has quit [Ping timeout: 246 seconds]
<Mon_Ouie>
The block syntax is some_method { |arguments| … }
<JonnieCache>
Mon_Ouie: i thought when you made a hash with a default value it got reused
bricker has quit [Ping timeout: 240 seconds]
<Kakera>
it would if I just wrote Hash.new MyClass.new
<Mon_Ouie>
Sure, but he's creating a hash with a default proc, not a default value
iamjarvo has quit [Quit: Leaving.]
grzywacz has quit [Ping timeout: 248 seconds]
<JonnieCache>
yeah im with you
BeLucid has joined #ruby
<Hanmac>
kakera: information about default proc and default value: hashs with default proc are not Marshalable anymore ... if it does affect you
<Kakera>
I don't know what that means so probably not
friendmaster has joined #ruby
tatsuya_o has quit [Ping timeout: 272 seconds]
daniel_-_ has joined #ruby
ffranz has quit [Quit: Leaving]
<Hanmac>
kakera with marshal you could serialize stuff ... (maybe for writing them in binary files like game saves)
daniel_-_ has quit [Client Quit]
templaedhel has quit [Quit: Leaving...]
zigomir has quit [Quit: zigomir]
ffranz has joined #ruby
boonedocks has quit [Quit: boonedocks]
robotmay has quit [Remote host closed the connection]
aeontech has quit [Quit: aeontech]
daniel_-_ has joined #ruby
bricker__ is now known as bricker
BoomCow has left #ruby ["Leaving"]
cdt has quit [Read error: Operation timed out]
w400z has quit []
daniel_- has quit [Ping timeout: 252 seconds]
dougireton has quit [Quit: Leaving.]
_bart has joined #ruby
pyro111 has quit [Quit: Leaving]
vonsar has joined #ruby
stkowski has joined #ruby
s1n4 has joined #ruby
dmiller1 has joined #ruby
fjfish has quit [Remote host closed the connection]
rakl has joined #ruby
jblack_ has joined #ruby
hbpoison has quit [Ping timeout: 246 seconds]
mahmoudimus has joined #ruby
jimeh has quit [Quit: Computer has gone to sleep.]
crank_ has quit [Ping timeout: 272 seconds]
bean__ has quit [Quit: Computer has gone to sleep.]
crank_ has joined #ruby
haxrbyte has quit [Ping timeout: 255 seconds]
daniel_-_ is now known as daniel_-
bean__ has joined #ruby
daniel_- has quit [Quit: WeeChat 0.3.9.2]
s1n4 has quit [Quit: leaving]
Glacer232 has joined #ruby
dougireton has joined #ruby
arturaz has joined #ruby
cobragoat has joined #ruby
etcetera has joined #ruby
lusory has quit [Ping timeout: 276 seconds]
_bart has quit [Ping timeout: 260 seconds]
sn0wb1rd has quit [Quit: sn0wb1rd]
jlast_ has quit [Ping timeout: 260 seconds]
frogstarr78 has quit [Ping timeout: 252 seconds]
jtharris has joined #ruby
h4mz1d has joined #ruby
Criztian has quit [Remote host closed the connection]
evanx has joined #ruby
frogstarr78 has joined #ruby
haxrbyte has joined #ruby
<gyre007>
guys I'm trying to run sinatra app...using runit service for thin but I'm getting the following error: chpst: fatal: unable to run: bundle: file does not exist
<gyre007>
strange thing is that the bundle DOES exist and if I change into that directory and execute the same command it works just fine...
dougireton has quit [Remote host closed the connection]
<workmad3>
gyre007: check the PATH that the runit service is attempting to use
slainer68 has quit [Remote host closed the connection]
<gyre007>
very simple...
<gyre007>
mm
dougireton has joined #ruby
a_a_g has quit [Quit: Leaving.]
<Kakera>
this is really basic, but how do you set an object's property inside the constructor
<banister`sleep>
Kakera: @property = blah
mongag has joined #ruby
<Kakera>
then what's 'self'
<davidcelis>
the instance
breakingthings has quit []
<Hanmac>
Kakera: you need "self.property = blah " when you want to call the setter function
<Kakera>
what's the difference between self.p and @p
<davidcelis>
if you were to do `self.property = blah`, it would expect the `property=` method to be defined
<davidcelis>
Kakera: `self.p` is a method, which probably returns @p
chrismcg is now known as zz_chrismcg
<davidcelis>
Kakera: google for attr_reader, attr_writer, and attr_accessor
Markvilla has joined #ruby
icole has joined #ruby
JohnBat26 has joined #ruby
<davidcelis>
read about those and you'll understand
marxarelli has joined #ruby
templaedhel has joined #ruby
templaedhel has quit [Remote host closed the connection]
sjuxax has joined #ruby
<cschneid>
does anybody have rb-fsevent working on osx 10.8? Its breaking my use of guard, and when used directly from irb, it's not seeing changes. Any suggestions?
<Kakera>
how do you access an object's member
<davidcelis>
member?
<Mon_Ouie>
member? You mean instance variable?
<Kakera>
from outside the class
<Kakera>
yes
<davidcelis>
again, do some research on attribute accessors
<Mon_Ouie>
Define an accessor for it, e.g. using attr_accessor
<Kakera>
you can't do it without accessors?
havenn has joined #ruby
kenneth has quit [Quit: kenneth]
<davidcelis>
you can use instance_variable_get
<Mon_Ouie>
You can, but that's not what you should do in a normal situation
<davidcelis>
but just define accessors
<Kakera>
okay
<Kakera>
I'll just use a hash instead
<sjuxax>
Hello. Suppose I want to execute a chunk of code until a certain variable is reached. I understand some of Ruby's structures may support this but I'd like more information on their exact mechanism of action. Do they return back to the loop after each line of code to re-evaluate the condition? I need to make some code run only for x seconds, and abort if that time is exceeded. I know how to do this basically, but is there a way to do it well over a chunk of
<davidcelis>
...
<davidcelis>
wtf
noxoc has joined #ruby
<Kakera>
since it will only store two arrays
noxoc has quit [Client Quit]
NemesisD has joined #ruby
<davidcelis>
sjuxax: the condition is checked each time the loop is run, not each time a line is evaluated
timonv has joined #ruby
<davidcelis>
or, rather, each time the block passed to the loop is run
<havenn>
sjuxax: Wrote a #keep_doing_for method last night, curious what the optimal way to do this is: https://gist.github.com/4545241
Elhu has quit [Quit: Computer has gone to sleep.]
<NemesisD>
is there a library or common pattern in ruby for a work queue that has an end? Queue seems like it doesn't fit well for a finite amount of work
<davidcelis>
NemesisD: why not?
w400z has joined #ruby
<sjuxax>
davidcelis: Right, that's what I thought. Is there a reasonable way to interrupt code more frequently?
S1kx has quit [Quit: Leaving]
eldariof has joined #ruby
<NemesisD>
davidcelis: because you need a separate threadsafe mechanism for flagging that there will be no more work put into the queue
<davidcelis>
sjuxax: do you really need to? how long does one iteration of your block take to run?
Nisstyre-laptop has quit [Ping timeout: 252 seconds]
<davidcelis>
sjuxax: you can dedicate one line of the block to breaking if the time limit has been exceeded
<NemesisD>
davidcelis: you also need to make sure your queue pops are nonblocking in that case and the mechanism that Queue has for tha
<NemesisD>
t is pretty silly, catching ThreadError
timonv has quit [Remote host closed the connection]
<davidcelis>
lol
<NemesisD>
if your consumers outpace your producer, a queue will be empty but not necessarily done
<havenn>
cschneid: I get told Timeout.timeout is an anti-pattern. (Prolly because it relys on exceptions for flow control?)
<davidcelis>
if threading is an issue for you, you could check out the sidekiq queueing library; though that uses redis as a backend, so if you don't want to add another service, im not sure
DrShoggoth has joined #ruby
<cschneid>
presumably it's an exceptional case that you can't reach the outside world or whatever you're doing. Anyway, meh. Keeping messes localized is not terrible, don't use exceptions for massive flow control, but at some point, timeout will use system level signal ugliness to work
<cschneid>
and that's just how it needs to be in order to work. I can't think of another way to interrupt a line of ruby code
<NemesisD>
davidcelis: oh i already use resque in my app, but i'm looking for a cheap, in-process way to do 2 things at once: pull lots of data from the web into a queue-like data structure and then work that queue off, all within a job
<workmad3>
NemesisD: well, a queue implies that you're working it in order
<workmad3>
NemesisD: so why not just push on a work item for 'end of queue'?
jduan1981 has joined #ruby
<NemesisD>
workmad3: order isn't important, you're right, but i don't follow your meaning
<workmad3>
NemesisD: well, you're pushing items onto a queue, and they'll be pulled off the front of the queue while you add to the back, right?
dr_neek has quit [Quit: dr_neek]
<workmad3>
NemesisD: it isn't like an item is going to be removed from the middle or the end
<NemesisD>
if producer is in a thread pushing work, consumers are taking work out of the queue (for lack of a better term), producer needs a way to signal that it is done, so workers must empty out the queue and go away
Xeago has quit [Remote host closed the connection]
<workmad3>
NemesisD: so when your producer has pushed all the work onto the queue, it simply adds on a final item of 'FinishNow' and goes away
shevy2 has joined #ruby
rdark has quit [Quit: leaving]
Spooner has quit [Remote host closed the connection]
<NemesisD>
workmad3: that would work ok with 1 worker, but not with multiple worker threads
karasawa has quit [Ping timeout: 252 seconds]
<sjuxax>
thanks guys, cschneid especially. Timeout is a great help and is already working. :) Thanks.
dr_neek has joined #ruby
<NemesisD>
i was just curious if there's a library out there for this, i can't be the only person to have ahd this problem, searching isn't coming up with much
<cschneid>
sjuxax: there are fancier versions of that with retry and similar
samphippen has quit [Quit: Computer has gone to sleep.]
MattRb has joined #ruby
<NemesisD>
if i have a common problem and i can't find a published solution in ruby, i wonder if my approach is wrong
karasawa has joined #ruby
advorak has quit [Remote host closed the connection]
vlad_starkov has quit [Remote host closed the connection]
dr_neek has quit [Client Quit]
shevy has quit [Ping timeout: 246 seconds]
Virunga has joined #ruby
nkts has quit [Ping timeout: 245 seconds]
aeontech has joined #ruby
Cicloid has joined #ruby
<NemesisD>
anyone have any experience with peach? (parallel each)
elaptics is now known as elaptics`away
Markvilla has quit [Quit: Computer has gone to sleep.]
sn0wb1rd has joined #ruby
IrishGringo has joined #ruby
osaut_ has joined #ruby
_br_ has quit [Excess Flood]
aeontech has quit [Client Quit]
Nisstyre-laptop has joined #ruby
<NemesisD>
it iterates over an enumerable and spawns a thread per item to execute the block. i am curious if the block is IO bound if it would see a speedup in MRI
a_a_g has joined #ruby
aeontech has joined #ruby
bricker is now known as bricker`la
workmad3 has quit [Ping timeout: 264 seconds]
bricker`la is now known as bricker`LA
osaut has quit [Ping timeout: 256 seconds]
osaut_ is now known as osaut
_br_ has joined #ruby
iamjarvo has joined #ruby
jds_ has joined #ruby
mrsolo has joined #ruby
_br_ has quit [Excess Flood]
n1x has joined #ruby
brianpWins has joined #ruby
connor_ has joined #ruby
<arturaz>
NemesisD, it would
_br_ has joined #ruby
chussenot has quit [Ping timeout: 245 seconds]
b1rkh0ff has quit [Ping timeout: 255 seconds]
jds_ has quit [Ping timeout: 276 seconds]
daniel_- has joined #ruby
daniel_- has quit [Changing host]
daniel_- has joined #ruby
francisfish has joined #ruby
g0bl1n has joined #ruby
g0bl1n has quit [Changing host]
g0bl1n has joined #ruby
connor_ has quit [Ping timeout: 248 seconds]
osaut has quit [Quit: osaut]
geekbri has quit [Remote host closed the connection]
djones__ has quit [Remote host closed the connection]
djones__ has joined #ruby
Guest63297 has quit [Ping timeout: 245 seconds]
dougireton has quit [Client Quit]
willob has joined #ruby
willob has quit [Max SendQ exceeded]
AlchemyFalcon has joined #ruby
djones_ has quit [Ping timeout: 252 seconds]
iamjarvo has quit [Quit: Leaving.]
dougireton has joined #ruby
karasawa has quit [Ping timeout: 244 seconds]
danneu has quit [Quit: WeeChat 0.3.8]
mark_locklear has quit [Remote host closed the connection]
dougireton has quit [Client Quit]
JumpMast3r has joined #ruby
sayan has joined #ruby
clocKwize has joined #ruby
kyle__ has left #ruby [#ruby]
rvmeier has quit [Quit: Leaving]
<lectrick>
I love you all. Because we all think this language is beautiful, and because I would have a hard time explaining why to someone on the street. And for that I am grateful.
* apeiros
thinks it's easy to explain
<apeiros>
"it feels good, it allows me to do more, using less of my time"
Xeago has joined #ruby
<apeiros>
even understandable by non-programmers :)
dougireton has joined #ruby
<RubyPanther>
Because Ruby cares about the programmer, not the CPU.
greasegum has joined #ruby
greasegum has quit [Read error: Connection reset by peer]
dougireton has quit [Client Quit]
sayan has quit [Read error: Connection reset by peer]
slainer68 has joined #ruby
piotr__ has joined #ruby
snearch has joined #ruby
dougireton has joined #ruby
<Kakera>
is there a shorter way to write Hash.new { |hash, key| hash[key] = Hash.new } ?
piotr_ has quit [Ping timeout: 245 seconds]
Playground is now known as lolcathost
whowantstolivef1 has quit [Ping timeout: 248 seconds]
Vainoharhainen has joined #ruby
jibi has joined #ruby
jibi has quit [Client Quit]
arkiver has quit [Ping timeout: 246 seconds]
clocKwize has quit [Quit: clocKwize]
etcetera has quit []
kirun has joined #ruby
<banister`sleep>
apeiros: it rocks out my D.
benlieb has quit [Quit: benlieb]
jblack_ has quit [Ping timeout: 252 seconds]
Vainoharhainen has quit [Client Quit]
clocKwize has joined #ruby
malte_ has quit [Quit: malte_]
ryannielson has quit [Read error: No route to host]
Dann1 has joined #ruby
benlieb has joined #ruby
etcetera has joined #ruby
JMcAfreak has joined #ruby
etcetera has quit [Client Quit]
kil0byte has joined #ruby
grzywacz has quit [Ping timeout: 248 seconds]
dmiller1 has quit [Ping timeout: 276 seconds]
_sillymarkets has quit [Ping timeout: 245 seconds]
<Mon_Ouie>
Hash.new{|h,k|h[k]={}}
<Mon_Ouie>
(In practice, I wouldn't actually drop the spaces)
bdry has joined #ruby
MattRb has quit [Quit: This computer has gone to sleep]
<banister`sleep>
Mon_Ouie: if i give u a torrent to dl c&c3, will u get it and play me multiplayer?
<bdry>
Wagwaan
<heftig>
I like Hash.new { |h,k| h[k] = Hash.new(&h.default_proc) }
<bdry>
When bounds testing something, is it worth having separate tests for both boundaries, or worth putting them in one?
ikolito has joined #ruby
<bdry>
It seems at-the-time better to test both assertions in one; but better long-term to have them separated, and long-term matters more with testing... what do you think?
AlchemyFalcon has quit [Quit: AlchemyFalcon]
<frem>
banister`sleep: ಠ_ಠ
<banister`sleep>
frem: did you see the gist i postd for you the other day?
<banister`sleep>
frem: you seemed to have disappeared
blaxter has quit [Quit: foo]
<frem>
banister`sleep: I don't think I did. Internet connection was a bit flaky.
<frem>
banister`sleep: I figured out how it was working, eventually. Way down towards the end of the file it was extending activerecord with all it's methods.
<banister`sleep>
frem: oh ok, well i think that gist met your original specs, but tbh i wasn't 100% sure what you were asking me :)
vonsar has quit [Quit: This computer has gone to sleep]
albakry has joined #ruby
w400z has quit []
<frem>
Ruby 1.9 already broke hash behavior
<shevy2>
hmm I have two arrays
enebo has joined #ruby
<shevy2>
array1 = [11,22,33]; array2 = [66,77,88] ... is there a simple way to merge both into a new array new_array = [ [11,66], [22,77], [33,88] ] ?
<heftig>
zip
<aedornv>
shevy2: array1.zip(array2)
<shevy2>
cool
<shevy2>
thanks you two
<aedornv>
Is there a reason (besides readability) to use 'lambda' over -> ? I keep thinking there was some reason I chose not to but I can't remember now...
Spami has joined #ruby
Spami has quit [Changing host]
Spami has joined #ruby
samphippen has quit [Quit: Computer has gone to sleep.]
skcin7 has quit [Ping timeout: 252 seconds]
tethra has joined #ruby
<banister`sleep>
aedornv: they couldn't figure out how to do default parameters with the old lambda syntax, so they invented -> which culd do defaults
<banister`sleep>
aedornv: but they subsequently figured out how to do it with lambda
speakingcode has joined #ruby
ephemerian has joined #ruby
<speakingcode>
i have two classes in same file. class A and class B, separate from each other. why can't i create an object of class B inside of class A?
<banister`sleep>
speakingcode: you need to show your code befoer we can make senes of that statement
spinagon has quit [Ping timeout: 252 seconds]
<speakingcode>
class A .... end class B... end
<aedornv>
So ... there's no reason now to use one over the other? Glorious
<speakingcode>
inside of class A: myobject = B.new
<banister`sleep>
speakingcode: where are you doing it inside class A ?
<swarley>
That macro, cost me a fair amount of grief
<Hanmac>
speakingcode: let "class A file" require "class B file"
<swarley>
I had to clone into the repo and grep to find it. And it seems almost pointless
<speakingcode>
they're in the same file
<havenn>
speakingcode: You want B to be a namespace under A?
<banister`sleep>
speakingcode: you mean a class instance variable?
<lectrick>
Kakera: Mon_Ouie: Note that that technique will only work down to 2 levels of hash. After that it will still be nil. If you want something that works down to infinite levels, you will have to get cleverer...er
<havenn>
speakingcode: Gist the code?
<speakingcode>
.... it's very basic. two classes
<speakingcode>
i want an object of one, in the other
<lectrick>
also heftig
<banister`sleep>
speakingcode: are you sure you want a class instance variable? how new are you to ruby?
<Mon_Ouie>
lectrick: I know. Like heftig's example.
<lectrick>
Mon_Ouie: Oh, just read that. Yeah, heftig's is the way to go
<speakingcode>
i'm sure i want an instance variable.
<Hanmac>
speakingcode: class A; class B; end: end or just make two files
<speakingcode>
an object of class B will be a member of an object of class A
<banister`sleep>
speakingcode: i said *class* instance variable, as opposed to a variable that belongs to an instance
Criztian has joined #ruby
<banister`sleep>
speakingcode: well then u're doing it wrong
<banister`sleep>
speakingcode: you want to do it in intialize()
bdry has quit [Ping timeout: 245 seconds]
<havenn>
speakingcode: class A; def call; B.new; end; end; class B; end; A.new.call #=> #<B:0x107b597f0>
kenneth has quit [Ping timeout: 248 seconds]
<banister`sleep>
class A; end; class B; def initialize(); @a = A.new; end; end
<banister`sleep>
that will work
<speakingcode>
so instance variables have to be defined inside of initialize?
<banister`sleep>
speakingcode: yes
<banister`sleep>
speakingcode: or inside a method
<speakingcode>
well that's just poor design
<banister`sleep>
speakingcode: if you just define it in the class body it will belong to the *class* itself
<banister`sleep>
speakingcode: no it's not, it's just a different model, it's actually pretty cool once you take the time to grok it
<speakingcode>
why wouldn't you be allowed to define an instance variable in the body of a class, which corresponds to the scope of that variable?
<banister`sleep>
speakingcode: because inside the class body the 'self' is the class itself
<havenn>
speakingcode: It is lovely design!
<banister`sleep>
speakingcode: so variables defined there belong to the class, and methods that are executed there are executed on the class
ryannielson has joined #ruby
bean__ has quit [Quit: Computer has gone to sleep.]
<banister`sleep>
speakingcode: it all derives from teh fact a class body is executable code
reset has joined #ruby
<speakingcode>
whether it belongs to the class or an instance, i should still be able to instantiate an object, no?
<banister`sleep>
speakingcode: this fact is used to very cool effect with ruby metaprogramming techinques, cf attr_accessor which is a class method that builds instance methods
<Hanmac>
speakingcode nope it cant because the class didnt exist
<banister`sleep>
speakingcode: no, because the class body is executed as it is seen -- if you haven't defined a class that is referenced in that body, then you'll get an error
weldyss2 has joined #ruby
<speakingcode>
ah, i see
Proshot has quit [Quit: Leaving]
<speakingcode>
so at what point is a class's body executed?
<banister`sleep>
when it's defined
<banister`sleep>
try this: class A; puts "defining the A class!"; end
<speakingcode>
hmm
Michael_ has quit [Remote host closed the connection]
<havenn>
speakingcode: The class returns a value even when defined: class A; 'pudding!' end #=> "pudding!"
<speakingcode>
so as soon as the classes source is read, it is executed?
jrist-afk is now known as jrist
<Hanmac>
now you get it
<speakingcode>
so if i include a class from another file, is that class's body executed as soon as the interpreter reads the include line?
Nisstyre-laptop has joined #ruby
uris has joined #ruby
<Hanmac>
yep
<banister`sleep>
speakingcode: no, and you're confusing 'include' with 'require'
<banister`sleep>
speakingcode: it's executed as soon as teh file containing that class is require'd
<speakingcode>
i'm using the word include generally, not syntactically
<banister`sleep>
well that's just confusing :)
karasawa has joined #ruby
<speakingcode>
tbh i didn;t know there was a diff but i'll go read on that
<banister`sleep>
speakingcode: yeah, read about ruby's object model too
<banister`sleep>
it's actually pretty elegant
<yfeldblum>
... for a scripting language
horofox has quit [Quit: horofox]
<banister`sleep>
yfeldblum: it's more elegant than the object models in many non-scripting languages, like java/C++ for example :)
<speakingcode>
interesting model. i see the purpose of it but i don't know that i like it. much different than java, where you have explicit static members (class members) and object members, and static members are lazy-initialized at the first point the class is referenced in run time
iamjarvo has joined #ruby
<banister`sleep>
speakingcode: yeah so 'static members' are kind of special-cased in java/C++, whereas in ruby they're just natural result of the object model, just methods defined on the metaclass of a class
Jackneill has quit [Remote host closed the connection]
<speakingcode>
while i see some value in being able to execute code as soon as the class is read by the interpreter, i see that pening the door for horrible practices also
<banister`sleep>
speakingcode: and you can go as far as you want, defined class methods on the metaclass, by defining methods on the metaclass's metaclass
<speakingcode>
opening*
iamjarvo has quit [Client Quit]
aaronmacy has joined #ruby
willob has joined #ruby
iamjarvo has joined #ruby
robert__ has joined #ruby
Hanmac has quit [Read error: Connection reset by peer]
willob has quit [Max SendQ exceeded]
<banister`sleep>
speakingcode: well, if we couldn't do that, things like attr_accessor wouldn't work, nor a lot of the rails-sy metaprogramming methods you see in class definitions
Nisstyre-laptop has quit [Quit: Leaving]
emmanuelux has joined #ruby
weldyss2 has quit [Remote host closed the connection]
<speakingcode>
like oh here let me put some gets and puts and what not here in the body of my class and then the next time someone requires my class all this funky unexpected stuff happens... granted that's a big DOH to overlook but you get my point
karasawa has quit [Ping timeout: 264 seconds]
Proshot has joined #ruby
willob has joined #ruby
<banister`sleep>
speakingcode: not really
samphippen has joined #ruby
<banister`sleep>
all that stuff will happen only the first time the class is require'd (subsequent requires are just ignored), and it's supposedly there for a reason
berserkr has quit [Quit: Leaving.]
horofox has joined #ruby
timonv has joined #ruby
Goopyo has quit [Read error: Connection reset by peer]
willob has quit [Read error: Connection reset by peer]
<speakingcode>
right but i'm just saying it's theoretically possible (for a poor programmer) to put code to execute in a class body that really shouldn't be
Goopyo has joined #ruby
samphippen has quit [Client Quit]
<banister`sleep>
speakingcode: of course, anyone can write broken code.
robert___ has quit [Ping timeout: 245 seconds]
<speakingcode>
not even broken, just mischevious
<banister`sleep>
i dont see what oyu're saying is anything different to someone just defining a stupid/bad method
<banister`sleep>
which can happen in any language
willob has joined #ruby
jaybee_ has joined #ruby
<speakingcode>
true, but. meh. it's just room for "magic" and i don't like magic
<banister`sleep>
executable class bodies aren't really magic
<banister`sleep>
bbl
workmad3 has quit [Ping timeout: 255 seconds]
<yfeldblum>
speakingcode, then you might want to find another field ...
<speakingcode>
yfeldblum: this one has been serving me well for 13 years
<yfeldblum>
speakingcode, code is magic to the uninitiated, obvious to the initiated
beiter has joined #ruby
d2dchat has joined #ruby
JohnBat26 has quit [Ping timeout: 252 seconds]
<speakingcode>
right but my point is code executing as soon as a class definition is LOADED creates room for not-obvious side-effects. it's just true, rather or not it is common or sensible
headius has joined #ruby
<yfeldblum>
speakingcode, there are many styles: c and c++ have a screwed up style, java and c# have a two-phase whole-program compilation style, and ruby and python have a line-by-line execution style
<yfeldblum>
speakingcode, it's just one more way to write code that is, in many cases, simple to use
<yfeldblum>
speakingcode, in ruby, classes and class bodies are *not* syntax; they are normal code just like any other
<jaybee_>
Hi all, I'm trying to convery a ruby prog into something else (please don't shoot me, my boss told me to). I'm not familiar with ruby. What does the following statement do: counters = "<%= @counters %>" - I understand that it assigns something to the variable counters; I understand (from the rest of the code) that it is something other than the string literal "<%= @counters %>", does it have to do with the variable COUNTERS (previously mentioned in this c
<speakingcode>
well i'm not saying it isn't useful, all i'm saying is it does create a space for surprises
<yfeldblum>
speakingcode, instead of `class MyFunClass < BaseClass ... end`, you can just do `MyFunClass = Class.new(BaseClass) do ... end`
<jaybee_>
I tried googling, but I have no idea what to google.
<yfeldblum>
speakingcode, it's not a surprise, except to someone who comes from a very different style
<speakingcode>
no
<speakingcode>
i'm not saying the convention is a surpise
<speakingcode>
i'm saying the convention creates room for surpises
<speakingcode>
for instance
<speakingcode>
class SomeLib .... puts "heyh this is my lib test est" .... end
<speakingcode>
two weeks later require 'SomeLib' => "hey this is my lib test test" "why the hell is that printing out??
pothibo has quit [Quit: pothibo]
<yfeldblum>
speakingcode, why would that be any more of a surprise than if you just had `puts "hey this is my lib test" ... class SomeLib .. end` ?
<Criztian>
jaybee_ what you pasted must be inside a view. "counters =" should be plain text while <%= @counters %> means to paste the content of the variable counters
<speakingcode>
that's just a contrieved example. i'm simply saying the ability for code to execute simply by loading a class CAN lead to surprises
<speakingcode>
becuase it occurs the moment you require the class without calling anything to execute on it
hoelzro|away is now known as hoelzro
malte_ has quit [Quit: malte_]
d2dchat has quit [Remote host closed the connection]
<yxhuvud>
speakingcode: it can lead to surprises, but it can also lead to sweet chunky bacon
<Gate>
speakingcode: requiring a ruby file executes it, period. You could put a puts above the class and it would execute on require.
<yfeldblum>
speakingcode, my example is the same as yours, with the same observable effects, except that in mine the silly code was outside the class definition ... why is there a difference in surprise?
<Gate>
It also opens the possability of mokeypatching classes, one of ruby's most powerful AND most dangerous features.
<Criztian>
jaybee_ asking you to convert a rails app to something else is harder than asking you to make it all over
aaronmacy has quit [Quit: Leaving.]
<speakingcode>
yfeldblum: inside the class body or in the file, outside of a class definition, each can lead to surprises
Targen has joined #ruby
<speakingcode>
in fact that was something i had to resolve in a python project just last week that a fairly new programmer was working on
havenn has quit [Remote host closed the connection]
joshman_ has quit [Quit: Computer has gone to sleep.]
<kapowaz>
people who know rake-pipeline. Why might rakep successfully run but not generate any CSS? (it is successfully generating JS) How can I debug this? Are there logs somewhere?
<yfeldblum>
speakingcode, they're the same exact surprise though ... and so this has got nothing to do with executable class bodies, really, but it's got to do with ruby and python executing each line of your program as it sees each line
mantovan1 has joined #ruby
<mantovan1>
morning
mantovan1 is now known as mantovani
<speakingcode>
he was putting code to instantiate and call mehtods on in the same file he defined the class, and then when including it in another file he was getting strange effects he couldn't figure out
havenn has joined #ruby
<jaybee_>
Thanks, Criztian. As far as I can tell, the program is a stand-alone script, meant to be run from commandline. The script is only 105 lines, including 70 lines of data.
<yxhuvud>
jaybe: from the look of it you are generating a config file or something like that, using the template language ERB.
<yfeldblum>
speakingcode, sounds like a case of "dunno how python works"
<speakingcode>
yfeldblum: yes
malte_ has joined #ruby
<yfeldblum>
speakingcode, but it really is just the standard way scripting languages work
<speakingcode>
but, shrug. i don't wanna og in circles here
<speakingcode>
yeah, hmm
<yfeldblum>
speakingcode, if i'm new to circular saws, i'll probably end up needing a bandaid too
syamajala has joined #ruby
<yxhuvud>
jaybe: uh. never mind. that's just weird
blaxter has quit [Quit: foo]
skcin7 has joined #ruby
blueOxigen has quit [Ping timeout: 248 seconds]
danneu has quit [Quit: WeeChat 0.3.8]
<jaybee_>
I know roughly what the output is supposed to be.
<speakingcode>
yeah yeah
jfl0wers has quit [Quit: jfl0wers]
daniel_- has quit [Ping timeout: 256 seconds]
djones__ has quit [Ping timeout: 276 seconds]
<speakingcode>
anyway, thanks for the insight, fixed my issue
mercwithamouth has quit [Ping timeout: 248 seconds]
havenn has quit [Ping timeout: 276 seconds]
<yxhuvud>
jaybee: is it running by itself? Because it looks as if what is happening is that a ruby script is generated. that is, that script is just a template generatnig whatever should be run in the end
grzywacz has joined #ruby
connor_ has joined #ruby
vonsar has joined #ruby
Thesolonius has quit [Quit: Thesolonius]
nathancahill has quit [Quit: nathancahill]
syamajal1 has joined #ruby
BadLarry has quit [Ping timeout: 255 seconds]
jtharris has quit [Ping timeout: 248 seconds]
syamajala has quit [Remote host closed the connection]
toekutr has joined #ruby
syamajal1 has quit [Client Quit]
syamajala has joined #ruby
<kapowaz>
somebody here must use rake-pipeline?
timonv has quit [Remote host closed the connection]
<kapowaz>
somebody. out of all the people in here.
BadLarry has joined #ruby
daniel_- has joined #ruby
<speakingcode>
ugh now i have another issue. :-) empty_items = items.select do |item| item['found'].count == 0 end =>count: wrong number of arguments
timonv has joined #ruby
slainer68 has quit [Ping timeout: 260 seconds]
<apeiros>
speakingcode: figure out what class item['found'] is, get the docs of that class and look up the count method.
alex__c2022_ has joined #ruby
<speakingcode>
items is an array of hashes. so item should refer to a hash. the 'found' field of that hash is an array. why should count on an array need arguments?
<apeiros>
speakingcode: docs.
<apeiros>
srsly.
<apeiros>
somebody spend a lot of time writing them.
<speakingcode>
count -> int. returns number of items in enum. IF an argument is given, counts the number of items in enum, for which equals to item"
d2dchat has joined #ruby
<yfeldblum>
speakingcode, in any event, there's also Array#empty?
<apeiros>
maybe you want to go back to step 1 now - make sure you know what class `item['found']` has
<apeiros>
speakingcode: look, there's 3 explanations for what you see: a) you don't have an array, b) you or something you use overrode Array#count, c) you're using a version of ruby where count required an argument (don't know whether that even exists)
gnarmis has joined #ruby
<Asym>
if i have class Base and classes Derived1, Derived2, Derived3 that all derive from Base, is it possible to have an class variable inside Base that has refs to all the classes that derive from it? i'd like to hook a class method on Base that gets invoked whenever a derived class gets defined
<apeiros>
asym: class Base; def self.inherited(descendant) …
AsgardBSD has joined #ruby
<Asym>
apeiros: thanky
<Kakera>
is there a function to output several variables separated with spaces?
<Kakera>
like Python's print or JavaScripts console.log
timonv_ has quit [Ping timeout: 252 seconds]
dmiller1 has quit [Ping timeout: 246 seconds]
bricker`LA has quit [Ping timeout: 252 seconds]
<gnarmis>
Kakera: something different from ruby's #print?
<eval-in>
swarley: Output: "/tmp/execpad-b20068f70c45/source-b20068f70c45:1:in `<main>': undefined local variable or method `a' for main:Object (NameError)\n" (http://eval.in/6876)
<swarley>
Also, does anyone have a good definition of what the characters allowable in a ruby identifier are? I know you can use [A-Za-z0-9_] but I know unicode is also up for grabs as well
eldariof has quit []
<swarley>
So does it just check to make sure that it's not something else?
<tethra>
quick question: does anyone know of a gem that will parse an email body? specifically I'm looking for it to deal with attachments, google has thrown up some seemingly ancient and not-in-development things (tmail, mail)
rezzack has joined #ruby
<yfeldblum>
swarley, all characters using metaprogramming and #send; the characters in \w if you're talking about parseable ruby
zarubin has quit [Remote host closed the connection]
kold_ has quit [Remote host closed the connection]
wargasm has quit [Ping timeout: 276 seconds]
zarubin has joined #ruby
otters has quit [Ping timeout: 252 seconds]
Umren has quit [Read error: Connection reset by peer]
ilyam has joined #ruby
graft is now known as Guest94656
Guest42142 is now known as graft
rmelissari has joined #ruby
<graft>
aedornv: can you clarify what you're asking a bit?
snearch has quit [Quit: Verlassend]
DuoSRX has joined #ruby
jtharris has quit [Quit: WeeChat 0.3.9.2]
philcrissman has quit [Remote host closed the connection]
zarubin has quit [Ping timeout: 276 seconds]
<RubyPanther>
aedornv: you're supposed to avoid needing to do that, you should already have it before you inspect it
miskander has quit [Quit: miskander]
connor_ has joined #ruby
zarubin has joined #ruby
<aedornv>
I have a long string that gets tossed into another medium, for sake of simplicity let's say it's just a file, with using inspect. So File.write("somefile", "some very long string\n".inspect). When I read it back in, it's still in that "inspected" format .. but I need the original format. Using eval works, but it's cumbersome
sailias has quit [Quit: Leaving.]
<heftig>
aedornv: don't use inspect
forcefsck has quit [Quit: Ex-Chat]
<RubyPanther>
aedornv: if you need a non-basic type, use an object server (you can implement one over TCP using drb in just a few lines of code) and if it is just basic types, use a database.
enebo has quit [Quit: enebo]
mercwithamouth has joined #ruby
forced_request has joined #ruby
dr_neek has quit [Quit: dr_neek]
miskander has joined #ruby
<RubyPanther>
I'm sure dozens of other ways can also be listed. Anything except eval :P
<aedornv>
Well, really what's going on is we're sending this log data from a process to a separate server.. when it gets transferred it's already in the format on the other end. That process saves it, and we later read it back on yet another separate process in a different location
joofsh has quit [Remote host closed the connection]
dougireton has quit [Quit: Leaving.]
<RubyPanther>
right. And that is the "wrong way."
miskander has quit [Client Quit]
gnarmis has quit [Remote host closed the connection]
<RubyPanther>
inspect is for humans, not for computers
gnarmis has joined #ruby
DatumDrop has quit [Remote host closed the connection]
szarubin has joined #ruby
zarubin has quit [Ping timeout: 276 seconds]
<RubyPanther>
You should describe your data using some sort of data description format.
mk03 has quit [Remote host closed the connection]
ebobby has joined #ruby
Criztian has quit [Ping timeout: 256 seconds]
Michael_ has quit [Remote host closed the connection]
cr3 has quit [Quit: leaving]
dougireton has joined #ruby
chussenot has quit [Read error: Connection reset by peer]
__BigO__ has quit [Remote host closed the connection]
anonymuse has quit [Quit: Leaving.]
chussenot has joined #ruby
<aedornv>
Like XML? ;)
<RubyPanther>
sure, it parses easy enough
workmad3 has joined #ruby
<RubyPanther>
I would choose some sort of database 100 times and XML 0 times, myself.
<aedornv>
It's already in XML ... but the great firewall of China won't let it through without the character escaped.. and thus is the problem
AlchemyFalcon has quit [Quit: AlchemyFalcon]
mjolk has quit [Quit: This computer has gone to sleep]
karasawa has joined #ruby
daniel_- has joined #ruby
daniel_- has quit [Changing host]
daniel_- has joined #ruby
grzywacz has quit [Quit: :wq]
<aedornv>
Unfortunately, I think the end answer is going to be Shanghai is out of luck ...
<RubyPanther>
aedornv: can't you just unescape the character with .gsub! instead?
Xeago has quit [Remote host closed the connection]
jrajav has joined #ruby
kenneth has joined #ruby
aaronmacy has quit [Quit: Leaving.]
karasawa has quit [Ping timeout: 264 seconds]
segv- has quit [Quit: segv-]
generalissimo has quit [Remote host closed the connection]
<aedornv>
RubyPanther: Well, yeah.. we ended up with a rather long set of gsub lines that nobody wanted to look after if any changes were made
jeffreybaird has quit [Quit: jeffreybaird]
segv- has joined #ruby
segv- has quit [Client Quit]
jjang has joined #ruby
solidoodlesuppor has quit [Remote host closed the connection]
<aedornv>
Hmmm ... maybe if we just drop XML and just bzip2 the log specifically instead
<RubyPanther>
aedornv: I would stuff the regexes into a database
dougireton has quit [Quit: Leaving.]
chussenot has quit [Quit: chussenot]
<RubyPanther>
just treat it like a regular translation
havenn has quit [Remote host closed the connection]
szarubin has quit []
asteve has quit [Quit: Computer has gone to sleep.]
elico has quit [Quit: elico]
havenn has joined #ruby
zarubin has joined #ruby
horofox has joined #ruby
headius has quit [Quit: headius]
dougireton has joined #ruby
daniel_- has quit [Ping timeout: 252 seconds]
jimeh has joined #ruby
tommyvyo has joined #ruby
tommyvyo has quit [Changing host]
tommyvyo has joined #ruby
AlchemyFalcon has joined #ruby
LouisGB has quit [Ping timeout: 255 seconds]
SCommette has quit [Quit: SCommette]
SCommette has joined #ruby
havenn has quit [Ping timeout: 276 seconds]
ukd1 has quit [Quit: leaving]
SCommette has quit [Client Quit]
mahmoudimus has quit [Quit: Computer has gone to sleep.]
jimeh has quit [Ping timeout: 248 seconds]
iamjarvo1 has quit [Quit: Leaving.]
malte_ has quit [Quit: malte_]
pencilcheck has joined #ruby
jimeh has joined #ruby
r3nrut_ has joined #ruby
r3nrut has quit [Read error: Connection reset by peer]
chaosis has joined #ruby
otters has joined #ruby
art_man1 has quit [Quit: art_man1]
r3nrut_ has quit [Read error: Connection reset by peer]
zph has joined #ruby
r3nrut has joined #ruby
syamajala has joined #ruby
aaronmacy has joined #ruby
xemu2 has joined #ruby
skaczor has quit [Remote host closed the connection]
xemu has quit [Ping timeout: 248 seconds]
AlchemyFalcon has quit [Remote host closed the connection]
gyre007 has quit [Remote host closed the connection]
jimeh has quit [Ping timeout: 255 seconds]
skcin7 has quit [Quit: Computer has gone to sleep.]
havenn has joined #ruby
jfl0wers has joined #ruby
froy has quit [Quit: kablam!]
r3nrut has quit [Ping timeout: 252 seconds]
luckyruby has quit [Remote host closed the connection]
zeade has quit [Quit: Leaving.]
doktrin has quit [Ping timeout: 256 seconds]
stopbit has quit [Quit: Leaving]
MattRb has joined #ruby
xsarin has joined #ruby
pcarrier has quit []
PragCypher has quit [Quit: Leaving]
banisterfiend has quit [Read error: Connection reset by peer]
jfl0wers has quit [Quit: jfl0wers]
<Eiam>
is "confident ruby" generally viewed as a good book by the community?