<mercwithamouth>
is it possible to return functions in ruby?
Coolhand|laptop has quit [Remote host closed the connection]
Astralum has quit [Ping timeout: 245 seconds]
wormwood has quit [Quit: WeeChat 0.4.0]
danneu1 has joined #ruby
danneu has quit [Ping timeout: 252 seconds]
statarb3 has quit [Ping timeout: 260 seconds]
<MrZYX>
mercwithamouth: you probably want to return a proc or lambda instead but you could in theory grab the method object of a function and return that
statarb3 has joined #ruby
mrsolo has quit [Quit: Leaving]
jpfuentes2 has quit [Ping timeout: 260 seconds]
connor_ has joined #ruby
<shevy>
mercwithamouth try method(:name)
kofno has quit [Ping timeout: 272 seconds]
<connor_>
Hi, any advanced suggestions for tracking a memory leak in Ruby?
baroquebobcat has quit [Quit: baroquebobcat]
<connor_>
(I'm currently logging memory and not detecting any delta in my symbol count, no hanging references etc)
<mercwithamouth>
hmm what if i did def foo x = 22 end def blah return method(:foo) end that clearly doesn't work, but how would i go about writing that correctly?
lewix has joined #ruby
<banister`sleep>
mercwithamouth: that does work
<connor_>
banister`sleep: Ok, I'll dig in. Thanks for passing it along, will update.
etcetera has quit []
jrajav has quit [Quit: phunq, sandwich store loop, WHAT NO UNIVERSE]
eka has quit [Quit: Computer has gone to sleep.]
<mercwithamouth>
banister`sleep: ahh actually you're right =)
<mercwithamouth>
oops...
rupee has joined #ruby
<shevy>
mercwithamouth ewww you omit the () you evil person you :(
<MrZYX>
I'm interested what could be a valid use case for that?
marr has quit [Ping timeout: 264 seconds]
mikepack has joined #ruby
<mercwithamouth>
MrZYX: in scala it's more than reasonable when dealing with higher order functions....i just like to take new things that i'm learning and implement them in different languages.
ArchBeOS has left #ruby ["Leaving"]
Roa has quit [Ping timeout: 264 seconds]
otherj has quit []
k3rn3lito has quit [Ping timeout: 264 seconds]
pkrnj has joined #ruby
<MrZYX>
still, so when would you do that? in ruby if I need my caller to say which method he should call at a later point I think I'd prefer to give him a symbol of the right name or something like that so he can call send
Spooner has quit [Remote host closed the connection]
<MrZYX>
yeah sure, but I don't think that's the point currently
Honeycomb has joined #ruby
c0rn has joined #ruby
<lsoa>
I can define a private method using rb_define_private_method in C. But how do I make 'new' private?
<shevy>
mercwithamouth seems to be almost identical to what you can do in ruby, via raise("error: type mismatch: \nfound : etc etc etc..") unless input.is_a? Fixnum, or something like that
Quebert has joined #ruby
Mon_Ouie has joined #ruby
Mon_Ouie has quit [Changing host]
Mon_Ouie has joined #ruby
<shevy>
lsoa does new exist as such? isn't it some *alloc* name instead?
<MrZYX>
shevy: mercwithamouth asked how to return a function in ruby, I got interested in a valid use case for that, he came up with that example, which uses no function passing at all :)
sailias has quit [Read error: Connection reset by peer]
<shevy>
hehehe
sailias has joined #ruby
<shevy>
yeah mercwithamouth
veer is now known as _veer
<shevy>
you need something a little bit more complicated than that!
<mercwithamouth>
shevy: you would have to do odd("24".toInt)
_veer has quit [Changing host]
_veer has joined #ruby
<MrZYX>
mercwithamouth: don't want to offend you or anything, just really curious :)
nari has joined #ruby
icole has joined #ruby
<shevy>
mercwithamouth yeah, very similar to ruby too, ruby uses .to_i though which is almost identical (or Integer("24") but that's not as elegant)
<mercwithamouth>
MrZYX: same...to be honest this is the first time i've done it. i play with ruby...so i figure in order to learn two styles of coding at the same time once i learn one thing i MUST immediately duplicate it in the other language
rocket- has quit [Ping timeout: 252 seconds]
<shevy>
well, you get one line saved with scala of course, as it is part of the method definition
NiteRain has quit [Ping timeout: 246 seconds]
moca has quit [Quit: Leaving]
<shevy>
that : Int thing there
<lsoa>
shevy: the point is that under ruby I can simply say private_class_method :new in the class definition right? How do I perform the same operation under C
<shevy>
hmmm I am not sure how to simulate the same in ruby
julian-delphiki has quit [Quit: Computer has gone to sleep.]
<shevy>
I can? I am not sure... let me try that
<lsoa>
I don't bind a function to new, I bind one to initialize
<lsoa>
and define an alloc function
<shevy>
oh cool
<lsoa>
but from what I've seen so far, you're not supposed to touch new
<shevy>
class Foo; private_class_method :new; end # => Foo; Foo.new # NoMethodError: private method `new' called for Foo:Class
Virunga has quit [Remote host closed the connection]
<shevy>
you can!
yshh_ has joined #ruby
<shevy>
you can break all classes that way :)
<shevy>
well, excluding class methods of course
<shevy>
hmmmm
sailias has quit [Client Quit]
skattyadz has joined #ruby
<lsoa>
problem is that the C api is not exactly well documented
<shevy>
hahaha
<shevy>
look lsoa:
reppard has quit [Ping timeout: 276 seconds]
<shevy>
class Bar; private_class_method :new; def self.new; puts 'Hi there from Bar'; end;end; Bar.new# Hi there from Bar
yshh has quit [Ping timeout: 272 seconds]
<shevy>
it's fake! :D
<mercwithamouth>
MrZYX: ehh i have an example coming
pkrnj has quit [Quit: Computer has gone to sleep.]
<lewix>
:self.new
icole has quit [Ping timeout: 252 seconds]
taoru has joined #ruby
taoru has quit [Remote host closed the connection]
<shevy>
ewww
<shevy>
:self works ???
<lsoa>
2.0.0-p0 :011 > SingletonLike.new
<lsoa>
NoMethodError: private method `new' called for SingletonLike:Class
<lsoa>
anyway
<lsoa>
that'
<lsoa>
that's not the point of the question :)
dougireton has quit [Quit: Leaving.]
<shevy>
:D
jpfuentes2 has quit [Quit: Computer has gone to sleep.]
locriani has joined #ruby
Mattix has joined #ruby
skattyadz has quit [Client Quit]
terrorpup has quit [Ping timeout: 245 seconds]
jrajav has joined #ruby
<shevy>
hmm guys
<shevy>
I have about 30 methods like this:
<shevy>
def teal; TEAL; end
<shevy>
def white; WHITE; end
<shevy>
I can use define_method() instead?
<MrZYX>
I'd probably do it
<shevy>
array_with_all_names.each {|name| define_method(name.to_sym) { Object.const_get(name) } } # something like that perhaps?
<MrZYX>
or even method missing if there's nothing else in the class
<shevy>
hmmmmmm I am scared by method_missing
<shevy>
I once delegated everything from one class to the other to the next one all with method_missing
<shevy>
I no longer understood what I did ~3 years later :(
<MrZYX>
yeah I'd really only do it if it' the only thing the class
<MrZYX>
but that array/define_method solution sounds sane enough to me
etcetera has joined #ruby
axhlf has joined #ruby
jpfuentes2 has joined #ruby
dhruvasagar has joined #ruby
mikurubeam has joined #ruby
mockra has quit [Remote host closed the connection]
CodeGnome has joined #ruby
pkrnj has joined #ruby
pkrnj has quit [Client Quit]
ephemerian has quit [Quit: Leaving.]
<mercwithamouth>
my lord...
io_syl has quit [Quit: Computer has gone to sleep.]
<mercwithamouth>
MrZYX: ehh i had to result to an example of the book...i was hoping to use this as an opportunity to come up with my own http://cl.ly/image/3A141K1H1N0Z
<CodeGnome>
What am I misunderstanding about Ruby's File#flock? f = File.open('foo', File::RDWR|File::CREAT, 0644); f.flock File::LOCK_EX; g = File.open('foo', File::RDWR|File::CREAT, 0644); g.flock File::LOCK_NB
mikepack has quit [Remote host closed the connection]
zeta has quit []
samphippen has quit [Quit: Computer has gone to sleep.]
<mercwithamouth>
MrZYX: yeah a lot of what i typed you could simply use a _ and pass in any type you want and have it inferenced...i'm not there yet =P
<banister`sleep>
MrZYX: why wouldnt you use a block
nga4 has quit [Ping timeout: 245 seconds]
endzyme has quit [Remote host closed the connection]
<MrZYX>
that works too sure, just translates the example better here I think
pdamer has quit [Quit: pdamer]
<mercwithamouth>
they're scaring me now
<mercwithamouth>
def on[A, B, C](f: (B, B) => C)(g: A => B): (A, A) => C = (a1, a2) => f(g(a1), g(a2))
<MrZYX>
but it kinda brings me back to the original question: what would a good usecase be to return a method? :P
<mercwithamouth>
case class Person(name: String, age: Int); val p1 = Person("Bob", 12); val p2 = Person("Bill", 13)
<fp->
can anyone help me with a regex for parsing email senders, which can be anything like "Full Name <email@address.com>" or "email@address.com" or "\"Full Name\" <email@address.com>"
havenwood has joined #ruby
<fp->
all i'm really needing is 2 parts: name (without quotes) and email
<fp->
Name can be nil
splud has quit [Quit: splud]
<fp->
I'm just catching incoming emails and need to split up that data
<fp->
this works well for splitting up Full Name <email@address.com> /([^<]+)\s<(.*)>/
aed has joined #ruby
<fp->
sn0wb1rd: thanks
freeayu has joined #ruby
sam113101 has joined #ruby
drale2k has quit [Quit: Leaving...]
krawchyk has quit [Remote host closed the connection]
drale2k has joined #ruby
Hanmac2 has joined #ruby
connor_ has quit [Remote host closed the connection]
etcetera has quit []
Hanmac1 has quit [Ping timeout: 240 seconds]
Bosma has left #ruby [#ruby]
axhlf has quit [Remote host closed the connection]
love_color_text has joined #ruby
markalanevans has joined #ruby
unsay has left #ruby [#ruby]
luckyruby has quit [Remote host closed the connection]
alvaro_o has quit [Quit: Ex-Chat]
`brendan has joined #ruby
bonhoeffer has joined #ruby
NiteRain has joined #ruby
terrorpup has joined #ruby
Mattix has quit [Quit: Leaving]
<fp->
anyone here?
pdamer has quit [Quit: pdamer]
<sam113101>
yes
banjara has quit [Quit: Leaving.]
<fp->
ok then
<fp->
i guess this must be a challenge
joeycarmello has quit [Remote host closed the connection]
a_a_g has quit [Quit: Leaving.]
MrZYX is now known as MrZYX|off
daniel_- has quit [Ping timeout: 250 seconds]
<sam113101>
life is challenging indeed
<sn0wb1rd>
fp-: How does this work? /["a-zA-Z ].*<.*@.*\..*>/
rmelissari has quit [Read error: Connection reset by peer]
<fp->
i'll give it a go and let you know
jpfuentes2 has quit [Ping timeout: 255 seconds]
banjara has joined #ruby
banjara has quit [Client Quit]
<fp->
doesn't provide the two parts
rmelissari has joined #ruby
__Big0__ has joined #ruby
<fp->
was wanting two parts: name, email
<sn0wb1rd>
Oh you need to split the data
<sn0wb1rd>
I see
<fp->
and if no name is present, just the email
dsferreira__ has quit [Quit: This computer has gone to sleep]
<fp->
the email address parsing part doesn't even really need to very strict
<fp->
since i'm just catching emails as they are being delivered by an email server
<fp->
doesn't require validation… no user input
jpfuentes2 has joined #ruby
<sn0wb1rd>
This should give you those two parts: /(["a-zA-Z ].*)\s*<(.*@.*\..*)>/
<sn0wb1rd>
You can access them with $1 (name) and $1 (email)
<sn0wb1rd>
But you should do a $1.strip to remove the extra space
<fp->
so should I also do a $1.delete('"')
<fp->
for emails like "Full Name" <full@name.com>
dsferreira_ has joined #ruby
__Big0__ has quit [Remote host closed the connection]
<fp->
that regex doesn't work for just emails without names
<fp->
i.e. user@domain.com
<fp->
that's my issue
<fp->
i have 3 types of emails coming in
dsferreira_ has quit [Client Quit]
<fp->
Full Name <user@domain.com>
<fp->
"Full Name" <user@domain.com>
<fp->
user@domain.com
<fp->
that's all I've seen so far
<fp->
maybe there's also Full Name<user@domain.com> or just <user@domain.com>
R_Macy has quit [Quit: Computer has gone to sleep.]
Ontolog_ has joined #ruby
sambao21 has quit [Quit: sambao21]
c0rn has quit [Ping timeout: 260 seconds]
jbueza has joined #ruby
<sn0wb1rd>
checking out
sam113101 has quit []
rezzack has joined #ruby
Ontolog has quit [Ping timeout: 272 seconds]
pen has quit [Remote host closed the connection]
echobinary has quit [Read error: Connection reset by peer]
jpfuentes2 has quit [Quit: Computer has gone to sleep.]
echobinary has joined #ruby
<lsoa>
Hanmac: any chance you're actually there? :)
verysoftoiletppr has quit []
Voodoofish430 has quit [Quit: Leaving.]
pdamer has joined #ruby
johnnygoodmancpa has joined #ruby
johnnygoodmancpa has left #ruby [#ruby]
forced_request has quit [Remote host closed the connection]
pdamer has quit [Client Quit]
<sn0wb1rd>
fp-: email =~ /(["a-zA-Z ].*)<(.*@.*\..*)>/ || email =~ /()^<(.*@.*\..*)>/ seems to be working but there should be a simpler way to do it :)
__Big0__ has joined #ruby
cmdr-prmpt_ has joined #ruby
chendo_ has quit [Ping timeout: 264 seconds]
<fp->
yeah seems like there would be
<fp->
self.email_address = from.match(/\<(.*)\>/)[1] if from.include?('<')
<aedornm>
But if you have names with accents and stuff... that would be ... hmm
<fp->
i'll try it
bradhe has quit [Remote host closed the connection]
pen has quit [Ping timeout: 245 seconds]
dankest has quit [Quit: Leaving...]
hashmal has joined #ruby
aleph-null has quit [Remote host closed the connection]
<fp->
pretty darn good so far
<fp->
even managed to strip out the quotes from the full name
mikepack has joined #ruby
tommyvyo has joined #ruby
reppard has quit [Ping timeout: 248 seconds]
<aedornm>
It'll fail when you have character accents
<fp->
hrm
<fp->
so same issue with Mail
<fp->
what do you think I should do?
<fp->
maybe avoid regex and just use split?
freakazoid0223 has quit [Read error: Connection reset by peer]
<fp->
"Full Name <email@address.com>".split('<', 2).last.delete('>')
Lemtzas has quit [Quit: No Ping reply in 180 seconds.]
Lemtzas has joined #ruby
<fp->
self.full_name = "Full Name <email@address.com>'.split('<', 2).first.strip
sandGorgon has joined #ruby
fire has joined #ruby
chrisramon_ has quit [Quit: chrisramon_]
echobinary has joined #ruby
takano16 has joined #ruby
echobinary has quit [Client Quit]
<aedornm>
Yeah, for the full name. I'd keep the email regex. Probably can do something better with the name, though. I'm being distracted by Wreck-it Ralph
dallasm has quit [Remote host closed the connection]
robbyoconnor has joined #ruby
sambao21 has quit [Ping timeout: 260 seconds]
<fp->
parts = from.split('<', 2)
nga4 has joined #ruby
<fp->
self.email_address = parts.last.delete('>')
<fp->
self.full_name = parts.first.strip if from.include?('<')
<fp->
seems to pass all tests
Ontolog_ has quit [Read error: Connection reset by peer]
Takehiro has quit [Remote host closed the connection]
c0rn has joined #ruby
<pen>
unless you need system wide
<hemanth>
sudo aptitude install build-essential libssl-dev libreadline5 libreadline5-dev zlib1g zlib1g-dev; # to fix zlib dep and get other deps sam113101
<hemanth>
sam113101, do what RickFromTheSOC said
rafacv has quit [Remote host closed the connection]
lewix has quit [Remote host closed the connection]
connor__ has joined #ruby
kofno has quit [Remote host closed the connection]
statarb3 has quit [Ping timeout: 272 seconds]
brum has quit [Remote host closed the connection]
<sam113101>
must I reinstall ruby after all those things are installed?
mercwithamouth has quit [Remote host closed the connection]
mercwithamouth has joined #ruby
philcrissman has quit [Remote host closed the connection]
mahmoudimus has quit [Quit: Computer has gone to sleep.]
<sam113101>
how am I supposed to do that
ezkl has joined #ruby
sambio has quit []
jurassic has quit [Quit: jurassic]
<RickFromTheSOC>
how did you get it installed before?
lewix has joined #ruby
feedbackloop_ has quit [Read error: Connection reset by peer]
<sam113101>
ok, reinstalling fixed it
<sam113101>
thanks guys
<sam113101>
everything's working
bwulf has quit [Read error: Connection reset by peer]
<hemanth>
enjoy
<sam113101>
:)
rakl has joined #ruby
girija has quit [Ping timeout: 240 seconds]
mikepack has quit [Remote host closed the connection]
Myconix has joined #ruby
ananthakumaran has joined #ruby
felipe has joined #ruby
carlyle has quit [Remote host closed the connection]
lewix has quit [Remote host closed the connection]
QaDeS has joined #ruby
mahmoudimus has joined #ruby
lewix has joined #ruby
lewix has quit [Changing host]
lewix has joined #ruby
ryanf has joined #ruby
dhruvasagar has quit [Ping timeout: 256 seconds]
dhruvasagar has joined #ruby
lewix has quit [Ping timeout: 245 seconds]
mockra has joined #ruby
fire has quit [Ping timeout: 276 seconds]
v0n has joined #ruby
lewix has joined #ruby
lewix has quit [Changing host]
lewix has joined #ruby
sambao21 has joined #ruby
sambao21 has quit [Client Quit]
<Hanmac>
lsoa now i am back again
sambao21 has joined #ruby
RickFromTheSOC has quit [Quit: Leaving]
girija has joined #ruby
<otherj>
if console returns [] for an instance var, and you want to conditionally check for it to contain something, is it best to use !@var.nil? @var.present? !@var.empty? i'm trying to conditionally check it and when it returns [] it's not hitting the else
mockra has quit [Ping timeout: 260 seconds]
fire has joined #ruby
sambao21 has quit [Client Quit]
fire has quit [Excess Flood]
otherj has quit []
rburton- has joined #ruby
lukeholder has quit [Quit: Computer has gone to sleep.]
cmyers has joined #ruby
<cmyers>
Looking at the Memoizer gem, but I want to memoize (or not) per-instance, rather than per-class. e.g. I want to have some instances of the class use memoization, and others not. Anyone know of an existing gem that does this?
banjara has joined #ruby
gtuckerkellogg has joined #ruby
rgbdev has quit [Quit: rgbdev]
fire has joined #ruby
nachtwandler has joined #ruby
drale2k has quit [Quit: Leaving...]
jurassic has joined #ruby
fire has quit [Excess Flood]
echobinary has joined #ruby
browndawg has joined #ruby
yashshah has joined #ruby
rakl has quit [Ping timeout: 252 seconds]
drale2k has joined #ruby
Mon_Ouie has joined #ruby
Mon_Ouie has quit [Changing host]
Mon_Ouie has joined #ruby
daemoen has quit [Ping timeout: 250 seconds]
newUser1234 has quit [Remote host closed the connection]
rakl has joined #ruby
WanderingGlitch has quit [Ping timeout: 260 seconds]
sambao21 has joined #ruby
a_a_g has quit [Quit: Leaving.]
yacks has joined #ruby
sambao21 has quit [Client Quit]
jdunck has joined #ruby
huoxito has quit [Quit: Leaving]
classix has quit [Ping timeout: 252 seconds]
rockymadden has quit []
carlyle has joined #ruby
classix has joined #ruby
takeru_ has joined #ruby
fire has joined #ruby
codecop has joined #ruby
tommyvyo has quit [Quit:]
takeru_ has quit [Ping timeout: 245 seconds]
whitedawg has quit [Quit: Leaving.]
Takehiro has joined #ruby
carlyle has quit [Ping timeout: 245 seconds]
banjara has left #ruby [#ruby]
newUser1234 has joined #ruby
heliumsocket has quit [Quit: heliumsocket]
Takehiro_ has joined #ruby
Takehiro_ has quit [Remote host closed the connection]
Takehiro has quit [Ping timeout: 276 seconds]
bigmac has quit [Remote host closed the connection]
love_color_text has quit [Remote host closed the connection]
lsoa has quit [Read error: Operation timed out]
io_syl has joined #ruby
fire has quit [Ping timeout: 272 seconds]
love_color_text has joined #ruby
love_color_text has quit [Remote host closed the connection]
drale2k has quit [Quit: Leaving...]
drale2k has joined #ruby
voodoofish has quit [Read error: No route to host]
toekutr has joined #ruby
dmiller has quit [Ping timeout: 272 seconds]
aganov has joined #ruby
lsoa has joined #ruby
kofno has joined #ruby
danneu1 has quit [Quit: WeeChat 0.3.8]
iamjarvo has quit [Quit: Leaving.]
fire has joined #ruby
mootpointer has quit [Quit: Computer has gone to sleep.]
maletor has joined #ruby
Mo0O has quit [Quit: WeeChat 0.4.0]
nsxt has quit [Quit: Leaving]
eAlchemi_ has quit [Remote host closed the connection]
trollissimo has quit [Remote host closed the connection]
eAlchemist has joined #ruby
Mo0O has joined #ruby
Rioji_ has quit [Remote host closed the connection]
kofno has quit [Ping timeout: 272 seconds]
aedornm has joined #ruby
d2dchat has quit [Remote host closed the connection]
sepp2k has joined #ruby
jurassic has quit [Quit: jurassic]
voodoofish has joined #ruby
nachtwandler has quit [Remote host closed the connection]
sam113101 has quit [Quit: Page closed]
eAlchemist has quit [Ping timeout: 248 seconds]
jdunck has quit [Quit: Computer has gone to sleep.]
Honeycomb has joined #ruby
Mon_Ouie has quit [Ping timeout: 276 seconds]
nari has quit [Ping timeout: 245 seconds]
jpfuentes2 has joined #ruby
drale2k has quit [Quit: Leaving...]
drale2k has joined #ruby
apeiros_ has quit [Remote host closed the connection]
twoism has quit [Ping timeout: 276 seconds]
echobin81 has joined #ruby
echobinary has quit [Read error: Connection reset by peer]
aedornm has quit [Quit: Leaving]
pencilcheck has joined #ruby
Hanmac has quit [Quit: Leaving.]
Zespre has quit [Quit: leaving]
v0n has quit [Read error: Operation timed out]
baroquebobcat has quit [Quit: baroquebobcat]
dsferreira_ has joined #ruby
pen_ has joined #ruby
pen has quit [Ping timeout: 272 seconds]
aedornm has joined #ruby
Mo0O has quit [Quit: see you]
jurassic has joined #ruby
dsferreira_ has quit [Client Quit]
pencilcheck has quit [Ping timeout: 260 seconds]
nari has joined #ruby
pen has joined #ruby
Zespre has joined #ruby
andikr has joined #ruby
pen_ has quit [Ping timeout: 260 seconds]
Clownz has joined #ruby
maletor has quit [Quit: Computer has gone to sleep.]
axxT has joined #ruby
Ng|Adonixx7148 has quit [Read error: Connection reset by peer]
hashmal has joined #ruby
<FuzaiDesktop>
http://pastebin.com/rdQpFRF7 I'm using Regex with Ruby and i'm trying to extract everything between the 16 white spaces and next 3 white spaces "Toyko, Japan" in the example
<FuzaiDesktop>
I tried /(\w+), (\w+) / but had no luck
mahmoudimus has quit [Quit: Computer has gone to sleep.]
tagrudev has joined #ruby
pythonista has joined #ruby
bradhe has joined #ruby
bradhe has quit [Read error: Connection reset by peer]
<pythonista>
within an 'each' block of a hash iterator-- how can i access the next k/v pair that's coming down the pipeline?
<pythonista>
is this possible?
dcwu has joined #ruby
Elhu has joined #ruby
<aedornm>
FuzaiDesktop: /\w+,\s\w+/ for that example
a_a_g has joined #ruby
<FuzaiDesktop>
\s means white space right?
end_guy has quit [Remote host closed the connection]
<aedornm>
yes
<FuzaiDesktop>
so /(\w+,\s\w+)\s\s\s/ ?
<FuzaiDesktop>
To put Tokyo, Japan into $1?
drale2k has quit [Quit: Leaving...]
love_color_text has joined #ruby
<aedornm>
you don't need the extra 3 \s at the end
end_guy has joined #ruby
mafolz has joined #ruby
drale2k has joined #ruby
<FuzaiDesktop>
ok
Morkel has joined #ruby
piotr_ has joined #ruby
<FuzaiDesktop>
Thank you
Honeycomb has quit [Quit: Leaving.]
workmad3 has joined #ruby
bricker`1A has joined #ruby
chussenot has joined #ruby
Hanmac has joined #ruby
<aedornm>
pythonista: You can't, but you can use #each_cons instead. hash.each_cons(2) {|x,y| ...} will pass first and next, but it won't pass the last element if you need to iterate over that separately.
bricker`LA has quit [Ping timeout: 255 seconds]
mercwithamouth has quit [Ping timeout: 276 seconds]
<Guest45517>
hi all, i'm trying to install redmine 2.2.3 on windows server 2012 x64, with mysql. i have a lot of trouble, mainly with imagemagick and with mysql connector too. is there a "step guide" (i've tried to follow the wiki's one, without success) that can help me? i know that this is not mainly a ruby problem, but i think that the issue is related to the gem installation of the product...
Myconix has quit [Quit: Server Error 482: The server has been shot by a 12-gauge, please contact an administrator]
<lewix>
I installed rvm too
T_ has joined #ruby
<Hanmac>
lewix ... did you ruby with rvm or do you have an extra ruby?
<Hanmac>
lewix does "which ruby" works for you?
<Guest45517>
have anyone info on how to have ruby up and running onto windows server? i need to install redmine but the guide of redmine have a general overview of the ruby, rubydevkit, rmagick gem, mysql gem, etc ..
<apeiros_>
the stdlib is distributed in the paths listed there
dhruvasagar has quit [Remote host closed the connection]
<apeiros_>
for me it's 9 dirs
<Hanmac>
apeiros_ for sample my stdlib is slitted in two paths because of the --enable-multiarch flag
<apeiros_>
ah, sorry, 8
marr has joined #ruby
<apeiros_>
Hanmac: yeah, that's why I said "distributed". I don't think mine is with multiarch flag, and still I have arch specific paths in $LOAD_PATH
mulinux has joined #ruby
<lewix>
Hanmac: any idea where i can get a clear explanation of the ruby install dir tree
<apeiros_>
and every distro can make up their own decisions too… (I'm looking at you, apt!)
<lewix>
apeiros_: thanks
<apeiros_>
lewix: ruby -e 'p *$:'
<Hanmac>
i have 8 dirs too, but my one are a little bit mixed :P
<apeiros_>
I have 3 times vendor, 3 times site, 2 times plain ruby
<lewix>
apeiros_: same
<apeiros_>
I think stdlib is in the 2 non-vendor non-site
r0bby has joined #ruby
<apeiros_>
vendor is for the distros to use I think, for libs they want to ship with ruby
<apeiros_>
site is where old school setup.rb installs end up
<apeiros_>
not sure anymore, thogh. it's all gems now anyway
drale2k has quit [Quit: Leaving...]
<lewix>
apeiros_: site is for third party
dsferreira has joined #ruby
drale2k has joined #ruby
* Hanmac
has 3 vendor, 3 site, 2 default ruby too ... but my pathes are "rearranged"
mahmoudimus has quit [Quit: Computer has gone to sleep.]
<hemanth>
Hanmac, what's new? Was reading about authentic happiness :D
bradhe has joined #ruby
dbck has joined #ruby
statarb3 has joined #ruby
jdunck has quit [Quit: Computer has gone to sleep.]
axhlf has quit [Remote host closed the connection]
echobinary has quit [Read error: Connection reset by peer]
echobinary has joined #ruby
one` has quit [Ping timeout: 260 seconds]
dbck has left #ruby [#ruby]
eldariof has joined #ruby
cocomo has joined #ruby
cocomo has left #ruby [#ruby]
<Hanmac>
hemanth yesterday i was pissed because they miss to make a struct stat -> VALUE method in the C-API public
one has joined #ruby
<hemanth>
Hanmac, yikes!
lemonsparrow has quit [Ping timeout: 245 seconds]
<Hanmac>
there is a static VALUE stat_new(struct stat *st) method ... but its not visible form the outside :/
noesis has joined #ruby
<hemanth>
hmm....
drale2k has quit [Quit: Leaving...]
drale2k has joined #ruby
bradhe has quit [Ping timeout: 248 seconds]
dcwu has quit [Quit: Leaving.]
rakl has quit [Quit: sleeping]
becom33 has joined #ruby
becom33 has quit [Changing host]
becom33 has joined #ruby
dsferreira has quit [Quit: This computer has gone to sleep]
becom33 has left #ruby [#ruby]
becom33 has joined #ruby
buscon has joined #ruby
nari has quit [Ping timeout: 276 seconds]
<becom33>
https://gist.github.com/anonymous/8750a92097bce4f1da0e in this script when I do "ruby test.rb speak --file demo" it returns the error test.rb speak requires at least 1 argument: "test.rb speak <What to speak>". what I want to get is the file I have mentioned is not there
enthrops has joined #ruby
soc42 has joined #ruby
Vainoharhainen has joined #ruby
beiter has joined #ruby
lkba has joined #ruby
staafl has joined #ruby
timonv has joined #ruby
ananthakumaran1 has joined #ruby
daniel_- has joined #ruby
ananthakumaran2 has joined #ruby
enthrops has left #ruby [#ruby]
backjlack has joined #ruby
love_color_text has joined #ruby
MrZYX|off is now known as MrZYX
gtuckerkellogg has quit [Ping timeout: 255 seconds]
slainer68 has joined #ruby
ananthakumaran has quit [Ping timeout: 240 seconds]
ananthakumaran1 has quit [Ping timeout: 245 seconds]
clooth has joined #ruby
staafl_alt has joined #ruby
keyvan has quit [Ping timeout: 260 seconds]
enthrops has joined #ruby
enthrops has left #ruby [#ruby]
enthrops has joined #ruby
enthrops has quit [Client Quit]
dahood has joined #ruby
Honeycomb has quit [Quit: Leaving.]
dahood has left #ruby [#ruby]
himsin has joined #ruby
staafl has quit [Ping timeout: 256 seconds]
blaxter has joined #ruby
bricker`1A is now known as bricker`LA
newUser1234 has quit [Remote host closed the connection]
newUser1234 has joined #ruby
samphippen has joined #ruby
drale2k has quit [Quit: Leaving...]
drale2k has joined #ruby
Beoran__ has joined #ruby
duosrx has joined #ruby
mark9 has joined #ruby
Beoran_ has quit [Ping timeout: 250 seconds]
swoosh has joined #ruby
mikurubeam has quit [Quit: +1 (Yes.) -1 (No.) i (WTF?). j (So...). k (... quaternions too?).]
newUser1234 has quit [Ping timeout: 272 seconds]
Tn6o has joined #ruby
bradhe has joined #ruby
clooth has quit [Ping timeout: 245 seconds]
ozgura has quit [Remote host closed the connection]
a_a_g has quit [Quit: Leaving.]
elaptics`away is now known as elaptics
axhlf has joined #ruby
<epta>
How can I find a key, which value satisfy some predicate?
<epta>
In hash obviously
<hoelzro>
epta: use Hash#select
clocKwize has joined #ruby
<hoelzro>
are you using the hash for its semantics as wel?
<hoelzro>
*well
<hoelzro>
or are you just using it to maintain a collection of associative data?
mikurubeam has joined #ruby
<Hanmac>
Hash has thanks to Enumerable also an #find method
axhlf has quit [Read error: Connection reset by peer]
connor_ has joined #ruby
axhlf has joined #ruby
connor_ has quit [Read error: Connection reset by peer]
noodl has joined #ruby
<noodl>
hi. i'm sure there was an alternative to rvm/rbenv that simply set some env vars in the shell. called something like chrb or cdrb, did i dream that? can't find it anywhere :(
<hoelzro>
chruby
<hoelzro>
noodl: ^^
<noodl>
ah! ty ty ty
<noodl>
got it. ace :)
samphippen has quit [Quit: Computer has gone to sleep.]
joshman_ has joined #ruby
backjlack has quit [Remote host closed the connection]
Al_ has joined #ruby
<regedarek>
How will be the easiest way to compare slugs before and after update friendlyID ?? save slugs to text file?
mulinux has quit [Quit: mulinux]
bradhe has quit [Ping timeout: 250 seconds]
<Hanmac>
regedarek ... is that a rails question?
<regedarek>
i guess more ruby because i just want to compare two columns
<hoelzro>
when I compare slugs, I usually use a ruler
at_ has joined #ruby
<hoelzro>
and compare length, then width
backjlack has joined #ruby
<hoelzro>
then weight, and finally racing speed.
<Hanmac>
shoundt you also compare the type, so an "Housed" and a "nude" slug?
echobin97 has joined #ruby
echobinary has quit [Read error: Connection reset by peer]
<at_>
Hi, I'm using data.unpack('v*')[0] to get the integer value of certain hex data. The problem is when data is just a byte (that obviously I get nil)
Tn6o has quit [Quit: Lost terminal]
<at_>
any way to add get the integer data (little endian) of any set of hex bytes?
Adys has quit [Read error: Connection reset by peer]
bonhoeffer has quit [Quit: bonhoeffer]
bradhe has joined #ruby
Adys has joined #ruby
utf1000 has joined #ruby
bonhoeffer has joined #ruby
kofno has joined #ruby
bonhoeffer has quit [Client Quit]
smt has joined #ruby
gommo has joined #ruby
luckyruby has joined #ruby
lkba has quit [Remote host closed the connection]
mark9 has joined #ruby
casheew has quit [Read error: Connection reset by peer]
casheew has joined #ruby
zomgbie has quit [Ping timeout: 256 seconds]
locriani has quit [Ping timeout: 272 seconds]
Virunga has quit [Remote host closed the connection]
nkr has joined #ruby
clooth has quit [Ping timeout: 276 seconds]
echobin13 has joined #ruby
echobinary has quit [Read error: Connection reset by peer]
r0bby has quit [Ping timeout: 240 seconds]
haxrbyte has quit [Ping timeout: 260 seconds]
tcurdt has joined #ruby
orien has joined #ruby
tcurdt has quit [Client Quit]
lewix has quit [Remote host closed the connection]
bradhe has quit [Ping timeout: 250 seconds]
clooth has joined #ruby
BizarreCake has joined #ruby
chussenot has quit [Quit: chussenot]
phretor has joined #ruby
zomgbie has joined #ruby
phretor has quit [Remote host closed the connection]
testingb0t1 has joined #ruby
testingb0t has quit [Ping timeout: 240 seconds]
skattyadz_ has joined #ruby
devdazed has quit [Ping timeout: 245 seconds]
eldariof has joined #ruby
Takehiro has joined #ruby
skattyadz_ has quit [Client Quit]
skattyadz has quit [Ping timeout: 255 seconds]
a_a_g1 has joined #ruby
devdazed has joined #ruby
Eldariof28-ru has quit [Ping timeout: 248 seconds]
mysterty has joined #ruby
zomgbie has quit [Ping timeout: 248 seconds]
yacks has joined #ruby
<mysterty>
Hello, i'm installing gitlab on my fresh installed server, and i have an error : " An error occurred while installing mysql2 (0.3.11), and Bundler cannot continue.
<mysterty>
Make sure that `gem install mysql2 -v '0.3.11'` succeeds before bundling. "
<mysterty>
but I have already mysql installed
<mysterty>
and i don't know about a "mysql 2"
a_a_g has quit [Ping timeout: 240 seconds]
<mysterty>
what is it exactly ?
hybris has joined #ruby
Blaze_Boy has joined #ruby
smt has quit [Ping timeout: 276 seconds]
<mysterty>
(i don't know ruby, i'm php dev)
<JonnieCache>
the 2 refers to the new version of the mysql adaptor
<JonnieCache>
its not referring to a new version of mysql itself
<tobiasvl>
mysterty: php?! you have my condolences
AzizLight has joined #ruby
<AzizLight>
Hi everybody
<AzizLight>
is it possible to convert a Hash into an object in ruby?
<AzizLight>
without monkey patching that is
<wobblini>
AzizLight: a hash is an object
<mysterty>
whitequark, JonnieCache, so, it's just a kind of "plugin" for ruby to communicate with mysql ?
<JonnieCache>
exactly
<JonnieCache>
its a Gem, which is how ruby packages code
<mysterty>
tobiasvl, yes, i know, i'm strongly thinking about switching to ruby or python or java :p
<JonnieCache>
mysql2 is a LOT better than the original mysql gem
<AzizLight>
wobblini: everything is an object in ruby, I know that. What I want is to access the Hash keys with the dot notation not the hash[:key] notation
<mysterty>
JonnieCache, thx !
orien has quit [Quit: Computer has gone to sleep.]
<wobblini>
AzizLight: have a look at OpenStruct (require 'ostruct') -- that might help. you can initialize an ostruct with a hash and then the ostruct has those methods with those values.
<tobiasvl>
AzizLight: look at method_missing
dawkirst has quit [Quit: Leaving]
<tobiasvl>
or maybe ostruct is a better idea
yshh_ has quit [Remote host closed the connection]
samphippen has quit [Quit: Computer has gone to sleep.]
<wobblini>
AzizLight: OpenStruct won't work with all hash keys, though (for example, not numbers)
atno has quit [Quit: Leaving]
Bira has joined #ruby
<wobblini>
AzizLight: it basically wants symbols or strings, or anything with a to_sym method
Xeago_ has joined #ruby
Xeago has quit [Killed (calvino.freenode.net (Nickname regained by services))]
Xeago_ is now known as Xeago
<wobblini>
AzizLight: then again, you probably aren't expecting to create a method called 123 anyway.
hasimo has quit [Remote host closed the connection]
andikr has quit [Remote host closed the connection]
robustus has quit [Ping timeout: 248 seconds]
wobblini has quit [Ping timeout: 255 seconds]
<fuzai>
すべての言語を話す!
binaryplease has joined #ruby
predator217 has quit [Quit: Lost terminal]
predator117 has joined #ruby
nfk has joined #ruby
<lsoa>
Hanmac: good morning
robustus has joined #ruby
atmosx has quit [Quit: And so the story goes…]
<fuzai>
おはようみんな!
casheew has quit [Read error: Connection reset by peer]
<Hanmac>
lsoa depends on the local time ... its now 14:12 for me
casheew has joined #ruby
mootpointer has joined #ruby
<lsoa>
Hanmac: so I just found out about ffi... have you used it? Any issues I should be aware of?
yacks has quit [Ping timeout: 260 seconds]
bonhoeffer has joined #ruby
<lsoa>
local time is the only time :D
v0n has joined #ruby
<lsoa>
I don't believe in timezones, this is liberal propaganda.
banister`sleep has joined #ruby
<Hanmac>
lsoa i have seen it, but because the libs i bind are in C++, FFI does not work for me ... and i want to take control over when an object is destroyed or GC'd
slainer68 has joined #ruby
cmarques has joined #ruby
<whitequark>
lsoa: but what if you have several local times
<lsoa>
whitequark: blame obama.
<whitequark>
lsoa: but what if it's russia
<whitequark>
oh well
mootpointer has quit [Client Quit]
eliasp has quit [Ping timeout: 256 seconds]
daniel_- has quit [Ping timeout: 276 seconds]
<lsoa>
Hanmac: I see. I'll give it a try since my lib is in C
mysterty has quit [Quit: Allez, salut les toons !]
zomgbie has joined #ruby
<hemanth>
:D
<banister`sleep>
Hanmac: ruby 2.1.0 ???
hemanth has quit [Read error: Connection reset by peer]
geekbri has joined #ruby
Faris has quit [Ping timeout: 245 seconds]
<Hanmac>
banister i using trunk/daily/nighty/git-repo
connor_ has joined #ruby
c6der has joined #ruby
hemanth has joined #ruby
lsoa has quit [Quit: Lost terminal]
chussenot has joined #ruby
binaryplease has quit [Quit: WeeChat 0.4.0]
bradhe has quit [Ping timeout: 256 seconds]
binaryplease has joined #ruby
<hemanth>
mkmf vs inline(:C)
<hemanth>
inline is supposed to bad, right?
<banister`sleep>
nothing bad about it
mikecmpbll has joined #ruby
samphippen has joined #ruby
<hemanth>
needs a gem install inline?
* Hanmac
still prefers C++ code
pskosinski has joined #ruby
connor_ has quit [Ping timeout: 260 seconds]
<whitequark>
Hanmac: it doesn't make sense
newUser1234 has joined #ruby
<hemanth>
Hanmac where in specific?
<whitequark>
there isn't a matter of preference or not. C has a well-defined ABI on any platform, and everything knows to interface with it. C++, on the other hand... mostly does. And nothing can interface with it due to sheer complexity of the beast.
<Hanmac>
hemanth & whitequark: for my bindings, because my binded libs are C++ too
puppeh has quit [Remote host closed the connection]
solidoodlesuppor has joined #ruby
<apeiros_>
Off-topic: does anybody have good resources about spam with regards to your own company? i.e. what do you do to not be considered spam, how to stop spoofers (e.g. via SPF) etc.? (cross posting in #rubyonrails)
<maxmanders>
When would I choose to use string.scan(/regex/).flatten versus string.match(/regex/).catpures - I believe they both return an array of matched groups?
asobrasil has joined #ruby
hemanth has quit [Read error: Connection reset by peer]
hemanth has joined #ruby
Illusioneer has joined #ruby
<apeiros_>
.match always only gives you the first match
<apeiros_>
also .flatten'ing a scan result seems like a bad idea to me
gaahrdner has joined #ruby
<apeiros_>
at least I see no use-case where that's more useful than retain the array of arrays
DrCode has quit [Ping timeout: 276 seconds]
tk__ has joined #ruby
banister`sleep has joined #ruby
<maxmanders>
Okay - well let me ask a different question - given a string and a regex containing many match groups; what's the best way to return those match groups as an array
breakingthings has joined #ruby
<apeiros_>
define 'best'.
<apeiros_>
scan will do that
otherj has quit []
noop has quit [Remote host closed the connection]
<maxmanders>
A contrived non practical example: "2013-03-08".<something>(/(\d{4})\-(\d{2})\-(d{2})/)… and by best - I mean idiomatic to Ruby
axhlf has joined #ruby
<apeiros_>
you don't have multiple matches there
<maxmanders>
i.e. I realise for this example, regex wouldn't be the way to go… but just as something concrete
sailias has joined #ruby
mark9 has left #ruby [#ruby]
a_a_g has quit [Quit: Leaving.]
<apeiros_>
if you expect only a single match (which can have multiple captures, that's unrelated)
<maxmanders>
One matching group for (\d{4}); one for (\d{2}) and one for (\d{2}) - three
<apeiros_>
then you use String#match
<maxmanders>
Apologies - wrong word… I meant capture group rather than match.
<apeiros_>
str.match(regex).captures is the same as str.scan(regex).first
shock_one has joined #ruby
<apeiros_>
well, almost, the former can explode if you don't have a match (since you'd call nil.captures)
adkron has quit [Ping timeout: 245 seconds]
adkron_ has quit [Ping timeout: 245 seconds]
seitensei has quit [Quit: Leaving...]
<maxmanders>
Okay, so String#match will return an object that I can use #captures[N] on to return the Nth capture?
khismetix has joined #ruby
<apeiros_>
maxmanders: ri MatchData
a_a_g has joined #ruby
<maxmanders>
apeiros_: thanks - I should rtfm ;-)
Es0teric has joined #ruby
<shock_one>
What is the most elegant way to make Dir.chdir execute the attached block in current directory, if the argument directory doesn't exist?
Drager has quit [Ping timeout: 260 seconds]
Es0teric has quit [Client Quit]
connor_ has joined #ruby
ffranz has quit [Quit: Leaving]
sleetdrop has joined #ruby
dallasm has joined #ruby
<Spooner_>
Make the block into a method (or lambda) and if File.directory? bleh; Dir.chdir(bleh) { meth }; else; meth; end
aganov has quit [Remote host closed the connection]
<Spooner_>
Though those are not a good list. green_shoes gem is better than shoes and FXRuby is long dead (and broken).
jtharris has joined #ruby
xbob has quit [Quit: Leaving]
huoxito has joined #ruby
etank has quit [Ping timeout: 276 seconds]
engel has quit [Read error: Connection reset by peer]
hemanth has quit [Client Quit]
ArchBeOS is now known as Paul-Atreides
haxrbyte has quit [Ping timeout: 260 seconds]
etank has joined #ruby
iamjarvo has joined #ruby
frem has joined #ruby
casheew has quit [Read error: Connection reset by peer]
Progster_x has quit [Ping timeout: 276 seconds]
casheew has joined #ruby
atyz has quit [Quit: Leaving...]
sambao21 has quit [Quit: Quitter]
caveat- has quit [Ping timeout: 255 seconds]
<xeronic>
Spooner_: Thanks! You dont happen to know which is "the best" framework? Shoes is the most popular but I dont think it is active anymore. You know if any is capable of showing images/text on the screen, maybe on a transparent form?
yshh has joined #ruby
<Spooner_>
green_shoes, as I said, is the up-to-date version of shoes (and is a gem).
sambao21 has joined #ruby
casheew has quit [Read error: Connection reset by peer]
generalissimo has joined #ruby
<Spooner_>
Doubt any of them can have transparent windows. All should allow forms though.
<shock_one>
xeronic, can you use a different language? Because ruby isn't the most suitable for GUI apps.
<Spooner_>
I played with wxruby recently and it seemed OK.
NiteRain has joined #ruby
lolmaus has joined #ruby
nateberkopec has joined #ruby
<Spooner_>
shock_one, There is nothing wrong with Ruby as a GUI application. It is just that not many people are keen to keep GUI bindings up to date, it seems!
Takehiro has quit [Remote host closed the connection]
casheew has joined #ruby
arietis has quit [Quit: Computer has gone to sleep.]
jprovazn has quit [Quit: Leaving]
bradhe has quit [Ping timeout: 272 seconds]
enebo has joined #ruby
krawchyk_ has joined #ruby
Goles has joined #ruby
_nitti has joined #ruby
echobinary has quit [Read error: Connection reset by peer]
[eDu] has joined #ruby
echobinary has joined #ruby
banister`sleep has quit [Remote host closed the connection]
Paul-Atreides is now known as ArchBeOS
<epta>
execjs/runtimes.rb:51:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
<xeronic>
Thanks for all tips, I think I'll check out green_shoes
<epta>
What am I doing wrong?
krawchyk has quit [Ping timeout: 276 seconds]
Takehiro has joined #ruby
mmitchell has joined #ruby
Takehiro has quit [Remote host closed the connection]
arietis has joined #ruby
<MrZYX>
epta: did you read that link?
JMcAfreak has quit [Remote host closed the connection]
mmitchell has quit [Read error: Connection reset by peer]
a_a_g has quit [Quit: Leaving.]
stopbit has joined #ruby
JMcAfreak has joined #ruby
JMcAfreak has quit [Remote host closed the connection]
mmitchell has joined #ruby
<epta>
MrZYX: should I install another gem? One of these?
Grieg has joined #ruby
Grieg has quit [Changing host]
Grieg has joined #ruby
JMcAfreak has joined #ruby
<epta>
Or what it wants that I'll do
<MrZYX>
epta: iirc only half of the ones listed are gems
<epta>
Ok, I'll better install execjs's ebuild with all depends
dallasm has quit [Remote host closed the connection]
F1skr has joined #ruby
puppeh has quit [Remote host closed the connection]
S1kx has quit [Quit: Leaving]
statarb3 has quit [Ping timeout: 264 seconds]
girija has joined #ruby
__Big0__ has joined #ruby
yalue has joined #ruby
Criztian has quit [Remote host closed the connection]
zomgbie has quit [Ping timeout: 260 seconds]
clooth has quit [Quit: clooth]
CreativeEmbassy has joined #ruby
carlyle has joined #ruby
casheew has quit [Read error: Connection reset by peer]
Mathieu has quit [Ping timeout: 260 seconds]
casheew has joined #ruby
clooth has joined #ruby
c6der has quit [Ping timeout: 245 seconds]
casheew has quit [Read error: Connection reset by peer]
failshell has joined #ruby
axl_ has joined #ruby
angle has joined #ruby
Grieg has left #ruby [#ruby]
D4T has joined #ruby
girija has quit [Ping timeout: 248 seconds]
casheew has joined #ruby
chrishough has joined #ruby
jlast has joined #ruby
newUser1234 has quit [Remote host closed the connection]
philcrissman has joined #ruby
newUser1234 has joined #ruby
<pskosinski>
gem install rest-client, then I want to require 'rest_client', error, no such file…
<pskosinski>
what the…
clooth has quit [Quit: clooth]
tjbiddle has joined #ruby
chrishough has quit [Client Quit]
<pskosinski>
I tried require 'rest-client' too
<pskosinski>
Long time ago I was installing it on desktop using gem and it's still working. Now I wanted to install on different machine, not working
<apeiros_>
oh, though, that graphing lib might use it for more
<apeiros_>
gruff
fsperling has joined #ruby
__Big0__ has joined #ruby
sleetdrop has quit [Remote host closed the connection]
IrishGringo has joined #ruby
sleetdrop has joined #ruby
tjbiddle__ has joined #ruby
tjbiddle has quit [Read error: Connection reset by peer]
tjbiddle__ is now known as tjbiddle
daniel_- has joined #ruby
casheew has quit [Read error: Connection reset by peer]
angle has quit [Quit: Leaving]
casheew has joined #ruby
<fsperling>
Hi, any recommendation what to use to control a rackup app via init.d services?
banister`sleep is now known as banisterfiend
<fsperling>
or how to create an init.d script for a rackup app?
angle has joined #ruby
tjbiddle_ has quit [Ping timeout: 245 seconds]
baroquebobcat has quit [Quit: baroquebobcat]
casheew has quit [Read error: Connection reset by peer]
chussenot has quit [Quit: chussenot]
beiter has quit [Ping timeout: 264 seconds]
hemanth has quit [Read error: Connection reset by peer]
Criztian has quit [Remote host closed the connection]
hemanth has joined #ruby
willob has joined #ruby
rgbdev has joined #ruby
casheew has joined #ruby
kpshek has joined #ruby
casheew has quit [Read error: Connection reset by peer]
lewix has joined #ruby
lewix has quit [Changing host]
lewix has joined #ruby
chussenot has joined #ruby
beiter has joined #ruby
devdazed has quit [Quit: Bye]
jonahR has joined #ruby
apeiros_ has quit [Remote host closed the connection]
mirkgeo has joined #ruby
<mirkgeo>
Hello
Takehiro has quit [Ping timeout: 260 seconds]
shevy2 has joined #ruby
haxrbyte_ has quit [Read error: Connection reset by peer]
casheew has joined #ruby
echobinary has quit [Read error: Connection reset by peer]
j^2 has joined #ruby
R_Macy has quit [Quit: Computer has gone to sleep.]
<mirkgeo>
When I do rvm install ruby 1.9.3 I get this: st.c:520:35: error: implicit conversion loses integer precision: 'st_index_t' (aka 'unsigned long') to 'int' [-Werror,-Wshorten-64-to-32]
echobinary has joined #ruby
<hoelzro>
mirkgeo: what OS are you on?
<mirkgeo>
hoelzro: mac
<hoelzro>
do you have an env flags set that would affect the compiler's warnings/errors?
<atmosx>
once you go mac, you never go back!
fumbe has quit [Ping timeout: 272 seconds]
krawchyk_ has quit [Read error: Connection reset by peer]
<mirkgeo>
hoelzro: how do you mean?
casheew has quit [Read error: Connection reset by peer]
alex__c2022 has joined #ruby
<hoelzro>
mirkgeo: I mean do you have CFLAGS or anything like that set
<hoelzro>
atmosx: not true!
d2dchat has joined #ruby
krawchyk has joined #ruby
flakrat has quit [Ping timeout: 245 seconds]
<mirkgeo>
hoelzro: how do I see that?
<hoelzro>
mirkgeo: env
shevy has quit [Ping timeout: 240 seconds]
flakrat has joined #ruby
flakrat has joined #ruby
flakrat has quit [Changing host]
clooth has joined #ruby
<mirkgeo>
hoelzro: cannot see anything there about cflags
<hoelzro>
interesting
Mattix has quit [Remote host closed the connection]
maxmanders has quit [Quit: Computer has gone to sleep.]
casheew has joined #ruby
skum has joined #ruby
<mirkgeo>
hoelzro: so? :)
<hoelzro>
I don't really have any other ideas
skum has quit [Remote host closed the connection]
<hoelzro>
if I were sitting at your machine, I'd probably be able to help
skum has joined #ruby
c6der has quit [Remote host closed the connection]
<mirkgeo>
Ah, ok, damn.
mockra has quit [Remote host closed the connection]
<mirkgeo>
atmosx: maybe you have an idea? :D
philcrissman has quit [Remote host closed the connection]
zigomir has quit [Quit: zigomir]
<atmosx>
nope, everything workds here
<atmosx>
works fine
ilyam has joined #ruby
<hoelzro>
mirkgeo: what compiler are you using?
<mirkgeo>
hoelzro: it looks like the log says CC=clang
idkazuma has joined #ruby
<hoelzro>
mirkgeo: what's the patch level of ruby?
<hoelzro>
ruby-1.9.3-p?
<mirkgeo>
392 I think it choose
sleetdro_ has joined #ruby
oposomme has joined #ruby
lewix has quit [Read error: Connection reset by peer]
oposomme has quit [Read error: Connection reset by peer]
oposomme has joined #ruby
akashj87 has joined #ruby
bradhe has joined #ruby
* hoelzro
tries
Vainoharhainen has quit [Ping timeout: 260 seconds]
skumt has joined #ruby
skumt has quit [Read error: Connection reset by peer]
lewix has joined #ruby
guillaum has joined #ruby
spider-mario has joined #ruby
dhruvasagar has joined #ruby
casheew has quit [Read error: Connection reset by peer]
lewix has quit [Client Quit]
mockra has joined #ruby
danneu has joined #ruby
lewix has joined #ruby
casheew has joined #ruby
jellosea_ has quit [Quit: jellosea_]
sleetdrop has quit [Ping timeout: 272 seconds]
<hoelzro>
mirkgeo: have you tried building it by hand?
fumbe has joined #ruby
oposomme|away has quit [Ping timeout: 272 seconds]
Xeago has quit [Remote host closed the connection]
<mirkgeo>
hoelzro: no, just rvm install ruby 1.9.3
<hoelzro>
try building it by hand, see if that changes things
skum has quit [Ping timeout: 255 seconds]
<mirkgeo>
hoelzro: did it work for you with clang?
<dominikh>
whitequark: it needs more RAM than I have money for right now ;)
bricker`1A has quit [Ping timeout: 245 seconds]
<whitequark>
dominikh: how much?
<Spooner_>
dominikh, Why not host it on Github?
hoelzro is now known as hoelzro|away
<whitequark>
I have spare ram on wq.org
maxmanders has joined #ruby
shadowshell has joined #ruby
sepp2k1 has joined #ruby
<dominikh>
whitequark: not much per se, it's just a lightweight padrino app. but my server's swapping as is :)
<whitequark>
dominikh: how about I give you a shell account?
Ontolog has joined #ruby
<dominikh>
whitequark: ah, darn. DNS might be a problem
<whitequark>
can you CNAME it?
<solidoodlesuppor>
dominkh: Do you have an example for generating daily logs?
carloslopes has joined #ruby
<whitequark>
dominikh: also I have my own DNS master/slave :)
<dominikh>
whitequark: thing is, I might have stuff that relies on cinchrb.org pointing to my current server
bricker`LA has joined #ruby
<whitequark>
(own master, linode's slave)
<whitequark>
I see
<dominikh>
whitequark: it's appreciated though :) I'll figre something out
<whitequark>
'k
<solidoodlesuppor>
dominikh: Cause' I see there is a logging class.
<dominikh>
solidoodlesuppor: a logging interface, yeah. there are a couple loggers implemented you can look at. none do log rotation, but that should be doable
mercwithamouth has quit [Ping timeout: 272 seconds]
jellosea_ has joined #ruby
carloslopes has quit [Ping timeout: 260 seconds]
gyre008 has quit [Ping timeout: 255 seconds]
lewix_ has quit [Remote host closed the connection]
Goles has joined #ruby
maletor has joined #ruby
wreckimnaked has quit [Ping timeout: 248 seconds]
nachtwandler has joined #ruby
jonathanwallace has quit [Quit: WeeChat 0.3.9.2]
<solidoodlesuppor>
dominikh: Dumb question, are logs kept by default? If so where do they live?
<shevy>
question - can we use unbind to steal a method from one class, and then lateron bind it to another class again? (unbind will give us an object of class UnboundMethod)
<shevy>
so far it seems as if UnboundMethod can only work on the same class again? hmm
jurassic has quit [Quit: jurassic]
<dominikh>
solidoodlesuppor: Cinch is less of a full blown framework than it is a library. so no, it doesn't keep any logs. it only prints logs to stdout, and that includes a lot of debugging output as well
atyz has joined #ruby
jonathanwallace has joined #ruby
<solidoodlesuppor>
dominikh: But it would be easy to just send that a local file right? I really don't want to play around with Autumn just to read last nights IRC complaints ;)
<breakingthings>
solidoodlesuppor: cinch supports plugins, someone's probably written a logger already.
<breakingthings>
might want to search around.
<dominikh>
solidoodlesuppor: yeah. when you initialize a logger, you give it an IO object. can be stdout, can be a File object
sambao21 has quit [Quit: Computer has gone to sleep.]
<dominikh>
solidoodlesuppor: you could very well use the Zcbot logger, which just logs irc in/out messages (named after Zcbot, because pisg supports that format)
mercwithamouth has joined #ruby
idkazuma has quit [Remote host closed the connection]
slainer68 has quit [Remote host closed the connection]
francisfish has quit [Remote host closed the connection]
timonv has quit [Remote host closed the connection]
[eDu] has quit [Quit: [eDu]]
jonahR has joined #ruby
ArchBeOS has quit [Remote host closed the connection]
jellosea_ has quit [Quit: jellosea_]
testingb0t1 has quit [Quit: Leaving.]
Quebert has joined #ruby
<dominikh>
solidoodlesuppor: so something like f = File.open("foo.log"); bot.loggers << Cinch::Logger::ZcbotLogger.new(f); (and don't forget to require "cinch/logger/zcbot_logger")
slainer68 has joined #ruby
hbpoison has quit [Ping timeout: 260 seconds]
spider-mario has quit [Read error: Connection reset by peer]
blaxter has quit [Quit: foo]
<solidoodlesuppor>
Now, I'm about to showcase my ruby ignorance here. Wouldn't require cinch already cover that?
<dominikh>
solidoodlesuppor: nope. cinch itself doesn't require that logger because most people won't use it
daniel_- has joined #ruby
<dominikh>
solidoodlesuppor: requiring cinch just requires cinch.rb, which in turn requires a bunch of stuff itself. that logger isn't one of them
Catbuntu has joined #ruby
jjbohn has joined #ruby
bigoldrock has joined #ruby
jgrevich has joined #ruby
<Catbuntu>
Hi
yashshah has joined #ruby
akashj87 has quit [Ping timeout: 245 seconds]
cantonic has quit [Quit: cantonic]
ocnam has joined #ruby
<shevy>
Hey Dogbuntu
<Catbuntu>
haha
enroxorz has joined #ruby
enroxorz has quit [Changing host]
enroxorz has joined #ruby
mahmoudimus has joined #ruby
Elhu has quit [Quit: Computer has gone to sleep.]
slainer68 has quit [Ping timeout: 260 seconds]
tjbiddle has quit [Quit: tjbiddle]
plantseeker has quit [Quit: Nettalk6 - www.ntalk.de]
browndawg has quit [Ping timeout: 245 seconds]
<shevy>
whatcha coding lately?
hemanth has quit [Read error: Connection reset by peer]
hemanth has joined #ruby
<breakingthings>
apt-meow
<breakingthings>
apt-meow catnip
chendo_ has quit [Ping timeout: 255 seconds]
<shevy>
lol
<shevy>
apt uses perl ...
gaahrdner has quit [Ping timeout: 272 seconds]
bradhe has quit [Remote host closed the connection]
carloslopes has joined #ruby
twoism has joined #ruby
chendo_ has joined #ruby
<whitequark>
perl is awesome
<whitequark>
compared to python in system software these days
<shevy>
cilquirm ok, how else do you want to tell the ruby parser what you mean then? do you suggest that ruby automagically knows where everything is without you having to namespace it?
splud has joined #ruby
eAlchemist has quit [Remote host closed the connection]
<solidoodlesuppor>
dominikh: Trying to get that block from above to work
<shevy>
D = M::N::D
<shevy>
d = D.new
<shevy>
here is another way
<solidoodlesuppor>
Not much luck but still trying
eAlchemist has joined #ruby
jurassic has joined #ruby
jurassic has quit [Client Quit]
<shevy>
one of the biggest reason for namespacing is that you can use the same constant names, in different namespaces
<dominikh>
solidoodlesuppor: in case of doubt you can always pop into #cinch. some helpful folks there. I'm really going to sleep now though
chrishough has quit [Quit: chrishough]
connor__ has joined #ruby
chrishough has joined #ruby
<shevy>
you could even use "already existing names", like: module Test; class Class; end; end; Test::Class.new # => #<Test::Class:0xb69f3510>
connor__ has quit [Read error: Connection reset by peer]
timmow has quit [Remote host closed the connection]
tylersmith has joined #ruby
rkj__ has joined #ruby
<shevy>
becom33 yeah, if you remember to properly quote your strings you can ;)
jjbohn is now known as jjbohn|afk
rgbdev has quit [Quit: rgbdev]
hbpoison has quit [Ping timeout: 252 seconds]
jerius has quit [Ping timeout: 255 seconds]
jerius_ is now known as jerius
rkj has quit [Ping timeout: 264 seconds]
akhet has quit [Remote host closed the connection]
ozgura has joined #ruby
<becom33>
shevy, yea my ba
Vainoharhainen has quit [Quit: Leaving...]
<becom33>
bad
tommyvyo has joined #ruby
a_a_g has joined #ruby
<shevy>
becom33 you still spending time with this metasploit thing? or you moved to other projects
<becom33>
I know I can't do this coz I tried it didnt work I was thinking how can I do this
rkj_ has quit [Ping timeout: 264 seconds]
<becom33>
shevy, moved but that one still working when I get free time :D
tk__ has quit [Quit: ばいばい]
jurassic has joined #ruby
carraroj has quit [Quit: Konversation terminated!]
echobinary has quit [Read error: Connection reset by peer]
echobinary has joined #ruby
hemanth has quit [Read error: Connection reset by peer]
<becom33>
puts "error"; exit() if (error_variable_is_true) and (another_error_variable_is_true)
maxmanders has quit [Quit: Computer has gone to sleep.]
hemanth has joined #ruby
Xeago has quit [Remote host closed the connection]
<shevy>
hmm
<shevy>
you could also use raise instead
ferdev has quit [Quit: ferdev]
<MrZYX>
the if also affects only the last statement
<MrZYX>
the puts would always be executed
<shevy>
raise 'becom33 to earth, becom33 to earth, we encountered a fatal exit!' if error_variable and another_error_variable
<shevy>
oops... a fatal error
<becom33>
lol
UnbertKant has joined #ruby
<UnbertKant>
Hey there!
<shevy>
becom33 also, no need to use exit(), you could just use exit
<becom33>
MrZYX, I want both to execute only if those variables are true
<shevy>
and you dont need to put the variables in ()
<shevy>
your code could translate to:
<becom33>
ok
<shevy>
exit if true and true
<UnbertKant>
I want to write a simple script and I wonder why a method can't access the variable that I defined directly in the script. Is that even possible?
sleetdrop has quit [Remote host closed the connection]
<whitequark>
UnbertKant: >> a = 1; def b; a; end; b
<shevy>
UnbertKant depends on the variable and how you defined it
<whitequark>
for example
<UnbertKant>
(I don't have any classes in the script just some methods at the top, then some variables, then some calls to the methods which want to read the variables but can't )
<shevy>
UnbertKant if you would show the part of your code that confuses you, it would help us!
<shevy>
but whitequark showed one example
<MrZYX>
UnbertKant: you need to define the variable in the global space before using it in the method definition
<UnbertKant>
It's basically like this:
<UnbertKant>
def bla
<UnbertKant>
puts a
<UnbertKant>
a = "something"
<UnbertKant>
bla
<UnbertKant>
end
FenrirReturns has joined #ruby
<shevy>
eh
<shevy>
a inside the method is different from a outside
<becom33>
UnbertKant,
heftig has quit [Quit: Quitting]
<becom33>
u can
nachtwandler has quit [Remote host closed the connection]
<becom33>
def bla inp
<becom33>
puts inp
<becom33>
end
<becom33>
bla("somthing")
<shevy>
UnbertKant change "a" to "@a" and try again
rkj has joined #ruby
<becom33>
^ or can do that
tealmage has joined #ruby
mikurubeam has quit [Quit: When I come back, please tell me in what new ways you have decided to be completely wrong.]
<UnbertKant>
I can't pass it as a parameter, since that method is called by other methods which are called by other methods etc.
<UnbertKant>
I'll try @, thanks.
mikurubeam has joined #ruby
<shevy>
UnbertKant yeah that makes sense, though you could often use a default value then
rkj__ has quit [Ping timeout: 245 seconds]
cilquirm has quit [Quit: cilquirm]
<UnbertKant>
But what's the reason why ruby doesn't look in the outer scope if the variable isn't defined in the method?
<shevy>
like becom33's example, you could do this:
<shevy>
def bla(input = @a)
hemanth has quit [Read error: Connection reset by peer]
<shevy>
puts input
<shevy>
end
<shevy>
bla()
breakingthings has quit []
<shevy>
oops, ignore the wrong indent :D
gitesh has joined #ruby
Neomex has joined #ruby
hemanth has joined #ruby
gitesh has quit [Client Quit]
hasimo has joined #ruby
akhet has joined #ruby
Neomex has quit [Client Quit]
<shevy>
UnbertKant good question
<shevy>
UnbertKant it might be that such variables would permanently leak around in a huge project or huge environment
Mon_Ouie has quit [Ping timeout: 252 seconds]
apod has quit []
<shevy>
UnbertKant imagine if you require another project which has 10000000000 of these variables already defined
Liquid-- has joined #ruby
<shevy>
all your methods would be tainted if they would look at these, at least in the "main namespace"
adkron has quit [Ping timeout: 255 seconds]
<shevy>
(and if they use local variable names)
evenix has quit [Read error: Connection reset by peer]
drumsrgr8forn8 has quit [Ping timeout: 245 seconds]
jean-louis has joined #ruby
hasimo has quit [Ping timeout: 272 seconds]
Xeago has joined #ruby
bricker`LA has quit [Ping timeout: 255 seconds]
drumsrgr8forn8 has joined #ruby
elaptics is now known as elaptics`away
rkj has quit [Ping timeout: 245 seconds]
<shevy>
test
<Hanmac>
failed :P
shuky has joined #ruby
walbert has left #ruby [#ruby]
walbert has joined #ruby
takeru has joined #ruby
huoxito has quit [Quit: Leaving]
whitedawg has joined #ruby
sheenobu has joined #ruby
atmosx has joined #ruby
<sheenobu>
I just need some json Rational help. JSON.parse(JSON.dump({ :x => Rational(4,1) })) fails on 1.9.3p363 and rails 3.2.12
<aedorn>
Hmmm... I see much Chakra Linux in my future as Gentoo is failing me. =(
Liquid-- has quit [Quit: Computer has gone to sleep.]
<sheenobu>
do I need to monkey-patch Rational to get to_json to work or just upgrade my JSON libs?
yashshah_ has joined #ruby
tjbiddle has joined #ruby
yashshah has quit [Read error: Connection reset by peer]
takeru has quit [Ping timeout: 248 seconds]
<shevy>
Hanmac sometimes I am disconnected from IRC and dont know when
<shevy>
aedorn yay! deservedly so for you using python! \o/
hbpoison has joined #ruby
<UnbertKant>
Hm... now the variable gets found, but its content is nil... but I'm sure it isnt? def bla; puts @a; end; a= "a"; puts a; bla first puts "a" and than crashes because @a is nil
<shevy>
UnbertKant you dont use @a
<shevy>
@a is not like a
<shevy>
you assign to a:
<shevy>
a = "a"
<aedorn>
I only used it once!
preyalone has quit [Quit: Page closed]
<shevy>
not to @a
chrisja has joined #ruby
<shevy>
UnbertKant a and @a are two different things, remember, you must try to think how the ruby parser "sees" your code
<UnbertKant>
So I have to use @ everywhere when it should be a variable that is the same in and outside of methods?
shuky_ has joined #ruby
<shevy>
UnbertKant as I explained to you before, you can not use local variables leaking into methods
nari has quit [Ping timeout: 272 seconds]
<shevy>
now you first need to accept that fact
<UnbertKant>
Okay, so I don't understand how the parser sees the code. I thought usind @ in a method means "look for that variable outside of the method"
<shevy>
before you did so, we cant continue
shuky has quit [Remote host closed the connection]
<shevy>
your brain must first accept that you can not use local variable names from the outside
_nitti has quit [Remote host closed the connection]
* shevy
waits patiently.
shuky_ is now known as shuky
<UnbertKant>
I'll read up on @ first, brb.
shuky has quit [Remote host closed the connection]
jpfuentes2 has joined #ruby
<shevy>
hehehe
<shevy>
UnbertKant @ is an instance variable, you can use that in your class, and in methods too
<shevy>
UnbertKant you can use instance variables almost like local variables too. you can even remove them
<shevy>
UnbertKant, like remove_instance_variable(:@foo)
johnnygoodmancpa has joined #ruby
jdunck has joined #ruby
Mattix has joined #ruby
hemanth has quit [Read error: Connection reset by peer]
duosrx has quit [Remote host closed the connection]
hemanth has joined #ruby
bradhe has joined #ruby
johnnygoodmancpa has left #ruby [#ruby]
jpfuentes2 has quit [Ping timeout: 256 seconds]
hbpoison has quit [Ping timeout: 255 seconds]
adkron has joined #ruby
alx- has quit [Quit: alx-]
havenwood has joined #ruby
krawchyk_ has joined #ruby
<UnbertKant>
Okay. So when I don't have a class, do I still add an initialize method to the script, where I set the @variables or does initialize only work for classes?
lewis has joined #ruby
nik_-_ has joined #ruby
krawchyk_ has quit [Remote host closed the connection]
<UnbertKant>
Wait, that shouldn't be necessary, since the assignment code gets run in the script? (Unlike if it were a class, where it wouldn't be executed?)
<MrZYX>
write "puts self.class" into a file test.rb and run it with ruby test.rb ;)
heftig has joined #ruby
krawchyk has quit [Ping timeout: 245 seconds]
carlyle has joined #ruby
adkron_ has joined #ruby
jurassic has quit [Quit: jurassic]
<UnbertKant>
So in this case it's possible to write code into a class, but outside of a method and it gets executed. But normally if I write a class I can't just write the code anywhere, it has to go into initialize to be executed?
<MrZYX>
you could write it anywhere too
<MrZYX>
it would be executed when the file is loaded
cmarques has quit [Ping timeout: 245 seconds]
<MrZYX>
if you write it into initialize it gets executed if #new is called on that class
<MrZYX>
because you're inside the main object already
<MrZYX>
try puts self.inspect
clooth has quit [Quit: clooth]
<MrZYX>
everything in ruby is a object, even the toplevel context
QaDeS has quit [Quit: Ex-Chat]
<UnbertKant>
Why is the code in the stack overflow example valid, if the code that sets the variable isn't actually executed?
Zolo has quit [Remote host closed the connection]
echobinary has quit [Quit: -a-]
echobinary has joined #ruby
sheenobu has quit [Quit: sheenobu]
`p has joined #ruby
slopjong has joined #ruby
cmarques has joined #ruby
<MrZYX>
the code in the question or..?
ferdev has joined #ruby
skattyadz has quit [Quit: skattyadz]
sheenobu has joined #ruby
<sheenobu>
nothing? eh -_-
Elhu has joined #ruby
<slopjong>
when using a form input field with the name contact_form[custom_field_values][3], how do I access the value of it? I've tried params[:contact_form][:custom_field_values][3] but this seems wrong
Elhu has quit [Client Quit]
mrsolo has joined #ruby
carloslopes has quit [Remote host closed the connection]
duosrx has quit [Remote host closed the connection]
banjara has joined #ruby
etcetera has joined #ruby
yashshah- has joined #ruby
Bira has quit [Quit: Leaving]
<UnbertKant>
How do I split a string only on the first match of a regex?
Drager has quit [Read error: Connection reset by peer]
etcetera has quit [Client Quit]
<solidoodlesuppor>
undefined method plugins?
<UnbertKant>
For example "Truth = 1+1 = 2" should turn into ["Truth","1+1 = 2"]
<shevy>
UnbertKant give example input, and desired output, of your string.
<solidoodlesuppor>
what up with that? That's almost verbatim what you are doing
yashshah_ has quit [Read error: Connection reset by peer]
zomgbie has joined #ruby
<shevy>
hmm
imami|afk is now known as banseljaj
hadees has quit [Quit: hadees]
Mon_Ouie has joined #ruby
Mon_Ouie has quit [Changing host]
Mon_Ouie has joined #ruby
<UnbertKant>
never mind
etcetera has joined #ruby
Zolo has joined #ruby
chesterjd has joined #ruby
<heftig>
UnbertKant: split(/\s*=\s*/, 2)
gaahrdner has joined #ruby
dhruvasagar has quit [Ping timeout: 240 seconds]
<chesterjd>
Hi everyone. When I define a class, I can write code inside the class, alongside methods and things. Is the inside of a class declaration like a method that gets called when the class is defined?
<MrZYX>
no it gets executed as the class is parsed
<whitequark>
chesterjd: it's just code which gets executed
<whitequark>
MrZYX: it isn't
<shevy>
oh cool
<whitequark>
the code is first parsed in its entirety, then checked for errors, and only then executed
<havenwood>
wormwood: Depends on what you're doing. StringIO, TempFile, etc. What are you using it for?
gyre008_ has quit [Remote host closed the connection]
stkowski has quit [Ping timeout: 260 seconds]
breakingthings has joined #ruby
Davey has quit [Quit: Computer has gone to sleep.]
rockymadden has quit []
_nitti has joined #ruby
<wormwood>
havenwood: an example would be passing javascript code to jslint like system("jslint -stdin #{@code}")
yfeldblum has quit [Ping timeout: 272 seconds]
yashshah- has quit [Read error: Connection reset by peer]
stkowski has joined #ruby
l3ck has quit [Quit: Bye!]
yashshah- has joined #ruby
zomgbie has joined #ruby
hemanth has quit [Read error: Connection reset by peer]
<havenwood>
wormwood: Where does the file-esque object come in to play?
hemanth has joined #ruby
icole has joined #ruby
Xeago has quit [Remote host closed the connection]
<wormwood>
havenwood: because of how the shell handles strings, it would be better suited to run the check from an actual file
hadees has joined #ruby
geekbri has quit [Remote host closed the connection]
Konfusius has joined #ruby
<wormwood>
havenwood: so I just was looking for a way to make things go faster on that end, but there probably isn't a short to writing file, reading file, and deleteing it
<cool>
I am trying to parse html with nokogiri using .css('tr td font') but it fetches everything which is not what I want. anyway I could get just the name, grand total or other individual data present on the page? http://jsfiddle.net/gAcjy/embedded/result/
<banisterfiend>
cool: cool nickname
_nitti has quit [Remote host closed the connection]
hadees has quit [Quit: hadees]
BlankVerse has joined #ruby
<cool>
banisterfiend: thanks
rezzack has joined #ruby
CreativeEmbassy has joined #ruby
danneu has quit [Read error: Connection reset by peer]
BlankVerse has left #ruby [#ruby]
cantonic has joined #ruby
Progster has quit [Remote host closed the connection]
jonathanwallace has joined #ruby
pavilionXP has quit [Quit: Forget progress by proxy. Land on your own moon.]
_nitti has joined #ruby
charlesstrahan has joined #ruby
Progster has joined #ruby
alexim has quit [Remote host closed the connection]
julian-delphiki has quit [Quit: Computer has gone to sleep.]
gyre007 has joined #ruby
etcetera has quit [Ping timeout: 276 seconds]
yashshah__ has joined #ruby
carloslopes has quit [Remote host closed the connection]
codecop has joined #ruby
ebobby has joined #ruby
tealmage has quit [Ping timeout: 248 seconds]
wallclockbuilder has quit [Remote host closed the connection]
swex_ has quit [Read error: Connection reset by peer]
swex has joined #ruby
dougireton has quit [Remote host closed the connection]
apeiros_ has joined #ruby
etcetera has joined #ruby
whowantstolivef1 has quit [Ping timeout: 272 seconds]
<shevy>
MrZYX yeah but begin/rescue is another layer, I'd rather love to have code that (can?) never breaks :(
<shevy>
mercwithamouth see the good thing that way, you'll never be bored, you always can extend your projects
Nisstyre has quit [Quit: Leaving]
<MrZYX>
shevy: echo "#!/usr/bin/ruby\nbegin\nrequire ARGV[1]\nrescue;end\n" > /usr/local/bin/ruby or something like that :P
<Hanmac>
shevy yeah, like the shampoo spot ... lightning, blackout, the code still runs :D
dougireton has joined #ruby
<Hanmac>
MrZYX the shebang is wrong ... use env
<MrZYX>
or alias ruby="ruby $@ 2> /dev/null"
`p has quit [Remote host closed the connection]
<MrZYX>
hm that wouldn't go recursive Hanmac?
<MrZYX>
given /usr/local/bin is in the $PATH
<Hanmac>
this is the good shebang "!/usr/bin/env ruby"
<shevy>
shampoo spot??? what are you watching Hanmac ... :P
Corax has joined #ruby
<Hanmac>
shevy it was advertisnig
postmodern has joined #ruby
<Hanmac>
shevy google "DreiwetterTaft" :P
Mattix has quit [Quit: Leaving]
becom33 has quit [Quit: Leaving]
philcrissman has quit [Remote host closed the connection]
<mercwithamouth>
shevy: yeah very true. actually it has worked out in my favor. after getting annoyed i printed out all of my ideas and circled/crossed out things that made sense and things that should be trashed. that gave me an ultimate 'cool' project and i can copy a lot of code over from others
`p has joined #ruby
a_a_g has quit [Quit: Leaving.]
kirun has joined #ruby
cilquirm has quit [Quit: cilquirm]
yacks has quit [Quit: Leaving]
_andre has quit [Quit: leaving]
sambao21 has quit [Quit: Computer has gone to sleep.]
echobin4 has quit [Read error: Connection reset by peer]
<mercwithamouth>
ahh while there's a few knowledgeable few people here. does anyone here use rspec 2? i've tried testing on different occasions but i've never gotten a hang of it
echobinary has joined #ruby
<havenwood>
mercwithamouth: Lots of people use RSpec. Personally I like Minitest::Spec.
<Hanmac>
Caelum look for File#open and the block form
hadees has quit [Quit: hadees]
<MrZYX>
also IO#lines
<onewheelskyward>
Caelum you seem to have written a function as a class. Have a whack at breaking that apart into components.
<MrZYX>
all_restaurants = all_restaurants.uniq should be all_restaurants.uniq!
wgosling has joined #ruby
<MrZYX>
"if ! menus[i][r] then" should be "unless menus[i][r]"
<lectrick>
Is it even possible to design an ImmutableHash class?
<Hanmac>
lectrick what should it do?
tcstar has joined #ruby
<lectrick>
Hanmac: Some kind of autodup if it's assigned to a new variable, I guess :O
thecodethinker has joined #ruby
<thecodethinker>
Is ruby + rails good for game development? with something like webgl?
icy` has joined #ruby
icy` has quit [Changing host]
icy` has joined #ruby
<shevy>
thecodethinker why do you mention rails + webgl ???
<lectrick>
lol
<julian-delphiki>
thats a #rubyonrails question
<lectrick>
thecodethinker: it's good, if you like ruby. and/or rails I guess
<shevy>
thecodethinker there are a few libraries you could try, gosu and gamebox with ruby for instance. but be aware, designing a game is not easy, it takes a lot of work
QaDeS has joined #ruby
<thecodethinker>
idk im new to ruby :'(
<lectrick>
first priority: do you like the language? second priority: can the language do the job?
<shevy>
thecodethinker I'd recommend you to just stick around using ruby for a while, without diving into anything too specific
<eval-in>
breakingthings => /tmp/execpad-814c576876d3/source-814c576876d3:2:in `<main>': undefined local variable or method `a' for main:Object (NameError) (http://eval.in/12260)
sambao21 has joined #ruby
<thecodethinker>
So ruby is just for serverside stuff then?
<breakingthings>
thecodethinker: everything is for serverside stuff
freakazoid0223 has quit [Read error: Connection reset by peer]
<breakingthings>
javascript is the -only- exception
pkircher has quit [Read error: Operation timed out]
<breakingthings>
it is the -only- way to perform in-browser, clientside logic.
<shevy>
thecodethinker I wanna knock you out man
<shevy>
use ruby for everything!
<breakingthings>
brb using ruby to fly rawkets for nasa
<breakingthings>
no, I don't mean coding
<shevy>
you could!
<breakingthings>
I mean like, printing out ruby and using it as a steering wheel.
<thecodethinker>
shevy: :'( don't hate. I'm new to internetz developmentz stuff.. I've been all C languages for all my programmer life
<breakingthings>
thecodethinker: there's going to be a LOT to learn for you to get into web development, rails is not really going to make that any easier.
<breakingthings>
probably harder.
<shevy>
thecodethinker ok so you use C, we can use ruby inline to also use ruby with C directly
jensnorr has joined #ruby
<whitequark>
thecodethinker: don't listen shevy too much
<thecodethinker>
whitequark: I am starting to get that -_-
<havenwood>
shevy: Ruby is for telephony, 3d, robots, whatever - but like all languages other than JS, it doesn't run in a web browser.
<whitequark>
thecodethinker: he's pretty harmful but not really sane
<shevy>
thecodethinker don't listen to whitequark, he is fat
<whitequark>
er, harmless
Roa has quit [Read error: Operation timed out]
<thecodethinker>
shevy: what
<thecodethinker>
shevy: is wrong
<breakingthings>
>To package your binaries into a gem, use hoe's INLINE
<shevy>
hahaha :D
<thecodethinker>
shevy: with being
<thecodethinker>
shevy: FAAAT!!!
<breakingthings>
Don't use hoes inline, man
<shevy>
lol
k3rn3lito has quit [Ping timeout: 260 seconds]
djwonk has joined #ruby
<shevy>
no seriously
<thecodethinker>
(sigh) to coffescript -_- wish me luck
drumsrgr8forn8 has quit [Ping timeout: 240 seconds]
<shevy>
thecodethinker look at that example on that page
<shevy>
builder.c "
<shevy>
long factorial(int max) {
<shevy>
^^^ there! C code in ruby
rupee has joined #ruby
<shevy>
hmm FFI is perhaps even cooler than that
<thecodethinker>
shevy: but I need to be able to make games. It's what I do. If I have some serverside stuff I'll probably use ruby. perl is .... odd and node.js is... js
<whitequark>
-_- shevy, it uses ffi
<shevy>
ah?
<shevy>
man, that's cheating
<swarley>
I think I'm going to be waiting for a while for this to finish
<markalanevans>
If i have that, and then in another class i do : include Genius
<markalanevans>
How from methods inside the Class do i refer to the methods that are included in my module.
banseljaj is now known as imami|afk
etcetera has quit []
miskander has joined #ruby
Illusioneer has quit [Ping timeout: 272 seconds]
miskander has quit [Client Quit]
Xeago has joined #ruby
<markalanevans>
hmm. must be friday?
timonv has joined #ruby
icole has joined #ruby
tommyvyo has joined #ruby
etcetera has joined #ruby
<apeiros_>
markalanevans: you just call them
<markalanevans>
i don't need to refer to this?
<markalanevans>
or sefl
<markalanevans>
self
<apeiros_>
self is implicit
tcstar has joined #ruby
<MrZYX>
Caelum: okay here's what I would end up with by refactoring your first program http://paste.mrzyx.de/show.php?id=1361, maybe it can give you some take aways :)
emmanuelux has joined #ruby
k3rn3lito has quit [Ping timeout: 276 seconds]
RickFromTheSOC has joined #ruby
Roa has quit [Ping timeout: 276 seconds]
etcetera has quit [Client Quit]
<icy`>
include Genius::ClassMethods
<icy`>
then item_shipping_price(...)
<apeiros_>
icy`: read the full thing
carloslopes has joined #ruby
<apeiros_>
he does NOT need to include Genius::ClassMethods
<icy`>
ah right
<apeiros_>
a) because that'd be wrong (extend, not include) and b) because Genius already does that
carloslopes has quit [Remote host closed the connection]
__Big0__ has quit [Remote host closed the connection]
carloslopes has joined #ruby
ddd has quit [Ping timeout: 245 seconds]
verysoft_ has joined #ruby
<markalanevans>
So Perhaps i'm a tad confused. I'm just learning Sinatra. And in my main sinatra file
<markalanevans>
class App < Sinatra::Base
<markalanevans>
i do include Genius
hadees has quit [Quit: hadees]
<apeiros_>
class Foo; include Genius; def self.foo; some_method_from_genius_class_methods; end; def bar; some_method_from_genius_instance_methods; end; end
alx- has quit [Quit: alx-]
<markalanevans>
Then in the get '/' section i try to use method_from_my_module
<markalanevans>
But i'm getting undefined issues.
<apeiros_>
from which module. you have two…
<markalanevans>
apeiros_: your refering to my paste?
<apeiros_>
also I'm not sure in what context sinatra runs the block passed to `get`
<markalanevans>
In this case the one in ClassMethods
<apeiros_>
markalanevans: yes
<apeiros_>
markalanevans: I *assume* that the block passed to get is instance_eval'ed
<apeiros_>
then you'd have to use self.class.method_name in that block
<markalanevans>
ok.
<markalanevans>
let me try that
philcrissman has joined #ruby
<apeiros_>
but you're probably not supposed to use the class methods there anyway
lewis is now known as lewix
<apeiros_>
but I haven't played with sinatra
ddd has joined #ruby
<onewheelskyward>
Sinatra is quite fun.
<markalanevans>
Woot.
<markalanevans>
apeiros_: thats worked.
<markalanevans>
So apeiros_ why is that again
<apeiros_>
markalanevans: consider the `get` stuff to be instance methods then
<markalanevans>
you said i "assume" that the block paassed to get is instance_evaled
<apeiros_>
because the methods in ClassMethods become class methods (hence the name)
<apeiros_>
why I assume? because I don't know. and you can't tell just from the method signature.
<markalanevans>
apeiros_: so if i wanted to just use the method without the .class they should be in the instanec module?
<markalanevans>
*instance
Davey has joined #ruby
<apeiros_>
yes
<apeiros_>
the methods in ClassMethods can be used in the class body
Neomex has joined #ruby
carloslopes has quit [Ping timeout: 256 seconds]
<apeiros_>
useful to define methods like sinatra's "get" method
<markalanevans>
Ok. I'm going to test that. So if your assumption is correct, i could just use the method name without self as well?
<apeiros_>
or ruby's "attr_accessor"
<Caelum>
MrZYX: what is inject(&:+), is that kind of like how you do a reduce in haskell?
love_color_text has quit [Remote host closed the connection]
<apeiros_>
markalanevans: any method which you can call with self, you can call without. only exceptions: keywords and methods ending with '='
<MrZYX>
Caelum: don't know haskell but it's the compensation for the lack of a sum function
katherinem13 has quit [Ping timeout: 250 seconds]
<apeiros_>
(self.class e.g., because class is a keyword)
<apeiros_>
MrZYX, Caelum: inject(:+) - faster than inject(&:+)
<markalanevans>
apeiros_: when defining a class is it clear to use self. just for clarity?
<apeiros_>
markalanevans: *defining* a method is different from calling
<markalanevans>
* ment calling
hemanth has quit [Read error: Connection reset by peer]
reppard has quit [Ping timeout: 245 seconds]
<apeiros_>
`def self.foo` defines a class method. `def foo` defines an instance method
<MrZYX>
apeiros_: thanks
hemanth has joined #ruby
russfrank has quit [Ping timeout: 256 seconds]
<apeiros_>
markalanevans: I never use self for method calls. I find that redundant, even annoying.
jtperreault has quit [Ping timeout: 245 seconds]
<markalanevans>
ok.
<lewix>
Caelum: reduce and inject are interchangeable
<markalanevans>
Just trying to learn the best pracitces etc.
icy` has quit [Ping timeout: 260 seconds]
_nitti_ has joined #ruby
woolite64 has quit [Quit: Leaving]
<apeiros_>
markalanevans: sure. asking is a good method for that ;-)
akhet has joined #ruby
<markalanevans>
Cool. Thanks apeiros_
<apeiros_>
also a good method: paste (reproducable!) code and ask for help refactoring
jjbohn has quit [Quit: Leaving...]
<lewix>
apeiros_: it's pretty
_nitti has quit [Ping timeout: 248 seconds]
mockra has joined #ruby
<markalanevans>
ok
_nitti__ has joined #ruby
Neomex has quit [Quit: Neomex]
cr3 has quit [Quit: leaving]
mfletcher has joined #ruby
<shevy>
markalanevans a good practice is to try to achieve what you really need, in as few characters as required
wyhaines_ has joined #ruby
senayar has joined #ruby
<markalanevans>
shevy: gotcha. Will keep that in mind
wyhaines has quit [Read error: No route to host]
s__dana_ has joined #ruby
<shevy>
Caelum you can either do something like array.map {|x| x.chomp } or this here array.map(&:chomp)
mfletcher has quit []
verysoft_ has quit []
_nitti_ has quit [Ping timeout: 248 seconds]
<shevy>
anyone of you guys using __END__ a lot?
nga4 has joined #ruby
verysoftoiletppr has joined #ruby
<apeiros_>
during development? all the time
<shevy>
cool
<apeiros_>
production to actually read data? rarely ever
<shevy>
what kind of data do you happen to store after __END__ ?
<Caelum>
shevy: I see, thank you
<apeiros_>
old code I'm rewriting or refactoring
<shevy>
well, right now I am thinking of storing some configuration-like values in a .rb file
<apeiros_>
i.e., I abuse it as comment :)
<shevy>
hehe
evenix has quit [Remote host closed the connection]
<Caelum>
MrZYX: thank you very much for all your help, I've learned a great deal about ruby. Still need to read a book, but now I won't be lost when I need to read some code
katherinem13 has joined #ruby
s__dana has quit [Ping timeout: 272 seconds]
s__dana_ is now known as s__dana
<MrZYX>
you're welcome :)
alex__c2022 has quit [Quit: alex__c2022]
tjbiddle_ has joined #ruby
_nitti has joined #ruby
jerius has quit []
ashabhasa has joined #ruby
russfrank has joined #ruby
ashabhasa has quit [Client Quit]
tjbiddle has quit [Ping timeout: 260 seconds]
tjbiddle_ is now known as tjbiddle
_nitti_ has joined #ruby
senayar has quit [Remote host closed the connection]
_nitti__ has quit [Ping timeout: 245 seconds]
Rioji has quit [Remote host closed the connection]
Politoed has joined #ruby
yashshah__ has quit [Read error: Connection reset by peer]
yashshah__ has joined #ruby
<lewix>
Caelum: what material you used to learn
Zolo has quit [Remote host closed the connection]
mulinux has quit [Quit: mulinux]
jtharris has quit [Quit: WeeChat 0.4.0]
tommyvyo has quit [Quit:]
Zolo has joined #ruby
<Caelum>
lewix: for this thing? just some quick google searches
_nitti has quit [Ping timeout: 240 seconds]
mirkgeo has quit [Ping timeout: 245 seconds]
codecop has quit [Ping timeout: 264 seconds]
hbpoison has joined #ruby
chico_chicote has joined #ruby
_nitti has joined #ruby
gommo has quit [Remote host closed the connection]
iamjarvo has quit [Quit: Leaving.]
bonhoeffer has joined #ruby
forrest has quit [Quit: Leaving]
nicoulaj has quit [Remote host closed the connection]
s__dana_ has joined #ruby
jasonthesensei has joined #ruby
<jasonthesensei>
hi everyone Im new to ruby ran into problem i have rubygems instlled but when i'm in irb and i require 'rubygems' the response is false ny ide how to fix this
verysoftoiletppr has quit [Read error: Connection reset by peer]
Davey has quit [Quit: Computer has gone to sleep.]
_nitti_ has quit [Ping timeout: 264 seconds]
<shevy>
jasonthesensei, what ruby version
s__dana has quit [Ping timeout: 250 seconds]
s__dana_ is now known as s__dana
hbpoison has quit [Ping timeout: 248 seconds]
<shevy>
since 1.9 and higher, rubygems should be integrated so you no longer have to require it
<jasonthesensei>
1.9.3p0
<shevy>
and a return value of false here often indicates that it was already required
<Hanmac>
jasonthesensei ... false means that rubygems is allready required
<jasonthesensei>
thnks a lot
<shevy>
example:
<shevy>
require 'mathn' # => true
adkron_ has quit [Ping timeout: 256 seconds]
<shevy>
require 'mathn' # => false
Liquid-- has joined #ruby
hemanth has quit [Read error: Connection reset by peer]
<jasonthesensei>
yeah i had done require 'money' # => true
hemanth has joined #ruby
adkron has quit [Ping timeout: 276 seconds]
<apeiros_>
with ruby 1.9, rubygems is by default always loaded
<Caelum>
what's the difference between array.all do |i| and array.all? do |i| do you use all? when you want to return a boolean?
<jasonthesensei>
Thank you so i just require my gem in irb
<apeiros_>
a failing require will raise LoadError
lewix has quit [Ping timeout: 272 seconds]
<shevy>
Caelum where do you have this example
adkron has joined #ruby
adkron_ has joined #ruby
<apeiros_>
Caelum: array.all does not exist
<shevy>
Caelum "all" is another method than "all?" do you know that? unless you would alias one to the other
<apeiros_>
Caelum: are you looking at rails maybe? i.e. ActiveRecord::Base::all ?
yfeldblum has quit [Ping timeout: 272 seconds]
verysoftoiletppr has joined #ruby
<Caelum>
apeiros_: I see, thank you
jeffreybaird has quit [Quit: jeffreybaird]
thecodethinker has quit [Quit: Lost terminal]
elux has quit [Quit: Leaving...]
RickFromTheSOC has left #ruby ["Leaving"]
<Caelum>
apeiros_: the method? methods are a bit confusing if you're not used to them
<apeiros_>
Caelum: with `all?`, the ? is just part of the method name
drumsrgr1 has joined #ruby
<apeiros_>
and yes, they usually return true/false
<apeiros_>
Caelum: why should they be confusing? it's just a name. same with methods ending with !
invisime has quit [Quit: Leaving.]
emmanuelux has quit [Ping timeout: 260 seconds]
CreativeEmbassy has quit [Quit: Computer has gone to sleep.]
<Caelum>
apeiros_: now that you explain that it makes more sense, but without knowing that it looks like syntax
<apeiros_>
ok
Davey has joined #ruby
alanp_ has joined #ruby
<apeiros_>
I can imagine that it is confusing without knowing that it's just part of the name
drumsrgr8forn8 has quit [Ping timeout: 240 seconds]
breakingthings has quit []
echobin6 has quit [Read error: Connection reset by peer]
philcrissman has quit [Remote host closed the connection]
echobinary has joined #ruby
R_Macy has quit [Quit: Computer has gone to sleep.]
Liquid-- has quit [Quit: Computer has gone to sleep.]
carlyle has quit [Remote host closed the connection]
R_Macy has joined #ruby
hemanth has quit [Read error: Connection reset by peer]
xeronic has quit []
alanp has quit [Ping timeout: 276 seconds]
hemanth has joined #ruby
drumsrgr1 has quit [Ping timeout: 240 seconds]
DaltonUS has joined #ruby
motto has quit [Quit: Sto andando via]
kofno has joined #ruby
the_jeebster has joined #ruby
<the_jeebster>
I'm curious to know…do any of you guys code in an outdoor environment?
solidoodlesuppor has quit [Remote host closed the connection]
<Hanmac>
the outdoor is a fake :P
<the_jeebster>
:(
<the_jeebster>
all I'm saying is give me a laptop, screen-protector, and headphones and I can be just as productive. I feel better with natural stimulation anyways