Topic for #ruby is now Ruby programming language || ruby-lang.org || RUBY SUMMER OF CODE! rubysoc.org/ || Paste >3 lines of text in http://pastie.org || Para a nossa audiencia em portugues http://ruby-br.org/
Lord-Harlot joined #ruby
mattonrails joined #ruby
dasfugufish1 joined #ruby
esparkman joined #ruby
jbpros joined #ruby
ilyam_ joined #ruby
vovik joined #ruby
esparkman joined #ruby
iocor joined #ruby
ethndbst joined #ruby
strife25 joined #ruby
replore joined #ruby
<Avi`> is there a cleaner way to express something like "if this array is empty, return "some string" else do.some.operation.and.return.it " outside of exactly what i wrote
<Avi`> i always feel silly writing code like that in ruby
<Avi`> (i basically write if array.empty? return "string" else return 'operation' end)
<Avi`> i was thinking .. return 'operation' unless ar.empty? but that doesn't let me do something if the array is empty to change what i return
kuadrosx joined #ruby
<mksm> array.empty? ? "blop" : foo()
tomzx joined #ruby
tayy joined #ruby
havenn joined #ruby
<Avi`> oh ternary statement
<Avi`> why didn't i think of that
<Avi`> that seems like exactly the kind of thing a ruby person would do
<Avi`> (seems hard to read to me, but whatever)
<Avi`> im tired of people rewriting my checkins cause they aren't 'ruby enough'
randym joined #ruby
Lord-Harlot joined #ruby
<mksm> iirc it's originally from C
<Avi`> ternary? yeah it is
<Avi`> atleast i picked it up from C++ anyway
<Avi`> i just don't use them often because i think they are harder to read =)
<Avi`> intent is lost in two tiny ass characters, ? and :
<Avi`> if X else Y is very clear and easy to see
randym_ joined #ruby
bwlang joined #ruby
<mksm> yeah it really depends on the coder
macmartine_ joined #ruby
<Avi`> yeah
<Avi`> im a very verbose coder
<Avi`> and i know it.
<shadoi> Avi`: ary[0] rescue my_method_that_does_something
<Avi`> and i feel bad when i write ruby because i know im being a lot more verbose and ruby lets me be 'less' verbose
<mksm> i've recently shifted from "something() if blop.empty?" to "blop.empty? and something"
<Avi`> shadoi: hahah
<shadoi> :)
<Avi`> shadoi: thats so gross =(
<zedUNDginger> mksm: yucky bunny
<Avi`> i should commit that
<shadoi> do it, I dare you.
<Avi`> shadoi: hehe it doesn't let me return two diff things in that case however =)
<Avi`> shadoi: if its empty return X otherwise do Y & return it
<havenn> As long as it isn't nested ternaries I don't mind em.
<Avi`> thats just "if empty"
<mksm> zedUNDginger: :(
<shadoi> Avi`: you have to check for empty AND nil, so you might as well just do a fully verbose if.
<Avi`> nah, rails
<Avi`> don't they have some special empty AND nil check
Draco_ joined #ruby
<shadoi> blank?
<Avi`> bingo
<Avi`> i just didn't put it in my example cause this is #ruby not #rails
<havenn> def blank?; respond_to?(:empty?) ? empty? : !self; end
<Avi`> man i really want to commit an array[0] rescue haha
<shadoi> I actually use it in a couple cases where I'm raising specific exceptions
Axilla joined #ruby
beilabs joined #ruby
<shadoi> I like it :)
rsampaio joined #ruby
austinbv joined #ruby
<austinbv> can someone tell me why "the ((verb)) jumped over the ((noun))".match(/\(\((.+)\)\)/) does not return noun and verb
<Avi`> shadoi: haha he said he'd write a git hook to reject code like that
<austinbv> but instead returns verb)) jumped over the ((noun
<Avi`> ah well, I'll commit what I had originally and save that gem for later
<shadoi> Avi`: normally I'd agree
esparkman joined #ruby
<shadoi> I should probably use try/catch instead actually
<shadoi> austinbv: are you using rubular.com?
esparkman joined #ruby
<austinbv> no didnt know it existed
sdwrage joined #ruby
<austinbv> ruby regexp just seems pretty damn greedy
<austinbv> .+ matching to the eol is a little weird
<austinbv> ah there we go
<austinbv> .+?
badabim_ joined #ruby
axl__ joined #ruby
demet8 joined #ruby
raincole joined #ruby
raincole_ joined #ruby
dasfugufish joined #ruby
awesome__ joined #ruby
manizzle joined #ruby
<shadoi> austinbv: so… (expression?) is "capture all matches to the expression", and (expression) is "capture the last occurrence on the line" yeah?
bigkm joined #ruby
<austinbv> no
dfamorato joined #ruby
mxweas_ joined #ruby
notbrent joined #ruby
poisonar1s joined #ruby
iocor joined #ruby
looopy joined #ruby
austinbv joined #ruby
arpegius joined #ruby
xpot-mobile joined #ruby
Skaag joined #ruby
xpot-mobile joined #ruby
moondiamond joined #ruby
nari joined #ruby
perryh_ joined #ruby
perryh_ joined #ruby
xpot-mobile joined #ruby
sbanwart joined #ruby
vanmik joined #ruby
xol joined #ruby
esparkman joined #ruby
zenergi_ joined #ruby
flip_digits joined #ruby
iamjarvo_ joined #ruby
ilyam joined #ruby
sodani1 joined #ruby
<sodani1> hello, what string method can I use to return just the first 10 characters?
syamajala joined #ruby
<mksm> str[0,10]
moondiamond joined #ruby
<sodani1> thanks
randym joined #ruby
looopy joined #ruby
dbgster joined #ruby
daniel_hinojosa joined #ruby
mlr joined #ruby
<mlr> Hi, I'm very, very new to ruby, but is there a reason that if @FOO==nil wouldn't be true?
<mlr> Please let me know if you need more info. I have a python background, so just getting acquainted with Ruby so I can hack a co-workers script.
sbanwart joined #ruby
<mksm> mlr: if it was never set then it's nil
libertyprime joined #ruby
<mlr> mksm: Curious. The following outputs nil once, not twice: http://dpaste.com/hold/663056/
<mksm> mlr: it's missing a "end" in the ... end
<mksm> :D
<mlr> mksm: Sorry - that was a made up example. The real code has an end statement. Here's the proper sample: http://dpaste.com/hold/663058/
<mksm> you set a value for @db_class
<mksm> so it won't be nil the second time
Seisatsu joined #ruby
kuadrosx joined #ruby
<mlr> mksm: Umm, this code says print the value of DB_CLASS, then if it's nil, print it again, right?
<mlr> So the first time, it prints nil. Then it doesn't print it the second time, right, so at the point of the if statement DB_CLASS isn't nil.
<mlr> Right?
steph021 joined #ruby
steph021 joined #ruby
<mksm> no
<mksm> it should print twice
<mlr> Right...but it doesn't. Hence my utter confusion.
<mlr> Unless...I have a string that's equal to nil.
<mlr> ie "nil"
sbanwart_ joined #ruby
<mksm> "nil" != nil
<mlr> True dat. I'm just trying to think of why this could possibly not be working.
<mksm> probably because of the rest of the script
<mlr> You think it's crashing before it gets to the next puts statement?
albemuth joined #ruby
<mksm> no, it could be iterating
roaminghorse joined #ruby
crassus_ joined #ruby
kuadrosx joined #ruby
crassus left #ruby
LittleBill902 joined #ruby
ilyam joined #ruby
<sodani1> if I have a string object that represents a uri and I want to grab only the domain name, which method would I use?
<mksm> URI.parse("http://url.com").host
gregorz joined #ruby
dhruvasagar joined #ruby
<sodani1> mksm: thanks. any idea how I can get rid of the www. if that exists?
<sodani1> for example, if I want "http://www.yahoo.com/xyz" to return just yahoo.com
<any-key> URI('asdfasdfasdf.com/any-key/is/cool').host
<any-key> be sure to require 'URI'
<mksm> sodani1, check URI docs, dunno if there's a direct method
<any-key> .host
<any-key> nvmd, that still has the www
<any-key> meh close enough
<sodani1> okay thanks. maybe i'll try with the match method and a regexp
<any-key> no
<any-key> nonono use the URI library
zHy_aZa_ycH joined #ruby
<chessguy> am i missing some kind of block/proc gotcha here? https://gist.github.com/1403089
sbanwart_ joined #ruby
<chessguy> i'd expect an 'undefined variable or method foo' error here
dotnull joined #ruby
<sodani1> any-key: thanks. looking at that right now. however, I'm not seeing a way to remove the "www."
marcuspat joined #ruby
<mksm> chessguy, instance_eval(&block.call)
sdwrage joined #ruby
<chessguy> err....what?
savage- joined #ruby
<any-key> sodani1: depending on the variety of URLs you're going to be using, I guess a regex replace couldn't hurt
<chessguy> mksm: that doesn't work
yekta joined #ruby
<chessguy> there is however a simpler case: https://gist.github.com/1403089
<yekta> Is there a built in way to convert "3" => "three"
roaminghorse joined #ruby
<chessguy> mksm: wow
<chessguy> what the heck is going on there?
marknyc joined #ruby
<mksm> chessguy, when you proc.call it will execute what's inside
<mksm> you want to eval what's inside, not the proc itself
<chessguy> but don't i want to pass the method's parameter as a block to instance_eval?
sbanwart__ joined #ruby
<chessguy> so, the method is getting a block, and just passing that as a block to another method. why does it need to send .call?
roaminghorse joined #ruby
kuadrosx joined #ruby
LBRapid joined #ruby
<mksm> chessguy, yield executes the block
<chessguy> mksm so does block.call
<chessguy> i don't see the difference
roaminghorse joined #ruby
eywu joined #ruby
<mksm> chessguy, it depends on usage. You cannot call yield on a proc, you have to use #call. yield is used inside methods when a block is passed
kuadrosx joined #ruby
<sodani1> "www.yahoo.com".gsub('www', '') seems to remove the www, but I can't figure out how to get rid of the period after www. any ideas?
<chessguy> i don't see the difference
<chessguy> oops
<chessguy> i hit up+enter on the wrong screen
jetblack joined #ruby
<mksm> "www.yahoo.com".gsub('www.', '')
<sodani1> the period gives me a syntax error
<shevy> what
<shevy> type the command here please
<shevy> "www.yahoo.com".gsub('www.', '') # => "yahoo.com", no syntax error here
dotnull joined #ruby
<sodani1> oops. i made a mistake. nevermind
sbanwart joined #ruby
<chessguy> mksm: i still don't think that your code is doing what you think it's doing
<chessguy> for example, if you implement a self.method_missing, it doesn't get hit
<shevy> hmm
kf8a joined #ruby
<shevy> I found method_missing leads to bad design
<shevy> at least when I use it :/
<chessguy> shevy: yeah, this is just more a question about a proc/block corner case
kevinbond joined #ruby
kf8a joined #ruby
nerdy_ joined #ruby
Gazler joined #ruby
<mksm> chessguy, what do you think it's doing?
<chessguy> mksm: it's calling the block, but it's not instance_eval'ing it
<mksm> and what's your purpose with instance_eval?
thone joined #ruby
<chessguy> i'm not sure why that matters...
sbanwart_ joined #ruby
<chessguy> but basically i'm using method_missing to make a thin DSL layer
<mksm> it matters if you want to eval the proc or run it
<chessguy> eval, if you mean what i think you mean
<mksm> i think you mean run it :P
kuadrosx joined #ruby
h4mz1d joined #ruby
<chessguy> ok...
<mksm> i added a couple of examples
xol joined #ruby
<chessguy> mksm: ok, here's maybe a clearer example
<chessguy> i would expect those two puts statements to output the same thing
dasfugufish joined #ruby
demet8 left #ruby
cdepue_ joined #ruby
ilyam joined #ruby
<mksm> chessguy, passing a block and passing a proc is not the same think
prudhvi joined #ruby
<mksm> *thing
nerded joined #ruby
<mksm> chessguy, if you want both to work, check #block_given?
<mksm> that way you can #yield or #call
p0y joined #ruby
<chessguy> mksm: but inside of fiddle, block is a proc, right?
aj910martin joined #ruby
<mksm> chessguy, it works like one, but you cannot call proc instance methods on it.
milkpost_ joined #ruby
<mksm> chessguy, i cannot explain why it is like that. Probably someone with knowledge of the internals can/will.
robbyoconnor joined #ruby
kuadrosx joined #ruby
BaalHaddad joined #ruby
zedUNDginger joined #ruby
maletor joined #ruby
looopy joined #ruby
h4mz1d joined #ruby
yekta_ joined #ruby
satyavvd joined #ruby
alienvenom joined #ruby
Azure joined #ruby
Azure joined #ruby
x0F_ joined #ruby
fleas joined #ruby
fleas joined #ruby
kenperkins joined #ruby
nerded joined #ruby
fleas joined #ruby
edwardsharp joined #ruby
edwardsharp left #ruby
igotnolegs joined #ruby
rickmasta joined #ruby
chessguy joined #ruby
derekbarber joined #ruby
un1x01d joined #ruby
<un1x01d> Hi, is there a way to use standard syntax while loops within capistrano ?
<zedUNDginger> un1x01d: i dont know
Ruthenium joined #ruby
headius joined #ruby
adeponte joined #ruby
h4mz1d joined #ruby
gayasentinel joined #ruby
mikeycgto joined #ruby
mikeycgto joined #ruby
vanmik_ joined #ruby
dasfugufish joined #ruby
dchelimsky joined #ruby
badabim joined #ruby
<shevy> standard syntax?
SegFaultAX joined #ruby
kuadrosx joined #ruby
<fleas> standard syntax as opposed to non-standard, just a guess. :-)
ph^ joined #ruby
jetblack joined #ruby
cook1es joined #ruby
<shevy> hmm
<shevy> what does that even mean
LittleBill902 joined #ruby
ryanf joined #ruby
perryh_ joined #ruby
perryh_ joined #ruby
pabloh joined #ruby
lolsuper_ joined #ruby
lolsuper_ joined #ruby
callahad joined #ruby
<callahad> I have a stupid question. What's the most idiomatic way to test if a variable is one of a handful of values? In Python I would say: if var in ["foo", "bar", "baz"]. It seems like the most direct translation to Ruby would be: ["foo", "bar", baz"].include? var, but that seems to read a bit funny.
<callahad> Is that fine Ruby style, or is there a more idiomatic way to test that condition?
<shevy> callahad sure it is fine. if array.include? variable, do something. puts 'Yup, found it.' if %w( foo bar baz ).include? 'foo'
<ryanf> callahad: yeah that is very common ruby style
<shevy> hmm python seems to be shorter here
<ryanf> yes, that is true
<shevy> if var in ["foo", "bar", "baz"]
<callahad> Great, thanks all! It just felt a little funny to say "does this array contain var" when I really mean to express "is var one of these values?" Logically the same, semantically different.
<shevy> if %w( foo bar baz ).include? 'foo'
<shevy> hmm
<ryanf> if that bothers you, you could define .in? on Object and have it take an Enumerable and call include?
<shevy> ah
<ryanf> (note: I am not recommending that)
<shevy> hehe
<ryanf> actually I think rails might do that, I don't know what its definition of in is
<ryanf> haha yeppp
<shevy> it does?
<ryanf> yes
<callahad> ryanf: Hah! I'd rather not monkey patch to get around my own little itch with the language :) Thank you, though!
<shevy> I don't know much about rails
<shevy> but it has a lot of magic :(
<ryanf> shevy: activesupport, one part of rails, is mostly a collection of core extensions
<ryanf> rails has invented a bunch of stuff that later ended up in the core language though
<ryanf> like &:this
<shevy> eeks
<callahad> Though this *is* a rails project…
<shevy> but then again... I dont like ->
* callahad eyes ActiveSupport's .in?
<shevy> and that was invented by matz I guess :D
<ryanf> oh well there you go callahad
<ryanf> if it's a recent version of rails it'll already be there
<ryanf> shevy: yeah I don't think anyone really likes ->
<ryanf> except matz
<callahad> And it makes me feel all semantically happy :)
<ryanf> and presumably RubyPanther
zedUNDginger joined #ruby
<shevy> there was some nice use of ->
<shevy> I think petercooper did it
<zedUNDginger> callahad: that's the idiomatic way
<ryanf> yeah it is true that getting used to include? is probably a better idea
<zedUNDginger> ryanf: heya
<ryanf> I don't know why they even added in? considering that anyone who's spent time programming ruby will bang out .include? without even thinking about it
<shevy> hmm
<ryanf> zedUNDginger: sup broski
<shevy> is "in" a keyword in python?
<ryanf> yes
<callahad> Clearly to sway people like me. But yeah, include? it is. No need to throw rails-isms in places they don't need to be.
<zedUNDginger> ryanf: had a pretty lulzy debugging session with a guy, ill show u the gist and see if u can figure out what's going on
<ryanf> go for it
<callahad> shevy: Yep. "foo in bar" is an expression more or less exactly equivalent to Ruby's "bar.include? foo"
<ryanf> except that include? is a method
<ryanf> how does in work with duck typing?
<ryanf> is there like a special function that you can define that it calls?
<ryanf> like uh __include__ or whatever
<shevy> hmm
<ryanf> or does it only work on lists?
<callahad> I think it's __in__()
<zedUNDginger> ryanf: ok the deal is that this guy wanted to see what the source was of the method that would be called inside a 'super'
<ryanf> oh I see
<ryanf> haha nice
<ryanf> so he did binding.pry inside a method that had a super?
<callahad> ryanf: Ah, here it is. y in x === x.__contains__(y)
raythecat joined #ruby
stephenjudkins joined #ruby
<ryanf> makes sense
<ryanf> zedUNDginger: are you going to send me a gist or what?
<zedUNDginger> haha
<zedUNDginger> sorry i got distracted
<ryanf> haha
<ryanf> hey, state_machine :)
<zedUNDginger> ryanf: yeah he's inside a method
<zedUNDginger> and he wants to know the method that'll be called with a 'super'
<zedUNDginger> ryanf: but he was getting a 'no such superclass' whenever he did it
rickmasta joined #ruby
<ryanf> ooh
<zedUNDginger> ryanf: we were really confused for ages
<zedUNDginger> but i think i give it away at the end of that gist
aces1up joined #ruby
jmcphers joined #ruby
<ryanf> oh yeah I was wondering what else there was
<ryanf> spoilers :(
<ryanf> anyway that is a good bug, I'm sure cirwin will like it
<ryanf> if he hasn't seen it alreadyt
<ryanf> -t
<zedUNDginger> ryanf: it's not a bug
<zedUNDginger> IMO
<aces1up> i have an array of urls, i would like to append http:// on each element if it doesn't exist and then assign this to a variable, would i use map for this?
<zedUNDginger> ryanf: what's your understanding of the situation?
<zedUNDginger> ryanf: basically pry is doing almost 100% the right thing, it was just us who were confused
<ryanf> --super is only looking at actual ancestors of the class, but super itself can call ancestors of the singleton?
<zedUNDginger> ryanf: it can ;)
<ryanf> what can
<zedUNDginger> ryanf: but the trick is look at how he specifies the method
<ryanf> oh hahaha
<ryanf> right
<ryanf> ok
<ryanf> so what about just doing show-method --super then?
<ryanf> does that work?
<zedUNDginger> that would work perfectly
<zedUNDginger> yeah :0
<zedUNDginger> :)
<zedUNDginger> that's what we did in the end: show-method write --super or show-method --super
<ryanf> right, makes sense
<zedUNDginger> they both work, it was just when we specifically referred to teh Class#instance_method that it didnt work
<ryanf> I guess we should make sure people know about the default behavior of those commands
stephenjudkins joined #ruby
<zedUNDginger> which is correct behaviour
<zedUNDginger> ryanf: the only mistake pry makes in that whole gist IMO is the result of the 'whereami' command
<zedUNDginger> ryanf: that's why i filed this https://github.com/pry/pry/issues/356
<ryanf> ahh
<zedUNDginger> but aside from that it was just us forgetting about singleton class methods
<zedUNDginger> that made it so hard to figure out
rsampaio joined #ruby
ker2x joined #ruby
<aces1up> .map {|ele| "http://#{ele}" if !ele.include?('http://')} how can i fix this so that it just returns ele if it already has http:// ?? right now it returns nil for that element.
Y_Ichiro joined #ruby
<ker2x> Friendly greetings ! i'm currently reading a code that use this kind of construction, and i don't understand anything about it : def [](name) , def []=(name, message) ,def call(*), then use it like this : object["clone"].call(receiver, context)
<ryanf> ele.include?('http://') ? ele : "http://#{ele}"
<ryanf> aces1up: ^^
<ker2x> googling for it was, of course, useless as google doesn't search for []= or []
<ryanf> ker2x: [] is the method on a class that is called when you use the [] operator on an instance of it
<incluye> or =~
<ryanf> so object["clone"] is the same thing as object.[]("clone")
<thomasfedb> Hey. Any news on ruby-debug + 1.9.3? People are already migrating back to 1.9.2...
<aces1up> ryan thanks
<ryanf> []= is similar: object["clone"] = foo is the same as object.[]=("clone", foo)
<ryanf> =~ is the operator for matching a regex against a string
* ker2x scratch his head and read the answer a dozens of times.
<ker2x> i take a few mn to understand it then come back if i still don't understand. thank you :)
<any-key> ker2x: think of it like operator overloading
<any-key> if you're familiar with that
<ker2x> yup
<any-key> for example, in a hash the [] operator is used for access
<any-key> similar concept, but the code you're reading is defining its own version of that operator
hemanth joined #ruby
<ker2x> (if it wasn't enough, the args are anonymous function created with proc , but that's another story :p)
Shrink joined #ruby
trivol joined #ruby
bluOxigen joined #ruby
<ker2x> so the object "object" (wich is defined in the Object Class) is behaving like the Array class (but with its own "Object" method instead of the "Array"). ?
<ker2x> (instead of the "Array" methods)
<any-key> unless it's a subclass of Array that's not a safe assumption
<any-key> all it is doing is using the bracket operators
<ker2x> understood :)
<ker2x> thank you
<ker2x> and what about : def call(*) ? what is this * ?
<RubyPanther> I don't like -> any more than anybody else, I just hate it less and like to laugh at it
macmartine joined #ruby
v4n_ joined #ruby
<ker2x> in fact, the full code is :
<ker2x> def call(*)
<ker2x> self
<ker2x> end
<ker2x> odd
Martz joined #ruby
<ker2x> does it evaluate the anonymous function passed as argument ?
LittleBill902 joined #ruby
kuzushi joined #ruby
sonkei joined #ruby
<any-key> RubyPanther: -> reminds me of the "goes to" operator a friend of mine came up with for C
<ker2x> (yes, the code i'm reading is most certainly far above my ruby knowledge)
<any-key> for(int i=10; i -> 0; i--)
poisonar1s joined #ruby
demian`_ joined #ruby
<any-key> ker2x: I don't quite understand it either
<ker2x> ok, no problem, i'll mail the writer of this code :)
<any-key> I'd like to know what the hell that does, fidgeting with the code in IRB doesn't make it do anything other than return "main"
<ker2x> # The call method is used to eval an object. By default objects eval to themselves.
<ker2x> that is the comment that come with this code :))
<any-key> seems like a hack
<ker2x> one last question please, and i think it will help me a lot to read the rest of the code that have less unkown syntax to me (and that have un-googlable syntax) : val ||= @value && @value.dup rescue TypeError
<ker2x> is ||= similar to somethink like += but with || instead of + ?
<ryanf> yep
<ker2x> so val = val || ...
<ker2x> thank you :)
<any-key> ker2x: careful with ||=, it isn't what you think :P
<any-key> basically ||= assigns if nil
<ryanf> or false
<ryanf> it's exactly what he said it is
<any-key> yes
<ryanf> well, almost
* any-key re-reads
<any-key> yeah
roaminghorse joined #ruby
<ker2x> thank you :)
<any-key> I still want to see an explanation of the call function
<ryanf> any-key: can you give more context?
<ryanf> oh
<ryanf> never mind, just saw it
<ker2x> macmartine: wonderfull, i'll read it
<macmartine> ker2x: cool, i'll read it for the 3rd time
<ryanf> wow, I had no idea you could do that
<ryanf> anyway basically what it's doing is just
<ryanf> throwing away any parameters and returning the object you call it on
<ryanf> I guess the idea is that subclasses would override it to do something more useful?
sdwrage joined #ruby
robbyoconnor joined #ruby
<ker2x> you're talking about the call(*) thingy ?
<ryanf> yeah
<ryanf> so if it were call(*args), that would mean "take any number of arguments and put them into an array called args"
<ryanf> just the * appears to mean "take any number of arguments and do nothing with them"
<ker2x> *grins*
<Ruthenium> method returning self can be useful
<ryanf> although I've never seen it before
<Ruthenium> like
<any-key> still seems like a hack :\
<any-key> but that is clever
<Ruthenium> too lazy to remember what it can be useful for
<ryanf> any-key: what does?
<any-key> ryanf: call(*)
mxweas_ joined #ruby
<ryanf> it's not a hack if it's part of the language
<ryanf> which it appears to be
<ryanf> who knew
<any-key> it's just too clever for me
<ker2x> this code is in the book of http://macournoyer.com/
<ryanf> interesting
<ryanf> oh that one
<ryanf> I see
<ker2x> according to his github, he's good at ruby :)
<ker2x> considering that the code i'm reading is not on his gitbug, but sold with his book, i can't pastebin the full class there is no licence with it, so good old copyright apply ^^
<macmartine> "gitbug"
<ker2x> wooops
<ker2x> huhu
vmatiyko joined #ruby
<ker2x> lapsus (is it an english word ?)
<any-key> it is now
<any-key> and I'm saving "gitbug" for the next time I fuck up the branches on a project ;)
<ker2x> ha no i was talking about "lapsus", but i just checked wikipedia and it exist in english too and have the same meaning as in french :)
<ker2x> everything i questionned come from a ruby class that implement Objects in the creation of an homoiconic prototype based langage.
smgt joined #ruby
<ker2x> the hardest class to understand... and the base of everything else ^^
<zedUNDginger> ker2x: nah in ruby #<Class:Class> is the hardest ot understand
<zedUNDginger> it's where all the lines flow into
ksinkar joined #ruby
Banistergalaxy joined #ruby
yxhuvud joined #ruby
ckrailo joined #ruby
<ker2x> not in this langage (which is just an appendix of the book that very quickly implement an homoiconic langage, just for fun)
<ker2x> there is no classes :p
steph021 joined #ruby
steph021 joined #ruby
<ker2x> (only object, method, and messages)
steph021 joined #ruby
steph021 joined #ruby
steph021 joined #ruby
steph021 joined #ruby
steph021 joined #ruby
steph021 joined #ruby
io_syl joined #ruby
io_syl joined #ruby
pen joined #ruby
<mksm> ffi is kinda magical
trivol joined #ruby
<ker2x> ryanf: yes, there is sublcass that override the call method. i just checked :)
<ker2x> so "call"ing object just return object, it make sense :)
renanoronfle joined #ruby
xol joined #ruby
mxweas_ joined #ruby
moondiamond joined #ruby
burgestrand joined #ruby
mikepack joined #ruby
paissad joined #ruby
JohnBat26 joined #ruby
michael_mbp joined #ruby
brownies joined #ruby
<brownies> what's the ruby equivalent to C enums?
<Banistergalaxy> Brownies symbols
<Banistergalaxy> And symbols are better
<brownies> oh just :these_things ?
demet8 joined #ruby
<any-key> yes
<Banistergalaxy> Pretty much
<any-key> not exactly an enum but sure why not :P
<brownies> but i want the enum-style functionality of assigning ints in a reasonable fashion to the things
<any-key> yes
io_syl joined #ruby
io_syl joined #ruby
<brownies> yes?
<any-key> symbols are stored once in memory; they're assigned to an integer value which is used to reference them
<Banistergalaxy> Brownies to do what for example
<brownies> Banistergalaxy: well, it ties into my database -- where i have a "type" column for a particular object in order to represent subclasses
<brownies> that references the primaryKey of the ObjectTypes table
<ryanf> yeah that is annoying
<ryanf> oh huh
<brownies> so, you know, i'd just like to have these constants lying around
<ryanf> brownies: you know, rails can actually help you with that if you make "type" a string
<brownies> :myFirstSubclassType = 1 && :mySecondSubclassType = 2
<ryanf> haha what
<ryanf> oh
<brownies> ryanf: yes but imho the string-lookup-implementation that rails does is shitty and slow
<ryanf> sorry my bad, misread who said that
<brownies> because, well, it IS shitty and slow.
<ryanf> yeah that is fair enough
<ryanf> in that case I would probably just make a module inside your class and assign constants inside it
<brownies> yea i'm aware of the polymorphism (is that what rails calls it?) but i'd rather roll my own in a more correct fashion
<ryanf> like
<ryanf> module Types
<ryanf> MY_TYPE = 0
<ryanf> OTHER_TYPE = 1
<ryanf> etc
<brownies> yeah, i guess so, eh? a variable stored within the superclass object
<ryanf> then you can refer to them with ClassName::Types::MY_TYPE
<ryanf> or inside the class, just Types::MY_TYPE
<ker2x> so, rougly, there is no "enum" :)
<ryanf> yep
<ryanf> not the kind with ascending integers
<brownies> it looks like the Mod.constants might actually get me pretty close? if the ordering of constants is deterministic?
<ryanf> oh
<ryanf> well if you are going to be defining the constants in the first place, you might as well just assign the numbers to them?
<brownies> yea i guess so
<ryanf> but yeah if you need a complete list of them at some point, you can use #constants
<brownies> ryanf: where is that syntax explained for modules? the two colons?
<ker2x> btw, i just finally understood the whole point of the def []=(name, message). It's just syntaxic sugar. it is defined as def []=(name, message) @slots[name] = message end. I could be also created with something like "createSlot(name, message)" but we lose the shinyness :)
<ryanf> brownies: it's called the scope operator
<ryanf> yeah ker2x
<brownies> interesting.
<ryanf> it's also how assignment to a hash is defined
<ker2x> yay \o/
smgt joined #ruby
zedUNDginger joined #ruby
<zedUNDginger> Mon_Ouie: 'alut
<ker2x> http://ruby-doc.org/core-1.9.3/Object.html#method-i-frozen-3F <- what is the "freeze status" of an object please ?
<ker2x> ha, no modification allowed
<ker2x> Prevents further modifications to obj. A RuntimeError will be raised if modification is attempted. There is no way to unfreeze a frozen object. See also Object#frozen?.
senny joined #ruby
<ker2x> interesting
<ker2x> (im reading about dup() vs clone())
marcuspat joined #ruby
bosphorus joined #ruby
roaminghorse joined #ruby
<zedUNDginger> ker2x: Hello you read some interesting things, you must be a real autodidact
<ker2x> kinda... i'm a sysadmin
<ker2x> not a coder :)
benja-M- joined #ruby
mxweas_ joined #ruby
cbuxton joined #ruby
Mchl joined #ruby
raincole joined #ruby
LittleBill902 joined #ruby
zedUNDginger joined #ruby
<ker2x> the code i'm reading is really confusing. eg : Lobby["Number"].clone(@name.to_i). Lobby is of type Object (not the "Ruby Object", "our" own Object class defined earlier) where the method "clone" is, in fact, a dup :D
skim1776 joined #ruby
tobym joined #ruby
<skim1776> do fibers really help? I rewrote a simple program with fibers and it's no faster
JohnBat26 joined #ruby
ChampS_ joined #ruby
EddieBluh joined #ruby
<ker2x> they are blocking ?
fixl joined #ruby
<skim1776> I guess no
<skim1776> I took it from the example of fibonacci but replaced summing them by powering, it works the same time
mjhan joined #ruby
cook1es joined #ruby
<ker2x> well, according to what i understand, fiber is just fine grained scheduling, withing a single thread. i don't see how it could make math faster. It's more about dealing with blocking IO. no ?
mayfield joined #ruby
mayfield left #ruby
user__ joined #ruby
moshef_ joined #ruby
p1d joined #ruby
adeponte_ joined #ruby
<heftig> i assume they're somehow involved in enumerators?
<heftig> e.g. compare:
<heftig> f = Fiber.new { n=0; loop { Fiber.yield n; n+=1 } }
<heftig> e = Enumerator.new { |x| n=0; loop { x.yield n; n+=1 } }
<heftig> i guess the fiber is more powerful, as you can pass something for Fiber.yield to return
<ker2x> woopsy. time go @work
Deesl joined #ruby
<ker2x> thank you for your help. have fun ! :)
<mjhan> \leave #ruby
mjhan left #ruby
ryanf joined #ruby
ph^ joined #ruby
mafolz joined #ruby
Shrink joined #ruby
ikaros joined #ruby
zommi joined #ruby
robotmay joined #ruby
[]Tsukasa[] joined #ruby
<[]Tsukasa[]> What might i be doing wrong here http://pastie.org/2937442 using rb-appscript
jhunter joined #ruby
<skim1776> can we define thread in another thread?
xol joined #ruby
priteshjain joined #ruby
<[]Tsukasa[]> player_state.get is returning playing but when i try to compare it, it only triggers the else statement
<heftig> []Tsukasa[]: what does player_state.get.inspect return?
Morkel joined #ruby
burgestrand joined #ruby
cableray joined #ruby
<[]Tsukasa[]> heftig: Its actually returning :playing not playing
<heftig> so use: if app('iTunes').player_state.get == :playing
bosphorus joined #ruby
<havenn> []Tsukasa[]: "playing" == :playing #=> false
<[]Tsukasa[]> I got it working much thanks :)
dch4pm4n joined #ruby
dv_ joined #ruby
_debo joined #ruby
hooper joined #ruby
batlock666 joined #ruby
stoffus joined #ruby
Helius joined #ruby
psino joined #ruby
<shevy> man
<shevy> that is one annoying nick
<shevy> [][] grrr
cyri_ joined #ruby
jamiemill joined #ruby
JumpMast3r joined #ruby
luckyruby joined #ruby
Lord-Harlot joined #ruby
clockwize joined #ruby
berkes joined #ruby
jorum joined #ruby
apeiros|work joined #ruby
alup joined #ruby
thone joined #ruby
ryanf joined #ruby
skim1776 left #ruby
jbpros joined #ruby
zedUNDginger joined #ruby
_debo joined #ruby
akem joined #ruby
akem joined #ruby
manizzle joined #ruby
thone joined #ruby
krz joined #ruby
fixl joined #ruby
bastilian joined #ruby
BiHi joined #ruby
beckybunny joined #ruby
cook1es joined #ruby
ctp joined #ruby
ikaros joined #ruby
xol joined #ruby
Adman65 joined #ruby
ephemerian joined #ruby
robotmay joined #ruby
zenergi left #ruby
jr00n joined #ruby
sepp2k joined #ruby
dazoakley joined #ruby
trivol joined #ruby
jamiemill joined #ruby
jamiemil joined #ruby
priteshjain joined #ruby
xpot joined #ruby
Banistergalaxy joined #ruby
jensn joined #ruby
adambeynon joined #ruby
fermo joined #ruby
frep joined #ruby
james_cotterill joined #ruby
ping-pong joined #ruby
enikar joined #ruby
xec joined #ruby
hurikhan|Work joined #ruby
randym joined #ruby
pi3r joined #ruby
probst joined #ruby
vitoravelino joined #ruby
clockwize joined #ruby
clockwize joined #ruby
workmad3 joined #ruby
cybercobra joined #ruby
cybercobra joined #ruby
vmatiyko left #ruby
_debo joined #ruby
pantsman joined #ruby
pantsman joined #ruby
tatsuya_o joined #ruby
ph^ joined #ruby
heftig joined #ruby
yfeldblum joined #ruby
berkes joined #ruby
senny joined #ruby
ksinkar_ joined #ruby
kennethreitz joined #ruby
_debo_ joined #ruby
workmad3_ joined #ruby
EddieS joined #ruby
yfeldblum joined #ruby
Hellojere joined #ruby
newbieROR joined #ruby
<newbieROR> hello everyone
<newbieROR> i need a help for authenticating my user with ruby cas client.... i m receiving an error showing that cas_user session parameter is coming null...can anybody help me
Synthead joined #ruby
cybercobra left #ruby
_debo joined #ruby
Amirh joined #ruby
<Amirh> Hello World
<yfeldblum> newbieROR: it's unlikely that there would be many people here who use the ruby CAS client library or are familiar enough with it to help you; perhaps there's a mailing list for that library, or you can send an email to the author, etc?
cmihai left #ruby
<aces1up> what is the right way to string these chars? this line isn't working at all.. gsub!(/\t\r\n?/, '')
preller joined #ruby
randym joined #ruby
ChampS_ joined #ruby
sjltaylor joined #ruby
Banistertab joined #ruby
fermion joined #ruby
<csmrfx_> Banistertab: you got your brick tabletting agin?
<Banistertab> Csmrfx yes carl
<csmrfx> whacha do?
<Banistertab> Csmrfx flashed a factory firmware
<ryanf> is it really bricking if it's fixable?
<Banistertab> Csmfx you got a tab yet carl?
tk_ joined #ruby
<Banistertab> Ryanf its called a soft brick
<Banistertab> Theres also hard and cima bricks
<Banistertab> Coma
<ryanf> ahh
Kiten joined #ruby
Banistertab joined #ruby
<Banistertab> Dc
<Banistertab> Ryanf coma brick
mengu joined #ruby
<Banistertab> You can always fix them but they just get increasingly difficult
<Banistertab> And the average user probably couldnt even fix a soft brick
<Banistertab> Fixing the so called coma vrick requires u to use a sokdering iron hehe
ephemerian joined #ruby
<csmrfx> Banistertab: no tablets
<csmrfx> got gingerbread phone
<csmrfx> all I ever do is sit at home at my desktop so a tab would be kinda useless
<Banistertab> Csmrfx cool
<Banistertab> I habe too many things and feel iverwhelmed
<Banistertab> Overwhelmed
<csmrfx> I get some dev vibes from android tho, who knows I might get turned on to tablets
<Banistertab> Laptop smartphone tablet desktop
<Banistertab> Too much too much
<Banistertab> I just sit ther in a stupor not knowing what to do
<Banistertab> And keepinfg everything synced is a ightmare
<Banistertab> Nightmare
<csmrfx> yeah I got laptop I use as a desktop, a small desktop thats portable for working at clients office and a netbook for surfing at home :D
y3llow joined #ruby
<csmrfx> aw just set up a NAS
<Banistertab> Im using dropbox
<Banistertab> But onky just startng to get into using it seriously
ephemerian joined #ruby
bluOxigen joined #ruby
<csmrfx> ahh, when tech becomes an end in its own means
<Banistertab> Csmrfxtablets are great fu though
<Banistertab> Fun
<newbieROR> thank u yfeldblum ...actually i m bit confused with the present situation as i m not receiving any error but its asking to configure force_ssl_vrification => false...can u pls suggest where to config this...although i know its not safe
cynosure joined #ruby
<csmrfx> yeah maybe if I had a tablet I'd leave my home once in a while......
Manhose joined #ruby
burgestrand joined #ruby
<csmrfx> so I suppose the cloud is needed when we all will have +5 networked flat things with amoleds and 4G
<csmrfx> I only wish ruby was more at home on android
<csmrfx> dont even know how iphone relates to rubies
<csmrfx> (and its kin)
<csmrfx> (or I really hope that something like meego would take over the mobiles too so I could just apt-get and rvm around)
<yfeldblum> newbieROR: see the readme, section marked "A more complicated example"
ikaros joined #ruby
<StitchedKite> csmrfx: apt and dpkg were ported to iphone thats what cydia is built on top of
<yfeldblum> newbieROR: configuration can go in your config/application.rb (applies to all environments), a file in config/initializers/ (also applies to all environments - put stuff here in case your config/application.rb gets too crowded), or an environment file in config/environments/ (used to override specific settings on a per-environment basis)
stoffus1 joined #ruby
looopy joined #ruby
<csmrfx> maybe I should start ruby-android dev group...
skim1776 joined #ruby
ecolitan joined #ruby
xhubert left #ruby
xhubert joined #ruby
<newbieROR> thanks yfeldblum but i previously tried to configure it in enviroments development.rb but dont know it not workd for me...but thanks for your help. well i m presently configuring it on linux suse and i m not getting libopenssl-ruby file.can u pls help me on that...
<newbieROR> one more thing that i thnk i missed is i m configuring a redmine application
burgestrand joined #ruby
hukl joined #ruby
TheNumb joined #ruby
stoffus joined #ruby
kalusn joined #ruby
moondiamond joined #ruby
eugynon joined #ruby
ecolitan joined #ruby
bastilian joined #ruby
<yfeldblum> i don't really know anything about suse ... maybe google knows how to install libopenssl-ruby?
skim1776 left #ruby
kW_ joined #ruby
<csmrfx> you probably would use the package manager
<csmrfx> but then again, apt-cache says it is in libruby so perhaps you dont have your environment set up right or your ruby version doesn't support the version of libopenssl
StitchedKite joined #ruby
bwlang joined #ruby
<newbieROR> thanks yfeldblum csmrfx ...in pakage manager i m not getting lbopenssl , but i tried to compile and run a source file but it didnt helped. can u tell me what should be the syntax if i want to check session parameter :cas_user value in my log..
bosphorus joined #ruby
<Tasser> newbieROR, no libopenssl in your package manager? wtf?
<newbieROR> hey Tasser i think u didnt checkd my name /// it already says dat i m new to ruby and i would be very happy if linux suse enterprise pakage manager help with this...
<newbieROR> but i didnt get that file ...
rsampaio joined #ruby
ChampS_ joined #ruby
cdepue joined #ruby
omry joined #ruby
<Tasser> newbieROR, ruby openssl or openssl?
vereteran joined #ruby
<newbieROR> libopenssl-ruby
<csmrfx> Tasser it should be in libruby
dazoakley joined #ruby
<dagobah_> So, I've come across a situation where two instances of a class share the exact same instance variable (object_id), is this normal?
<csmrfx> just make sure your libruby is up to date and visible to your ruby implementation
<csmrfx> dagobah_: same instance of the instance variable?
<newbieROR> thanks csmrfx i will check dat ...
berkes joined #ruby
<dagobah_> csmrfx: Same object sorry.
KenSentMe joined #ruby
Nowaker joined #ruby
newbieROR left #ruby
ph^ joined #ruby
jonathanrwallace joined #ruby
<dagobah_> It seems I have two instances of a class, but whose instance variable is shared. It doesn't seem right.
iocor joined #ruby
JohnBat26 joined #ruby
RomD`` joined #ruby
<heftig> dagobah_: sample code?
pen joined #ruby
clockwize joined #ruby
workmad3 joined #ruby
iamjarvo joined #ruby
<dagobah_> heftig: http://pastie.org/2938333
<dagobah_> I think it's actually perfectly explanatory :S
<heftig> a = Object.new
<heftig> b = a
<heftig> now b and a reference the same object.
<heftig> changing some aspect of a will change b as well
<heftig> e.g.:
<dagobah_> Indeed, I just somehow though in my head that instance variables should be unique to that instance! How wrong I was.
<heftig> a = ["foo"]
<heftig> b = a
<heftig> b << "bar"
<heftig> the variables are
<heftig> the objects they reference aren't
<dagobah_> So an instance variable is an object (which is unique to an instance?) which reference objects which can be used anywhere?
Pip joined #ruby
thecreators joined #ruby
renanoronfle joined #ruby
<heftig> dagobah_: no, variables aren't objects. variables are object references
JumpMast3r joined #ruby
oponder joined #ruby
priteshjain joined #ruby
<dagobah_> How would one see an object's instance variable table?
<dagobah_> .instance_variables?
metadave joined #ruby
Lord-Harlot joined #ruby
A_D joined #ruby
notbrent joined #ruby
<heftig> dagobah_: yes
kalusn joined #ruby
mklappstuhl joined #ruby
Morkel joined #ruby
bwright joined #ruby
rickmasta joined #ruby
Lord-Harlot joined #ruby
bastilian joined #ruby
BiHi joined #ruby
gayasentinel joined #ruby
Guedes joined #ruby
demet8 left #ruby
demet8 joined #ruby
stoffus joined #ruby
rbanffy joined #ruby
johnduhart joined #ruby
sjltaylor_ joined #ruby
rickmasta joined #ruby
ctp joined #ruby
Pip joined #ruby
Pip joined #ruby
Sephi-Chan joined #ruby
<Sephi-Chan> Hello
wyhaines joined #ruby
workmad3 joined #ruby
<mklappstuhl> can anyone tell me for what reason I should choose factory_girl over fabrication or the other way around?
benja-M-__ joined #ruby
shevy joined #ruby
burgestrand joined #ruby
hinogi joined #ruby
hinogi joined #ruby
tommyvyo_ joined #ruby
looopy joined #ruby
Hellojer_ joined #ruby
<deryl> mklappstuhl: there is no reason other than preference, or if you've had issues with one or the other. which is why i use fabrication. i've had troubles galore with factory_girl. none with fabiracation. That being said, I know a slew of people that have had troubles like I have, and I know a slew that have had their fair share of troubles with fabrication. so take your pick.
<mklappstuhl> deryl: Ok, thanks
<deryl> np
<mklappstuhl> I'm about to go with fabrication because of its mongoid support
lorandi joined #ruby
<deryl> i've never played with monogoid, mongodb, or any of those. I'm strictly psql, sqlite3, or mysql. and mysql *very* rarely
Zanacross joined #ruby
fridim_ joined #ruby
zedUNDginger joined #ruby
deryl joined #ruby
io_syl joined #ruby
io_syl joined #ruby
Reikoku joined #ruby
<Reikoku> Hi all, can anyone tell me if Ruby is a good language to write a client-server collaborative drawing tool using gtk gui objects? :P
<Reikoku> I'm really struggling with choosing a programming language for this project :/
tomzx joined #ruby
zedUNDginger joined #ruby
<shevy> Reikoku hmmmmm
Banistertab joined #ruby
<shevy> you'd probably have to use ruby-gnome bindings
<shevy> Reikoku how about C
enroxorz joined #ruby
<Reikoku> Considered C, I think whatever language I use I'll have to use some gtk libraries/bindings so that's not a worry
<shevy> hmm
<shevy> then it should be ruby vs. python!
nanderoo joined #ruby
<shevy> I am using ruby-gnome somewhat, though I wouldn't know how to make a drawing tool in pure ruby ...
<Reikoku> Main requirements are: need to be able to make a simple (at first) drawing engine for pen/brush/shapes/colours/layers
<shevy> aaaaand layers
<Reikoku> With fast net-code to keep everyone up to date assuming 2Mbit connection or so
<shevy> we are soon at a gimp version in pure ruby :D
<shevy> hmm
<shevy> this all screams C to me
<Reikoku> gimp has filters :P that's the hard bit
ethndbst joined #ruby
ethndbst joined #ruby
<Reikoku> And my other requirement was cross-platform, which C is good for as well
<shevy> yeah
<shevy> C it shall be!
<shevy> I am going to pick for you :)
<Reikoku> But... learning C ;_; lol
<shevy> yes but remember!
<Reikoku> My C is not the best :P
<shevy> ruby is easy to learn
<shevy> as is python
<Reikoku> I was stuck at ruby vs python
<Reikoku> vs perl kindof
<shevy> which perl version?
<Reikoku> 5
<Reikoku> Need the CPAN :P
<burgestrand> Cross-platform C is not as easy as one’d might think, I’d go with a high-level language myself if I could
<Reikoku> I was hoping to use perl, python or ruby
<fridim_> what about ruby and inline C for some parts ?
<shevy> sub under { print "I am perl and I am ugly but that's ok because everyone knows me since almost 30 years!\n";}
<Reikoku> Of the three I'm most comfortable with perl but doesn't seem 'right' :P
<Reikoku> I wouldnt know how to start
<shevy> well
<burgestrand> As for how good ruby is for that stuff I have no idea, have never done anything remotely GUI-oriented in ruby
<shevy> I think the three are all in the same boat
<Reikoku> fridim_: Which bits do you think would require c?
<shevy> perl is the elderly friendly gentleman. john cleese from monty python
<fridim_> Reikoku, not sure it needs it, but in case it might be possible I guess
<shevy> ruby is his handsome daughter. sometimes a bit confused when playing with new things like "to: :bla" or -> ... sometimes using too much make-up. But she is sweet when she doesn't overdo it
yalue joined #ruby
sakamal joined #ruby
<shevy> python is the nephew ... went to military school. shows high discipline ... always tries to find one way and only one way to sail the boat and stay on course and in doing so often rescues the elderly perl gentleman
<fridim_> or maybe jruby (+ java if needed)
<Reikoku> :D at that analogy
<Reikoku> Python definitely went to military school
<shevy> java is the chatty middle-aged family man in the boat... goes to work in the bank sector... always talks and talks and talks and everyone wants to make him shut up sometimes
jtrudeau joined #ruby
<shevy> but he is a bridge builder!
<Reikoku> fridim_: Can you foresee any parts which would be impossible/impractical in pure ruby, then? I really dont quite understand the entire scope of the project yet :P
<shevy> JRuby Groovy and what not! everyone there is a bridge to the faraway land
<shevy> oops. I meant *everywhere
<Reikoku> I'm inexperienced with advanced guis
<fridim_> Reikoku, me neither :D
<Reikoku> Most of what I write has been web-based or console based
<shevy> GUIs can be so annoying
<shevy> I'd go with the web always
<shevy> "client-server collaborative drawing tool using gtk gui objects"
<shevy> not that easy to fullfil
<Reikoku> Dont want to use web :P it pushes me towards Java too much
<Reikoku> And Java is not my friend
alanp_ joined #ruby
Knodi joined #ruby
<Reikoku> I semi-want to use gtk3
<shevy> hmmmm
<shevy> python!
<shevy> well I dont know if they already have bindings
<Reikoku> Ruby does
<Reikoku> I saw them on github :D
<shevy> oh?
pseud0cod3r joined #ruby
nerdy_ joined #ruby
macabre joined #ruby
<shevy> hmmmm
<shevy> never saw that one before
sakamal_ joined #ruby
priteshjain joined #ruby
ramusara joined #ruby
shonk joined #ruby
shonk left #ruby
yekta joined #ruby
felipegb joined #ruby
SplitNova joined #ruby
remink joined #ruby
muzzle-fuzzle joined #ruby
rbanffy joined #ruby
muzzle_fuzzle joined #ruby
vitoravelino joined #ruby
vitoravelino joined #ruby
Azure joined #ruby
Azure joined #ruby
bwwrd joined #ruby
bosphorus joined #ruby
Pip joined #ruby
strife25 joined #ruby
cdepue joined #ruby
renanoronfle joined #ruby
rsampaio joined #ruby
ChampS_ joined #ruby
hooper joined #ruby
dv310p3r joined #ruby
Pip joined #ruby
Pip joined #ruby
ctp left #ruby
Sailias joined #ruby
Draco_ joined #ruby
Draco_ joined #ruby
dv310p3r joined #ruby
hooper joined #ruby
ephemerian joined #ruby
cyri_ joined #ruby
moted joined #ruby
craigglennie joined #ruby
dkannan joined #ruby
mattp_ joined #ruby
poindontcare joined #ruby
grieve joined #ruby
SaneWarning joined #ruby
evantravers joined #ruby
Ankhers joined #ruby
mitchty joined #ruby
atmosx joined #ruby
dcarper joined #ruby
Ankhers joined #ruby
<atmosx> Good evening
alfism joined #ruby
probst joined #ruby
omry joined #ruby
flippingbits joined #ruby
pen joined #ruby
MissionCritical joined #ruby
nerded joined #ruby
LBRapid joined #ruby
rippa joined #ruby
jwill joined #ruby
evantravers joined #ruby
oponder joined #ruby
fayimora joined #ruby
theRoUS joined #ruby
crankycoder joined #ruby
kalusn joined #ruby
remink left #ruby
bier joined #ruby
albemuth joined #ruby
SirFunk joined #ruby
bier|tp joined #ruby
<shellox> hey
spyvrsspy joined #ruby
tvw joined #ruby
<shellox> whats the difference between String(6) and 6.to_s? is the last just an alternative way to the first?
james_cotterill joined #ruby
<heftig> shellox: no difference, in this case
<heftig> String() just calls to_s
kalusn joined #ruby
<heftig> Integer() and .to_i are different, though. the former will raise an exception if supplied a String not representing a number
kalusn joined #ruby
<shellox> heftig: thanks!
milkpost_ joined #ruby
<heftig> same with Float()
bruegel joined #ruby
<raz> what's the best/fastest http library these days?
<shevy> super-http
mengu joined #ruby
<shellox> raz: sinatra?
<shellox> ah lib
<raz> ehm, sorry, i meant http-client :)
<shellox> i thought framework
io_syl joined #ruby
io_syl joined #ruby
Hellojere joined #ruby
dotnull joined #ruby
kuadrosx joined #ruby
eugynon joined #ruby
macmartine joined #ruby
jr00n joined #ruby
ben_alman joined #ruby
marcuspat joined #ruby
marcoecc joined #ruby
svetzal joined #ruby
omry joined #ruby
tobym_ joined #ruby
dotnull joined #ruby
dot_null joined #ruby
Morkel joined #ruby
heftig joined #ruby
dbernar1 joined #ruby
flip_digits joined #ruby
<dbernar1> My install of Ruby on Ubuntu doesn't know where to find ssl certificates, so it can't use ssl to get contents of web pages.
<dbernar1> The error contains "SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B"...
<dbernar1> If googled, that brings up a Stack Overflow page that shows how to fix that.
<dbernar1> Well, it links to a page with instructions.
<dbernar1> However, the instructions use plain net/http, which I don't want to use if possible. I'm using open-uri
<dbernar1> And the instructions show how to configure net/http on the script level, but I would rather set a global variable, or a config directive somewhere.
<dbernar1> Any advice?
milkpost_ joined #ruby
beakerman joined #ruby
mklappstuhl joined #ruby
jbpros joined #ruby
jensn joined #ruby
<jsaak> use curl?
Boohbah joined #ruby
<dbernar1> I guess it could work
<dbernar1> I'll try
_kinderman joined #ruby
kdrsx joined #ruby
BiHi joined #ruby
<dbernar1> It seems to work fine. However, is it doing the check for the SSL certificate of the server it is getting from?
<dbernar1> Or did I just make the script less secure?
Cervajz joined #ruby
Cervajz joined #ruby
crankycoder joined #ruby
csavola joined #ruby
p0y joined #ruby
probst joined #ruby
alex__c2022 joined #ruby
fayimora joined #ruby
atmosx2 joined #ruby
<deryl> dbernar1: iirc you have to install ca-certificates pkg
Lord-Harlot joined #ruby
wyhaines joined #ruby
ckrailo joined #ruby
cjs226 joined #ruby
Draco_ joined #ruby
rtl joined #ruby
alfism joined #ruby
muzzle_fuzzle joined #ruby
Synthead joined #ruby
jamiejackson joined #ruby
muzzle-fuzzle joined #ruby
<dbernar1> I have that installed
<dbernar1> I wonder perhaps the compilation happened at a time when that was unavailable or something :0/
strife25 joined #ruby
io_syl joined #ruby
io_syl joined #ruby
gr33ntux joined #ruby
norex joined #ruby
<dbernar1> Maybe I'll just re-compile...because I can!
<dbernar1> jk
mike___ joined #ruby
gayasentinel joined #ruby
<alanp_> If I store a greater than symbol (:>) in a variable (greater), how can I use it to then compare 2 integers?
thepix joined #ruby
<mike___> hi guys. i have two strings of same length and want to check if one is obtained from the other by a substitution of letters. is there some neat way to do this in ruby?
cantonic joined #ruby
<yfeldblum> var1.send :>, var2
<jensn> alanp_: Use the `send` method.
<alanp_> ahhh
<yfeldblum> comp = :> ; var1.send comp, var2
<mksm> mike___, you mean like the distance between both?
<alanp_> awesome
joast joined #ruby
<mike___> well, for example: abba can be transformed to caac, by a->c, b->a. but it can't be transformed to abcd obviously
gearaholic joined #ruby
cynosure joined #ruby
lkba joined #ruby
<yfeldblum> mike___: for the first pair of characters, mark them in a hash (pairs["c"] = "a"); for the next pair of characters, check if the character from the second word is a hash key; if it is a hash key, verify that the character from the first word is the corresponding value; otherwise, add that pair to the hash; proceed ...
<mike___> yfeldblum: yeah, so the straightforward way... thx
bwright joined #ruby
<yfeldblum> i thought it was pretty neat
jgarvey joined #ruby
LiquidInsect joined #ruby
Telling joined #ruby
Pip joined #ruby
vereteran joined #ruby
dasfugufish joined #ruby
BrianE joined #ruby
p0y joined #ruby
h4mz1d joined #ruby
thepinkster left #ruby
froy joined #ruby
xol joined #ruby
kenperkins joined #ruby
grimeton joined #ruby
excelsio1 joined #ruby
<grimeton> hi i'm trying to get tracks up and running, but each time i want to populate the database it errors out and says that it can't find test-unit
iamjarvo joined #ruby
<grimeton> but test-unit is there and installed
<grimeton> does one have to refresh a cache or something for ruby to see the test-unit?
eldariof joined #ruby
alaska joined #ruby
Rango joined #ruby
<alaska> Is anyone in here familiar with the mongo module?
<dbernar1> Yay! Re-compiling Ruby fixed my problem
<alaska> I am making a simple map_reduce query with raw results and the values seem to be returning as floats instead of integers
vereteran joined #ruby
Draco_ joined #ruby
justicefries joined #ruby
elevenarms joined #ruby
mikepack joined #ruby
dotemacs joined #ruby
Adman65 joined #ruby
bwright joined #ruby
Sliker joined #ruby
jwmann joined #ruby
muzzle_fuzzle joined #ruby
<muzzle_fuzzle> on which os would run ruby best? ( best a small os )
<any-key> Any linux or unix
dfamorato joined #ruby
<any-key> basically anything except windows seems to be the rule of thumb
<Reikoku> Grab gentoo, that's pretty small
<any-key> or arch
<Mon_Ouie> It runs fine on windows too
dkannan joined #ruby
<any-key> Not nearly as well
Manhose joined #ruby
<muzzle_fuzzle> it doesnt! :( i have so much problems on win, i could not run bundler install
<muzzle_fuzzle> because of eventmachine
<any-key> pure ruby might, but once you start adding other dependencies it gets hairy
<muzzle_fuzzle> i wanna run siriproxy and i have so much problems with all this
relix joined #ruby
cesario joined #ruby
<yfeldblum> muzzle_fuzzle: you can run Linux in a VirtualBox virtual machine running on a Windows machine, and run siriproxy in that
philcrissman joined #ruby
zawopak joined #ruby
dazoakley1 joined #ruby
csavola_ joined #ruby
shaatar joined #ruby
pen joined #ruby
Jake232 joined #ruby
<Reikoku> Second the virtual machine suggestion, grab virtualbox and stick Arch in it
cdabba joined #ruby
avandendorpe joined #ruby
dnyy joined #ruby
enikar joined #ruby
davidboy joined #ruby
theishi joined #ruby
centipedefarmer joined #ruby
<theishi> I have these two lines 'var1 = var2' and 'var1.gsub!("a","b")'.... when I run this both var1 and var2 are affected... Is this expected, and if so how can I prevent this behavior?
Pip joined #ruby
john2x joined #ruby
blischalk joined #ruby
xol joined #ruby
<BrianE> theishi: var1 *is* var2. They're both references to the same object
<BrianE> So they're technically not both being affected, it's just the one thing that's being changed
<csavola_> theishi: gsub! performs it's operation in place... gsub without the bang returns it's operations without changing the receiver
Jarred joined #ruby
patricksroberts joined #ruby
<theishi> csavola_: I know that, I am just looking for a way to prevent var2 from being affected.... i just found the dup command and that was what I was looking for
dazoakley1 left #ruby
dazoakley1 joined #ruby
pootpoot joined #ruby
blitzMN joined #ruby
GSpotAssassin joined #ruby
kirk_r joined #ruby
MetaCosm joined #ruby
keymone joined #ruby
<keymone> hi
anachronistic joined #ruby
<keymone> what could be the reason for command to fail when executed through Kernel#system if it successfully executed from shell?
<keymone> same user, same permissions
<JonnieCache> environment variables
<JonnieCache> $PATH most likely
looopy joined #ruby
<JonnieCache> shell env variables are a source of constant pain
perturbedpanda joined #ruby
<JonnieCache> especially when you bring ssh into it
<keymone> this is the error code after calling system: 32512
<keymone> o_0
<JonnieCache> th
<JonnieCache> that comes from the specific command youre running, no idea what that means
mengu joined #ruby
<yfeldblum> what are you trying to run?
<keymone> ok, PATH does not seem relevant because command specifies full path to binary
<keymone> except nohup
kenichi joined #ruby
sonkei joined #ruby
apeiros_ joined #ruby
zetesha joined #ruby
kevinbond joined #ruby
<keymone> looks like this: BUNCH_OF_REE_GC_SETTINGS nohup /full/path/to/spawn-fcgi -f /full/path/to/dispatcher -s /full/path/to/socket -P /full/path/to/pidfile
<JonnieCache> are you in a chroot jail?
<JonnieCache> because that adds a whole other layer of fun
<keymone> no, nothing fancy
<keymone> also $PATH is identical within riuby process and shell where command runs fine
<JonnieCache> try calling the `env` command to list all shell vars
ianbrandt joined #ruby
<JonnieCache> run it from ruby and from the cmdline and see if theres a difference
maletor joined #ruby
Araxia_ joined #ruby
pen joined #ruby
RomD`` joined #ruby
quest88 joined #ruby
Kal9871 joined #ruby
nerded_ joined #ruby
theRoUS joined #ruby
theRoUS joined #ruby
strife25 joined #ruby
iocor joined #ruby
<keymone> nothing is different
p0y joined #ruby
Targen joined #ruby
IrishGringo joined #ruby
<keymone> system returns false and error code 32512 and if i then copypaste same command into shell it works with exit code 0
burgestrand joined #ruby
<Kal9871> Hi, I have a problem and I was wondering if anyone here could help me out. Is there some way of finding out where (at what line and in what file) a method/line of code is defined without raising and catching an exception and using the backtrace method on the exception object? I would use that approach but I'm working in a special environment where the backtrace method doesn't work. Is there any other way of doing this? Any help is appreciated!
<apeiros_> Kal9871: using ruby 1.9?
<burgestrand> Kal9871: __FILE__ and __LINE__
<burgestrand> Or did I misinterpret? :(
ephemerian joined #ruby
perryh joined #ruby
perryh joined #ruby
<apeiros_> Kal9871: in 1.9: foo.method(:bar).source_location gives you that information
<apeiros_> works with FooClass.instance_method(:baz).source_location too
cbuxton joined #ruby
SegFaultAX|work joined #ruby
<apeiros_> if the result is nil, it means the method is implemented in C. I'd go via Method#owner then, and grep sourcecode
p0y_ joined #ruby
ablemike joined #ruby
bosphorus joined #ruby
<ablemike> Ruby trivia: anyone know what gsub stands for?
<apeiros_> global substitution?
<ablemike> apeiros_: thats our guess here
<apeiros_> or: globally substitute
<Kal9871> Using Ruby 1.8.1 unfortunately (lol). I'm working with a RPG game maker called RPG Maker VX that uses Ruby for it's scripting system. All scripts are defined in internal editor. I just tried __FILE__ and it didn't work. It returns "Section095" which I suppose is the internal representation of the script. I will try source_location and report back if it works or not!
<apeiros_> 1.8.1?!? w.o.w.
<apeiros_> oh, that windows thingy…
<Kal9871> Yep
<apeiros_> source_location won't work in 1.8
preller joined #ruby
preller joined #ruby
<Kal9871> Ah I see. Thanks though!
<apeiros_> and given that thing is closed source, I'd assume grepping sources is out of question too…
<Kal9871> I don't have access to the file structure since it's embed in an .exe and I can't programatically access the source of the other scripts
eignerchris joined #ruby
Mahoek joined #ruby
<Kal9871> Hmm it's irritating because if you throw an exception and don't catch it you get a GUI popup window with the line no and the script but I can't figure out how to access that info!
badabim joined #ruby
<apeiros_> you can rescue the exception
ablemike left #ruby
<apeiros_> begin; do_stuff_that_raises; rescue => e; …here you can access e.backtrace… end
zetesha joined #ruby
<Kal9871> Yeah I can rescue it but they changed e.backtrace. It returns "Section" plus some numbers which I think is the internal representation of the script (since scripts are not written in their own files, but in a GUI editor)
tobago joined #ruby
<apeiros_> try Exception.instance_method(:backtrace).call(e)
vtr joined #ruby
<apeiros_> if you're unlucky, they changed it right on exception itself
<apeiros_> I guess you can't use native extensions either?
<Kal9871> Thanks, I'll try that! Nope, no native extensions, no gems at all etc. They even removed require and load from Kernel haha but I monkey-patched my own hacked up version
<apeiros_> did they remove eval and File.read too?
<Kal9871> No that is still there
<apeiros_> because load is mostly just eval(File.read(path))
<Kal9871> yep that's what I figured to :)
<Kal9871> *too
workmad3 joined #ruby
kdrsx joined #ruby
<Kal9871> Ok I tried this:
<Kal9871> begin
<Kal9871> raise StandardError
<Kal9871> rescue StandardError => e
<Kal9871> print Exception.instance_method(:backtrace).call(e)
<Kal9871> end
<Kal9871> And I got this error:
<Kal9871> undefined method `call' for # <UnboundMethod:Exception#backtrace>
<Kal9871> Any idea what this means?
<apeiros_> yay
<apeiros_> it means I fucked up
<apeiros_> it's Exception.instance_method(:backtrace).bind(e).call
eywu joined #ruby
<Kal9871> Ok tried it and got the same thing back: "Section093:2"
<apeiros_> then you're off luck I fear
<apeiros_> at least I'm out of ideas
shadoi joined #ruby
raythecat joined #ruby
Russell^^ joined #ruby
philcrissman joined #ruby
<Kal9871> Yeah looks like it. It's not absolutely necessary that I get to this information but it would be really nice to have. I'll have to live without it. Thanks a lot for your help though!
cableray joined #ruby
Tuxist joined #ruby
mlr joined #ruby
josh___ joined #ruby
advorak joined #ruby
ilyam joined #ruby
QaDeS joined #ruby
adamkittelson joined #ruby
maletor joined #ruby
Pip joined #ruby
Pip joined #ruby
atmosx joined #ruby
dfamorato joined #ruby
moshef_ joined #ruby
h4mz1d joined #ruby
airhorns joined #ruby
nerded joined #ruby
voodoofish430 joined #ruby
apok joined #ruby
perryh joined #ruby
emptyflask joined #ruby
perryh joined #ruby
JumpMast3r joined #ruby
marcuspat joined #ruby
skim1776 joined #ruby
<skim1776> is it possible to wait for all threads to join without explicitely calling t.join on each?
sbanwart_ joined #ruby
luke-- joined #ruby
thecreators joined #ruby
michael_mbp joined #ruby
<shevy> skim1776 I am not sure... perhaps some sneaky way ... but otherwise I'd say no.
tehdekan joined #ruby
Evixion joined #ruby
<skim1776> shevy, what if I have a few millions of threads?
zastaph joined #ruby
<shevy> lol
<apeiros_> skim1776: you're doing something wrong then
<rippa> then your system crashes
<shadoi> lol
<shevy> a few millions threads
<apeiros_> skim1776: anyway, no matter what you do, it'll in the end tell every thread to join
<shevy> what are you trying to do, store a dollar in every thread
<shadoi> use ThreadGroup and don't do insane shit.
<apeiros_> shadoi: ThreadGroup? new thing? ThreadList? or am I confused?
<skim1776> I'm solving the problem of number of points with integer coordinates within sphere with radius r
<apeiros_> confused, as it seems…
<apeiros_> ah, it's ThreadGroup#list, nice…
<shadoi> *nod*
<apeiros_> no ThreadGroup#join, though
<apeiros_> so still having to iterate yourself :)
<shadoi> yeah
<apeiros_> skim1776: that's a CPU bound problem, threading in MRI won't help you speed it up
<apeiros_> in the opposite, it'll be slower
<apeiros_> you can use jruby, or you can fork. but more forks/threads than cores is futile.
<skim1776> apeiros_ I'm afraid threading in MRI won't help at all, I use rbx
<apeiros_> skim1776: threading in MRI does help, but only for IO bound problems.
<skim1776> not my case
<apeiros_> what I said about number of forks/threads applies just as much to rbx as it does to jruby.
jbpros joined #ruby
<apeiros_> not even sure rbx already has native threads. rbx2 already out?
<skim1776> I guess it's not
<skim1776> or it is, I'm not sure
<apeiros_> nope, doesn't seem like. rbx 1's threading afair is the same as MRI's
<apeiros_> won't help you with anything but IO bound problems.
<skim1776> JRuby then?
<apeiros_> (or if you need pseudo-concurrency)
<apeiros_> the problem you try to solve is from project euler?
<skim1776> I think it can be there too
<apeiros_> jruby has native threads, yes
<apeiros_> but again, more threads than your hardware can process in parallel will be slower.
btanaka joined #ruby
Y_Ichiro joined #ruby
sepp2k joined #ruby
<skim1776> hmm.. then I guess I shouldn't use them at all
<skim1776> apeiros_, guys from #rubinius said that it does support native threads
<apeiros_> depends, if you have 2 cores, you can get a speed up close to factor 2 for a well parallelizable problem
<apeiros_> skim1776: ask them for which version of rubinius
<skim1776> apeiros_, for current version
bluOxigen joined #ruby
<apeiros_> hm, their announcment for rbx2 still mentions removal of GIL being one of the biggest changes… is it outdated then?
<apeiros_> wtf, lets just try it…
Skaag joined #ruby
<apeiros_> skim1776: also, important point is not having native threads, but having no GIL
iocor joined #ruby
<apeiros_> rbx 1's threading may well be based on native threads, that doesn't help much with a CPU bound problem if it still has a GIL
<skim1776> they said there's no GIL
<apeiros_> then there's no need to switch to jruby
<apeiros_> hrm, installing rbx takes quite a bit of time…
<skim1776> yeah, jruby installs much faster
sbanwart joined #ruby
<skim1776> are you installing it with rvm?
<apeiros_> yes
nicoulaj joined #ruby
mikeycgto joined #ruby
mikeycgto joined #ruby
<burgestrand> rbx ≠ 2.0 has a GIL, they ought to be talking about rbx2
<apeiros_> that wouldn't be "current", though
<apeiros_> unless people started to talk about non-production stuff as "current", which would be stupid.
<burgestrand> 2.0.0.pre? :p
robotmay joined #ruby
<apeiros_> skim1776: you may want to ask again what version, and ask them to be explicit, i.e. use version numbers, not vague terms like "current"
BoomerET joined #ruby
dv310p3r joined #ruby
<tommylommykins> hmm
<tommylommykins> Does ironruby have GIL?
<shadoi> pretty sure it's abandoned
<apeiros_> tommylommykins: no idea. might not be in the hands of ironruby
<burgestrand> I don’t think ironruby has a GIL, but I do believe it has green threads
<tommylommykins> also
<tommylommykins> if it's CPUbound in ruby
<tommylommykins> adn you're interested in speed
<tommylommykins> Use another language?
<BoomerET> Anyone here familiar w/ wsdl2ruby? When I puts my result, I get #<GetRecordsResponse::GetRecordsRseult:0xbfoo>... How do I access the elements inside that? Is it an array, and I can access it w/ [0] (or [1], or maybe even ['item']?
<burgestrand> or another interpreter, which is kind of the point here ^^
<apeiros_> tommylommykins: as said, unless you're on windows, you can use fork for long running problems
<BoomerET> Ok, looks like I can get each individual item w/ the array designation, now on to each part of that.
<skim1776> yeap, there's a developer version but it's not released
geoffw8_ joined #ruby
<apeiros_> skim1776: as I said, that'd be version 2
<apeiros_> so as I said, *current* rbx does *not* support true parallel threads
<apeiros_> (and no, dev releases, head, etc. don't qualify as current)
<apeiros_> seems like my rbx installation is almost done…
jbpros joined #ruby
<skim1776> apeiros_, and it's all for no purpose now
<apeiros_> o0
<tommylommykins> hmm
<tommylommykins> but even if you have a 4core machine
<skim1776> I mean installing rbx
<tommylommykins> 4 instances of ruby is still goping to be a lot slower than java?
<skim1776> tommylommykins, you mean ruby program running in 4 threads is slower than java one in 1 thread?
<apeiros_> depends on the problem, but for many if not most cases, yes, probably.
michael_mbp_ joined #ruby
<skim1776> probably not the best language for arithmetical proglems
kdrsx joined #ruby
<tommylommykins> What does ruby have over java with arithmetical problems? No static typing to get in the way?
<apeiros_> tommylommykins: much faster to develop
fridim_ joined #ruby
<apeiros_> far less boilerplate
booginga joined #ruby
michael_mbp_ joined #ruby
jbpros joined #ruby
sLLiK joined #ruby
EddieBluh joined #ruby
thecreators joined #ruby
<apeiros_> tommylommykins: and if you need the performance, you can still write a C extension
<apeiros_> or a java extension (in the case of jruby)
ChampS_ joined #ruby
zodiak joined #ruby
ethndbst joined #ruby
ilyam_ joined #ruby
kevinbond_ joined #ruby
mkscrg joined #ruby
raggedjack joined #ruby
mrsolo joined #ruby
<mkscrg> I'm looking to do some stats calculations in Ruby. advice?
james_cotterill joined #ruby
james_co_ joined #ruby
michael_mbp_ joined #ruby
moshef_ joined #ruby
<mlr> I'm new to Ruby, but experienced in Python. Can somebody explain the oddity I'm seeing here: http://pastie.org/private/xx0lfsfejxxgabawhxg
bwlang joined #ruby
<rippa> mlr: but symbol isn't nil
<yxhuvud> no, you should not do something clever to compare a symbol to nil. symbols are not nil. and :@foo is just weird. don't do that, please.
paulw_ joined #ruby
<yxhuvud> I'm honestly surprised you didn't get a syntax error.
<yfeldblum> :@foo is often used when asking another object for the value of its instance variable
<yfeldblum> my_object.instance_variable_get(:@foo)
<yfeldblum> my_object.instance_variable_set(:@foo, 3)
eldariof joined #ruby
<mlr> OK, so the value of @DB_CLASS is a string...how do I get its value?
<rippa> @DB_CLASS
<rippa> here you go
<skim1776> could someone please spend 2 minutes and help me to test tmux?
<yxhuvud> if it is a classname, use const_get
samxor joined #ruby
robbyoconnor joined #ruby
workmad3 joined #ruby
<mlr> rippa: so I have a check that says if @DB_CLASS == nil, assign it a value. But it doesn't ever return nil, even when puts @DB_CLASS returns nil?
<mlr> rippa: So confused.
<skim1776> please someone enter "tmux attach -t first_tmux_session"
<rippa> puts returns nil or outputs nil?
<rippa> because it always returns nil
<mlr> rippa: Outputs nil, sorry.
andysparsons joined #ruby
<rippa> in your paste it's :@DB_CLASS
<mlr> rippa: And you can see that in my snippet.
<mlr> Right...the colon didn't make a difference.
<rippa> drop the colon
andysparsons left #ruby
michael_mbp joined #ruby
<mlr> With or without the colon, @DB_CLASS!=nil returns True, and yet puts @DB_CLASS outputs nil.
arpegius joined #ruby
fermion joined #ruby
akem joined #ruby
akem joined #ruby
<yxhuvud> what do you get if you do 'p @DB_CLASS' ?
raythecat joined #ruby
nerded_ joined #ruby
<mlr> OK, just got it. I must have misunderstood something about assigning default values in method signatures. I had initialize (dbClass=:nil)
<mlr> Pesky colon.
vitoravelino__ joined #ruby
<mlr> Wish I knew where I got that syntax from. I thought the colon was needed to make default assignments work.
<mlr> (very new to Ruby)
apok_ joined #ruby
<skim1776> mir, me too
<skim1776> hey, who wanna pair-program with tmux for no more than 5 minutes? just to test it out
smgt joined #ruby
stkowski joined #ruby
Pip joined #ruby
michael_mbp_ joined #ruby
Pip joined #ruby
beakerman joined #ruby
beakerma_ joined #ruby
Pip joined #ruby
Pip joined #ruby
austinbv joined #ruby
<austinbv> are pretty much all array methods O(n)
Manhose joined #ruby
mpereira_ joined #ruby
james_cotterill joined #ruby
btanaka joined #ruby
<apeiros_> austinbv: no, Array access is O(1)
<apeiros_> also setting a slot is O(1), assuming the array is already sized big enough
<austinbv> but delete_if, delete fetch find_index find
<austinbv> drop_while
<austinbv> etc
<apeiros_> of course, anything you have to iterate
techhelp joined #ruby
Banistergalaxy joined #ruby
ikaros joined #ruby
vitoravelino joined #ruby
vitoravelino joined #ruby
svetzal joined #ruby
ben_alman joined #ruby
zenergi joined #ruby
ilyam joined #ruby
cableray joined #ruby
kuadrosx joined #ruby
ilyam joined #ruby
h4mz1d joined #ruby
_debo joined #ruby
moshef_ joined #ruby
moshef_ joined #ruby
GSpotAssassin joined #ruby
ben_alman_ joined #ruby
_debo_ joined #ruby
tatsuya_o joined #ruby
skim1776 left #ruby
moshef_ joined #ruby
xol joined #ruby
Hellojere joined #ruby
<Bela-Lugosi> Hey Guys, is there a Sinatra or Slim chan on Freenode? If not, where?
<shadoi> you…. tried joining it right?
<burgestrand> Bela-Lugosi: #sinatra
ben_alman_ joined #ruby
<Bela-Lugosi> thanks burgestrand
<shadoi> lol
LittleBill902 joined #ruby
musl joined #ruby
jbw joined #ruby
jwill joined #ruby
vtr joined #ruby
imsplitbit joined #ruby
opameier joined #ruby
kirun joined #ruby
jonathanrwallace joined #ruby
cesario joined #ruby
john2x joined #ruby
GreaseMonkey joined #ruby
anachronistic joined #ruby
moshef_ joined #ruby
Adman65 joined #ruby
opameier left #ruby
bwlang joined #ruby
nerded joined #ruby
ryanf joined #ruby
dr_bob joined #ruby
shaatar joined #ruby
stephenjudkins joined #ruby
dnyy joined #ruby
skrewler joined #ruby
nachtwandler_ joined #ruby
Banistertab joined #ruby
anachronistic joined #ruby
dotemacs joined #ruby
zedUNDginger joined #ruby
patricksroberts joined #ruby
cooper joined #ruby
dv_ joined #ruby
looopy joined #ruby
raincole joined #ruby
relix joined #ruby
_debo joined #ruby
Sailias_ joined #ruby
perryh joined #ruby
Manhose joined #ruby
james_cotterill joined #ruby
zawopak joined #ruby
Kiall joined #ruby
atmosx joined #ruby
james_co_ joined #ruby
<atmosx> can you take a look at this otparse code: http://pastebin.com/BYuVETuc
<atmosx> returns 'true' instead of 'x' but I cannot tell y
techhelp joined #ruby
clockwize joined #ruby
tommyvyo_ joined #ruby
jensn joined #ruby
sbanwart joined #ruby
io_syl joined #ruby
io_syl joined #ruby
incluye joined #ruby
manizzle joined #ruby
minijupe joined #ruby
Manhose_ joined #ruby
sbanwart joined #ruby
looopy joined #ruby
h4mz1d joined #ruby
<shadoi> because x is true, it's a boolean option, if you want it to be something else you have to let it know that there's a value being sent.
linoj joined #ruby
ixti joined #ruby
robertothais joined #ruby
Rango joined #ruby
kuadrosx joined #ruby
kartouch joined #ruby
Azure|dc joined #ruby
h4mz1d joined #ruby
workmad3 joined #ruby
BrenoPerucchi joined #ruby
BrenoPerucchi joined #ruby
_kinderman_ joined #ruby
pantsman joined #ruby
pantsman joined #ruby
ethndbst joined #ruby
minijupe joined #ruby
perryh joined #ruby
<BrenoPerucchi> someone could help to loading a external url in javascript... I need to parse html content (online or offline) in this url
monkey13 joined #ruby
ilyam_ joined #ruby
<shadoi> join #javascript
havenn joined #ruby
jbpros joined #ruby
sythe joined #ruby
sythe joined #ruby
rickmasta joined #ruby
looopy joined #ruby
incluye joined #ruby
<muzzle_fuzzle> can someone please help me i cant install ruby 1.9.3 and rubygems :/
Walsen joined #ruby
patrick99e99 joined #ruby
Walsen joined #ruby
<patrick99e99> Does anyone know why Base64.encode64("foo") appends a "\n" to the end of it?
<muzzle_fuzzle> \n for new line?
<patrick99e99> yeah
<patrick99e99> but why
<patrick99e99> "foo" isnt "foo\n"
<patrick99e99> and encoded = Base64.encode64("foo").chomp decodes back to "foo" properly
<patrick99e99> with and without the \n
<patrick99e99> so I am confused why it's there
Mahoek joined #ruby
<muzzle_fuzzle> hmm i am confused too
<patrick99e99> hmmmmmmmm
<patrick99e99> I am tempted to monkey patch this
jgarvey joined #ruby
<csavola> patrick99e99: use strict_encode64 to stop the new lines
<patrick99e99> but foo is not 60 characters?
<patrick99e99> it's 3
<patrick99e99> csavola: and I don't seem to have a strict_encode method... ?
<patrick99e99> >> Base64.methods.grep /^s/
<patrick99e99> => ["silence_warnings", "stubba_object", "singleton_methods", "silence_stderr", "silence_stream", "send", "stat_engine", "singleton_class", "suppress", "set_if_nil", "stubs", "suppress_warnings", "set_deduct_call_time_based_on_metric", "send_later", "synchronize", "stubba_method", "send_at"]
<csavola> patrick99e99: what version of ruby?
<patrick99e99> 1.8.7
kedare joined #ruby
havenn joined #ruby
<patrick99e99> oh I see
<patrick99e99> there is a encode64s method
<patrick99e99> which apparently is strict
davidboy joined #ruby
<csavola> patrick99e99: 1.8.7 apparently doesn't have a strict http://www.ruby-doc.org/stdlib-1.8.7/libdoc/base64/rdoc/index.html
<patrick99e99> encode64s doesn't append newlines...
<csavola> patrick99e99: cool... not sure where that comes from but as long as it works
jbpros joined #ruby
<patrick99e99> csavola: aha.. It comes from rails http://apidock.com/rails/ActiveSupport/Base64/encode64s/class
rpowell joined #ruby
havenn joined #ruby
workmad3 joined #ruby
<kmmndr> hi all :-)
axl_ joined #ruby
radmacd joined #ruby
axl_ joined #ruby
LittleBill902 joined #ruby
incluye joined #ruby
james_cotterill joined #ruby
king313 joined #ruby
king313 joined #ruby
luckyruby joined #ruby
james_c__ joined #ruby
Vendethiel joined #ruby
Axilla joined #ruby
jpolan joined #ruby
dv310p3r joined #ruby
<atmosx> shadoi: you alive?
<atmosx> shadoi: thanks for answering but I still don't get it. I need to see a code snippet probably...
<atmosx> the switch is not what I need, that one used when you define the choices from I understand
preller joined #ruby
techhelp2 joined #ruby
eywu joined #ruby
Axsuul joined #ruby
iocor joined #ruby
jonathanrwallace joined #ruby
ilyam joined #ruby
nerded joined #ruby
Jarred joined #ruby
svetzal joined #ruby
hooper joined #ruby
<shadoi> "—tableid TABLEID"
<shadoi> probably what you want.
<shadoi> that makes it a mandatory argument for tableid
<shadoi> capiche?
<shadoi> atmosx: ^^
<atmosx> hahah
<atmosx> what, you're confusing me. Okay I need it mandatory but what that has to do with the type of argument?
<atmosx> it could be a mandatory boolean
<atmosx> in my case is a path/to/file
<shadoi> no, in your code you don't specify that there is an argument, so when you run it, if you use the —tableid option at all it just switches the boolean
<shadoi> get it?
<shadoi> just add that to your option, it'll work, trust me. :)
KrzaQ joined #ruby
KrzaQ left #ruby
Izhido joined #ruby
raythecat joined #ruby
<Izhido> afternoon
<Izhido> do you guys know of a ruby->C# tool around here?
Revernd joined #ruby
<shadoi> code converter? or run ruby on the CIL?
<shadoi> I assume you've tried IronRuby
<Izhido> code converter, actually
<Izhido> I'm in need of converting this to a suitable method for my application: http://martin.ankerl.com/2009/12/09/how-to-create-random-colors-programmatically/
<shadoi> no, I highly doubt such a tool exists. If it does, the author needs to be publicly flogged.
<Izhido> huhu
<Izhido> why?
<Izhido> <-- knows zip about Ruby
eignerchris joined #ruby
<shadoi> Language conversion tools never take into account language idioms, coding standards, or … rationality.
axilla joined #ruby
boodle joined #ruby
<Izhido> aww man
<Izhido> you're going to make me actually learn Ruby? :)
gearaholic joined #ruby
<shadoi> Hey, look at it this way, if you don't have to rely on your IDE, you might actually learn to program for real! ;)
io_syl joined #ruby
io_syl joined #ruby
gearaholic joined #ruby
vitoravelino joined #ruby
vitoravelino joined #ruby
johnduhart joined #ruby
bwlang joined #ruby
sbanwart joined #ruby
ikaros joined #ruby
stoffus joined #ruby
incluye joined #ruby
MetaCosm joined #ruby
incluye joined #ruby
ilyam joined #ruby
<Izhido> all right, let's take a shoot at it
<Izhido> thanks!
Izhido left #ruby
io_syl joined #ruby
io_syl joined #ruby
sdwrage joined #ruby
_kinderman joined #ruby
apok_ joined #ruby
<austinbv> requires in ruby really confuse me still
<austinbv> especially when it comes to gems
<austinbv> like when you have a gem installed how do you require it?
<burgestrand> austinbv: in the gemspec for each gem, there’s a list of directories relative to that gem that ruby can look for files that you require
<austinbv> then in your files you should have to require what?
<burgestrand> austinbv: most gems have a file in the path lib/gemname.rb, and list the 'lib' direcory as the gems’ load directory in the gemspec, which means you can just require 'gemname'
<Kal9871> also take a look at the $LOAD_PATH variable to see what directories are included when Ruby searches for files when you use require or load
<burgestrand> austinbv: the same way, if the gem has a lib/i_am_an_evil_file.rb, you can require that file the same way, require 'i_am_an_evil_file'
hukl joined #ruby
techhelp joined #ruby
<austinbv> so for some reason even though the gem is installed that is not working
<burgestrand> austinbv: which ruby version is it?
<austinbv> 1.9.2
<austinbv> bundle list shows the gem
<burgestrand> Alright, which gem is it and what are you trying to require it as?
<austinbv> the gemspec shows lib/summer
<austinbv> but require 'summer' gives me a no such file
demian`_ joined #ruby
<austinbv> git://github.com/austinbv/summer.git
<burgestrand> austinbv: can you require it from IRB?
<austinbv> nope
techhelp joined #ruby
<austinbv> and I have a .rvmrc
<austinbv> that scopes the gems to that dir
Kal9871 left #ruby
<austinbv> with a gemset
<austinbv> everything seems like it should work... except that
<burgestrand> If I install the gem myself I can just require 'summer'
<burgestrand> Are you using bundler?
<austinbv> yeah
<burgestrand> I assume you have it in the Gemfile?
<austinbv> Yeah gem 'summer', :git => 'git://github.com/austinbv/summer.git'
<austinbv> and bundle list shows it
<austinbv> and bundle show summer
<austinbv> shows it
<burgestrand> Awesome, and in your code, before you require 'summer' you have either Bundler.setup or require 'bundler/setup'?
<shadoi> require name possibly different?
<burgestrand> Naw, I managed to install and require it here
ezkl joined #ruby
<burgestrand> austinbv: might also want to put activesupport into the gems’ dependencies :)
<shadoi> is that in a bundle console?
<austinbv> no just irb
deryl joined #ruby
<shadoi> then it won't work
<burgestrand> austinbv: require 'bundler/setup' first
<shadoi> use bundle console
<burgestrand> ^ or that
<austinbv> shadoi shouldnt rvm make sure it works
<burgestrand> No, if you use Bundler, you must use bundler in your code
<shadoi> austinbv: sounds like you're relying on bundler, not the rvm gemset
<burgestrand> RVM only isolates the gem from your system, bundler isolates the gems from the rest of ruby
<austinbv> ah
<austinbv> well I need to read up on that
<austinbv> my understanding of them was worse than I thought
<shadoi> I pretty much ignore gemsets when using bundler, especially when creating a gem.
<burgestrand> Like, RVM gemsets is like having the same version of ruby installed multiple times with different rubygems (completely separate gems)
axilla joined #ruby
<burgestrand> I wish I could draw a picture in IRC, two boxes, one of them inside the other, would explain this well :d
<austinbv> burgestrand: you can use the app I am making :) http://narwhal.iamaust.in/presentations
<austinbv> just start a new class and share the link with me
<shadoi> burgestrand: I've used this also: http://zwibbler.com/
workmad3 joined #ruby
<burgestrand> It’s hard to draw with a touchpad
cdepue joined #ruby
<austinbv> yeah I need to lock the divs down
<austinbv> for touch pads
<austinbv> i thought if you used rvm + bundler it saved you from having to do things like bundle exec
<austinbv> and bundle console
<austinbv> because you can keep conflicting gems out of the gemsets
<burgestrand> It *can* save you from having to do bundle exec, but you need to be careful
<deryl> if you have multiples of the same gem inside the same gemset then its no different than if you didn't have gemsets at all
<burgestrand> And it only saves you from having to require bundler *if* you install gems to the default location, the system
<austinbv> ah ok
<yfeldblum> sticking `export $RUBYOPT=-rbundler/setup` at the top of your script saves you from having to do things like `bundle exec`
<burgestrand> Even then it’s not a good idea to not require bundler in your projects’ code, because the moment you install a newer version in the gemset that’s incompatible with your project your stuff will break
<deryl> you'll still run into the same issue of having to bundle exec (or use mpapis-bundler or rubygems-bundler)
<burgestrand> But yeah, if you install your gems in a non-standard location with bundler, you need to require and set-up bundler in your code for it to be able to find the gems :)
<austinbv> so then to start something that is using bundler?
<austinbv> and do you need both
<austinbv> or can you just use one or the other?
<burgestrand> You mean between gemsets and bundler?
<burgestrand> You can use them together if you want to, many people still do; you can use bundler without using gemsets though
stephenjudkins joined #ruby
<shadoi> It's less confusing. :)
<deryl> we install bundler (since 1.9.2) in 'global' for each ruby installed by default. (global.gems) and rake + bundler in default (default.gems). you don't need to include bundler in your gemset. you just need the regular bundler configuration stuff that rails does normally, or by creating the Gemfile in your project dir for non rails apps.
cantonic_ joined #ruby
moondiamond joined #ruby
<austinbv> what if you want a bundler locked lower
jensn_ joined #ruby
<deryl> then you remove the one from the global and install per gemset
raythecat joined #ruby
xol joined #ruby
Reikoku joined #ruby
<deryl> but bundler really needs to be in the global. not sure if it has ben fixed, but bundler refused to work correctly if included in per gemset.
<deryl> which is why we moved it into global
<burgestrand> Huh, strange, never had that problem myself
cableray joined #ruby
<deryl> burgestrand: mpapis might have fixed that within rvm itself, and we just left it in global afterwards since its the smart place to put it. that part i'm not sure on.
<deryl> i'd have to talk to michal
<austinbv> deryl: I have it in every gemset
<austinbv> so burgestrand in bundle console i can require summer
<austinbv> but when I try to run a bot that uses the gem
<austinbv> I still get missing file load error
<burgestrand> austinbv: yeah, it’s probably because bundler is not set-up in the bot that tries to require summer
<deryl> that might have changed, however i know we ran into significant issues with bundler if it wasn't in the global due to it not finding gems in gemsets it was installed in.
<burgestrand> austinbv: require 'bundler/setup'
<deryl> not sure if micahl fixed that as I said. i'd have to wait til he came live to findout
<burgestrand> austinbv: in your bot, before you try to require any gems
zedUNDginger joined #ruby
LBRapid joined #ruby
<austinbv> hm that's not it
<austinbv> No such file to load there too
jbpros joined #ruby
alanp joined #ruby
<burgestrand> Huh, peculiar, bundle/setup does not appear to raise an error if the Gemfile cannot be found; try this: require 'bundler'
<burgestrand> and then… Bundler.setup
<austinbv> no bundler either
<austinbv> I am trying something
sbanwart joined #ruby
<austinbv> when I pulled everything out of rvm it worked
looopy joined #ruby
<burgestrand> Anyway, it should look something like this: http://pastie.org/private/q9spiijazuryd940mqgc2q
<austinbv> yeah that's how I had had it
<austinbv> idk why it wasnt working
preller joined #ruby
preller joined #ruby
akem joined #ruby
akem joined #ruby
randym joined #ruby
havenn left #ruby
havenn joined #ruby
voodoofish430 left #ruby
WerbDerver joined #ruby
headius joined #ruby
emmanuelux joined #ruby
Avi` joined #ruby
bigkm joined #ruby
SplitNova left #ruby
GreaseMonkey joined #ruby
GreaseMonkey joined #ruby
cjs226 joined #ruby
ilyam_ joined #ruby
<austinbv> any idea what would make this happen
<austinbv> says it cannot find lib/models/channel.rb
<austinbv> but it is most def there
<burgestrand> austinbv: You probably don’t have your projects’ root directory in the load path
<burgestrand> austinbv: is your applications’ code located above lib/ directory?
<austinbv> you mean this Dir["lib/models/*.rb"].each { |f| require f }
elyos joined #ruby
Gruber joined #ruby
zedUNDginger joined #ruby
<austinbv> yeah that doesn't work
<burgestrand> austinbv: no, is your applications’ main .rb file located above the lib/ directory?
<austinbv> nope the one I run is in the root
<austinbv> not my app
<austinbv> just modifing github.com/radar/railsbot
<burgestrand> Ah, migration.rb is probably written and run under 1.8
<burgestrand> You can run it like this: ruby -I. migration.rb
<burgestrand> Actually, railsbot.rb assumes the same thing
<burgestrand> austinbv: in ruby 1.8, ruby would try to resolve requires (that does not start with a /) from the directory the script was run from
<austinbv> damn the dps on this thing
<burgestrand> austinbv: in ruby 1.9 this is no longer so
<austinbv> deps*
mr_the_shadow joined #ruby
<austinbv> so that still should have worked then
<austinbv> b/c I was running it from railsbot/
<burgestrand> Naw, migration.rb cannot be run directly without the -I flag
<burgestrand> ruby -I. migration.rb — if run from within the railsbot/ directory
<burgestrand> If run from outside it, ruby -I./railsbot railsbot/migration.rb ought to work
<burgestrand> Running bot.rb should not need anything special though, it does the right thing on line #1
perryh_ joined #ruby
nerded joined #ruby
jensn joined #ruby
pootpoot left #ruby
minijupe joined #ruby
thomaslee joined #ruby
ethndbst joined #ruby
ethndbst joined #ruby
xol joined #ruby
boodle joined #ruby
Na_Klar joined #ruby
pantsman joined #ruby
pantsman joined #ruby
cassarani joined #ruby
Lord-Harlot joined #ruby
looopy joined #ruby
booginga left #ruby
mksm joined #ruby
booginga joined #ruby
strife25 joined #ruby
tomzx joined #ruby
daniel_hinojosa joined #ruby
BrenoPerucchi joined #ruby
kenperkins joined #ruby
iamjarvo joined #ruby
zedUNDginger joined #ruby
Guest2452 joined #ruby
iocor joined #ruby
kaneda joined #ruby
<shadoi> unshift is such an awkward method name...
<Na_Klar> comes from the opposite to shift .. can be confusing
<shadoi> I like insert(0, val)
Tachyon joined #ruby
<Tachyon> hi
<shadoi> ohai
dbgster joined #ruby
<Tachyon> please, where can i find reference to "on" operator
<Tachyon> or keyword
<Tachyon> or whatever it is
<Tachyon> here is the code
<Tachyon> don't know how it works
<shadoi> That's a cinch class method
<Tachyon> yes
<Tachyon> ♥
<shadoi> Look it up in the Cinch docs.
<Tachyon> the on is part of cinch then ?
<shadoi> yes
<Tachyon> O.o
<Tachyon> ok, thx
<dominikh> *sigh*
<shadoi> err… looks like injekt disappeared
<shadoi> sorry was wrong, not a class method.
<Tachyon> wow great