apeiros_ changed the topic of #ruby to: programming language || ruby-lang.org || Paste >3 lines of text in http://pastie.org || Rails is in #rubyonrails
<i8igmac> i wanted to avoid the for i in names loop... but thats how im going to do it
kevinbond has joined #ruby
kevinbond_ has joined #ruby
fmcgeough has joined #ruby
ipoval has joined #ruby
dagnachewa has joined #ruby
ilyam_ has joined #ruby
philcrissman_ has joined #ruby
kjpelton has joined #ruby
trkemist has joined #ruby
<tolland> if i want to operate on some object in situ in a method, is this something i can ask for with a argument option like pass by ref
<tolland> or is this automatic, or does ruby have some other idiom for that.?
<tolland> i am a newb
<artm> when you pass an object it's passed by reference
seanstickle has joined #ruby
<artm> so if inside a method you do things to it, you're changing the original
<artm> hmm... since anything is an object, anything is passed by reference
<artm> just some objects can't be changed, like you can't make a number become something else
friskd has joined #ruby
<artm> disclaimer, i'm a newb myself
kjpelton has quit [#ruby]
luckyruby has joined #ruby
Faris has joined #ruby
MasterIdler has joined #ruby
<tolland> artm: right, but if I call some method trunc(event[@field]) and then in the def trunc(value) so something with it like
daed has joined #ruby
Faris has joined #ruby
<tolland> value << value.slice(0,10) << value.slice(12,30)
<tolland> is that a copy on write, or is value actualy just an alias to event[@field]
<shadoi> tolland: it won't modify value unless you use a method with a "!" on it (by convention)
<tolland> anyway, looks to be loads of ways to do this in the docs, just checking what was the recommended wayz
<shadoi> so… value.slice!(12,30)
Bosma has joined #ruby
<artm> right... tolland, you're << into variable called 'value', that's inserting a new object into it, loosing the object you passed as a paramter
freeayu has joined #ruby
<tolland> ok, so in my scenario that value for event[@field] is typically very small like a syslog packet content message size
<tolland> actual;y scrap that, its always bug i checked before
lkba has joined #ruby
<tolland> anyway, it might be massive, so i definitely dont want to make a copy of i can help it. (its deiniffely a string)
<artm> but you don't.
<shadoi> tolland: it's best to just play around with it in irb until you're comfortable with how it'll work
<shadoi> removes the mystery.
<artm> shadoi: I don't feel comfortable playing with functions in irb
<shadoi> artm: why?
Beticious has joined #ruby
<deryl> irb is where oyu should play with them. its not permanent, and irb was designed for specifically that use
<artm> have to retype def ... ... ... end each time I have to change something
<tolland> well this is going into a jruby monolith so i guess I am interested in what the explicity ruby strategy is for making local copies of args
<shadoi> artm: pry.github.com
<shadoi> artm: load your files, and you can edit them real-time and test them out, with debugging ,etc.
M- has joined #ruby
<shadoi> artm: but mostly, I was suggesting to try it in a small simplified test case.
<tolland> the native interpreter might notice its not written back until its the return value and optimise that away
Clordio has joined #ruby
symb0l has joined #ruby
<deryl> both irb and pry will make you have to redo them. however both also support history
<shadoi> tolland: they're the same interpreter.
<artm> but tolland's confusion is about parameter passing
<Beticious> Play the free game of sports bet, you can win a PS3 or 50$ paypal tickets for free http://www.beticious.com/es/register?ref=Trece30
iocor has joined #ruby
fbernier has joined #ruby
<icy`> i wonder how efficient q<<s[0,10]<<s[12,19] is compared to slice
<deryl> you can also write them in a text editor and paste them in
<shadoi> ban Beticious plz
<deryl> he's gone
<deryl> drive by spamming
<shadoi> someone needs a bayesian filter auto-ban for an irc bot
<artm> he's forever in the logs no?
lewis1711 has joined #ruby
<deryl> :shrug:
<tolland> i thought the "idiot" mode was a freenode invented irc extension
<deryl> heh
<artm> tolland: but what's your goal, make a short version of that event[@field] and store it in event[@field] ?
emmanuel_ has joined #ruby
<tolland> yeah, im using this log processing thing logstash, and every so often some monster log entry gets sent
<tolland> so i want to truncate the field, but leave the start bit and end bit, so it still matched my regexp
<tolland> i guess i want to disembowell it rather than truncate it
<artm> hmm... so you have to remove a chunk between 10 and -10 right?
<tolland> the values are set in config buts, its more likely going to be a max of say 1024 chars
<tolland> first 500 and last 500
<artm> so between say N and -M :-)
<tolland> the other day someone reloaded a mysql table, and the full sql string was inserted into a log somewhere... ;-)
deadly_hcs| has joined #ruby
shevy has joined #ruby
davidcelis has joined #ruby
<lewis1711> why doesn't ruby have abstract classes?
<artm> tolland: a[500..-500] = ""
<nect> Why doesn't this work? URI.parse('\052.example.com')? http://pastebin.com/Fg4Geuzg
<nect> half hour ago it was working fine..
<artm> tolland: that removes everything between 500 and -500
csavola has joined #ruby
<artm> tolland: and that works in place so you can stash it in a function
tomzx has joined #ruby
frishi has joined #ruby
<artm> actually you need three dots there
<lewis1711> oh yeah, .. and... do different things
<tolland> i guess that solves the problem of getting my head around ruby method local variables... ;-)
<artm> and you can also do like a[500...-500] = " ... "
<tolland> ok, will look into that one, im going to leave a token in the tuncated bit
<artm> then you'll have nice elipsis
<lewis1711> deryl: oh right, modules. lol dunno why I didn't think of that since I mixin all the time
<shadoi> nect: use double quotes, it needs to interpolate
trivol_ has joined #ruby
<tolland> artm: cheers.
tolland has quit [#ruby]
<artm> np
<shadoi> lewis1711: you can make an abstract class and just raise an exception if it's not subclassed
<shadoi> lewis1711: there's just no separate syntax or builtin enforcement.
<nect> thx shadoi
<lewis1711> what like, raise "" unless self.inherits from Someclass?
<shadoi> yup
<shadoi> raise SomeException if self.class.name == "MyAbstractClass"
deadly_hcs has joined #ruby
<shadoi> or whatever
wmoxam has joined #ruby
tomzx has joined #ruby
fbernier has joined #ruby
drake10 has joined #ruby
<artm> MyAbstractClass === self
<shadoi> or that :)
<artm> too much javascript lately?
<artm> :-p
<shadoi> well, self won't be an instance of in initialization, so it's a little tricky. But in instance methods that works better.
<artm> wait.
<artm> self isn't an instance where?
<shadoi> in initialize
stringoO has joined #ruby
<shadoi> artm: or I'm smoking crack. :)
<RubyPanther> self is always an instance
<shadoi> I just kept trying to do "self === Foo" instead of the other way around.
<shadoi> yeah
<shadoi> my bad.
<artm> i'm also confused by the order
<shadoi> RubyPanther: either of Class or Object/BasicObject?
<artm> in English it's "is self a Foo?"
M- has joined #ruby
ZachBeta has joined #ruby
philcrissman_ has joined #ruby
<RubyPanther> shadoi: yeah, consider... Foo = Class.new
<shadoi> *nod*
tobym has joined #ruby
<shadoi> ok, frain bried for today.
* artm to bed. see you all later.
<nate_h> how do I specify the port my http server is running on in gemrc?
Banistergalaxy has joined #ruby
quest88 has joined #ruby
<nate_h> there has to be a way
<nate_h> its ridiculous that they expect port 80
ilyam has joined #ruby
acekiller has joined #ruby
lukevisinoni has joined #ruby
cousine has joined #ruby
baroquebobcat has joined #ruby
prometheus has joined #ruby
ilyam has joined #ruby
banisterfiend has joined #ruby
baroquebobcat has joined #ruby
goodieboy has joined #ruby
yuroyoro has joined #ruby
fowl has joined #ruby
<laen_> nate_h: http://server:port/ ?
<nate_h> didn't work, but i set a proxy and that worked
<nate_h> oh or does it need to be http://server:port/path/to
Drewch has joined #ruby
i8igmac has joined #ruby
<nate_h> that could be why if that's the case
banister_ has joined #ruby
CheeToS has joined #ruby
S1kx has joined #ruby
S1kx has joined #ruby
cousine has joined #ruby
liluo has joined #ruby
tomzx has joined #ruby
wefawa has joined #ruby
jangell has joined #ruby
acekiller has joined #ruby
i8igmac has joined #ruby
williamcotton has joined #ruby
helichopter has joined #ruby
nari has joined #ruby
adamkittelson has joined #ruby
looopy has joined #ruby
daniel_hinojosa has joined #ruby
iocor has joined #ruby
helichopter has joined #ruby
trkemist has joined #ruby
jesly has joined #ruby
<jesly> is there a way to solve invalid hex escape error in ruby
<jesly> but still be able to represent a string as "\0x"
shadoi has joined #ruby
danielvdotcom has joined #ruby
mengu has joined #ruby
kpshek has joined #ruby
<helichopter> sorry for such a dumb question, but I'm new to Ruby and having trouble using gems in my code. I'm using 1.9.3, and am installing via "sudo gem install". I've tried installing the twitter gem, and the install appears successful, but my code raises an error at "require 'twitter' " stating that the file does not exist. Can anyone offer insight on how to fix this problem?
macmartine has joined #ruby
<apok> helichopter: bootstrap?
<jesly> helichopter: require 'twitter/*' must be the usage
<helichopter> apok: Sorry, I don't understand the connection, if it helps, I've run into the problem with requiring progressbar as well.
<helichopter> jesly: I'm sorry if I misunderstood, but I replaced "require 'twitter' " with "require 'twitter/*" only to have the same error raised.
gtuckerkellogg has joined #ruby
<jesly> lol... wait i dint meant to use *
shtirlic has joined #ruby
Karmaon has joined #ruby
<shadoi> helichopter: what you did should work: I just did: sudo gem install twitter and require 'twitter' in irb works fine.
<jesly> seems like shadoi is right. checked the git repo
<jesly> the usage is require 'twitter' itself
notjohn has joined #ruby
<icy`> helichopter, what do you get for "ruby -v" and "irb -v"
<icy`> i'm also just trying to get into this whole thing of multiple ruby versions =P (rvm to manage them all) ;P
<jesly> shadoi: any idea how to do this
<helichopter> ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-linux] irb 0.9.6(09/06/30)
* icy` ponders
<jesly> var = "\x12"
<jesly> without invalid hex escape error
<icy`> yea i have the same results
<shadoi> jesly: ?
<shadoi> irb(main):001:0> var = "\x12"
<shadoi> => "\u0012"
<helichopter> The path that I'm being shown doesn't seem like it should be so messy: /home/user/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
<shadoi> helichopter: you've installed the gem with sudo, but you're using gems local to your home directory.
fase74 has joined #ruby
<shadoi> sudo puts it in the system gems
<shadoi> so just typing: gem install twitter
<shadoi> should put it into your .rvm dir
<jesly> shadoi: well goes well in irb as a single statement
<icy`> oh you are using rvm after all? http://beginrescueend.com/rubies/rubygems/
<jesly> but for
<jesly> filtered_array = [1,2,3,4,5]
<jesly> filtered_array.each {|elem| instruction_array<<"\x#{elem})"}
<jesly> doesn't work
<helichopter> shadoi: Using gem install twitter, I get permission denied
<helichopter> icy: yeah I've just started using rvm but it's mostly just magic to me right now
ilyam has joined #ruby
<icy`> same
<icy`> i dont know enough about it yet
<icy`> but there is #rvm channel i think
<shadoi> helichopter: sounds like rvm was installed incorrectly
<jesly> returns error invalid hex escape
<jesly> well helichopter run ur code as sudo ruby filename.rb
<jesly> m8 work :P
<jesly> helichopter which ruby
<jesly> do "which ruby" on ur terminal
philcrissman_ has joined #ruby
<shadoi> jesly: "\x#{elem})" did you mean for that paren to be in there?
sandGorgon has joined #ruby
sandGorgon_ has joined #ruby
<jesly> yea. issue??\
<icy`> helichopter, "gem install twitter" not through sudo, then test irb, and " require 'twitter' " works for me
fase74 has quit [#ruby]
<helichopter> shadoi: Should I re-install rvm without using the sudo command?
<helichopter> jesly: /home/austin/.rvm/rubies/ruby-1.9.3-p125/bin/ruby
<helichopter> and for sudo: /usr/bin/ruby
<icy`> just tested it
<icy`> (after an initial rvm use 1.9.3"
<icy`> ) not "
<jesly> helichopter: isn't a good practice to use ruby as su
* icy` runs gentoo x86_64 , 3.2.1 kernel
<helichopter> jesly: Okay thank you, I wasn't actually aware that using sudo for a command actually installed in different areas
<icy`> yea probably you should go ahead and uninstall those gems first, then install them the rvm way
<fowl> jesly, you can't do "\x#{'42'}" in ruby
<fowl> [1,2,3,4,5].map { |x| x.chr }
<jesly> fowl but i need a representation "\x"
<fowl> "\x" is not a valid character
<jesly> okay
<fowl> jesly, are you trying go from 'AE' to "\xAE"
<jesly> fowl: yea
zeknox has joined #ruby
zeknox has joined #ruby
<fowl> jesly, 'AE'.hex.chr
<zeknox> can anyone tell me why I might be getting the error undefined method `grep' in this little script: http://pastie.org/3675541
philcrissman_ has joined #ruby
<fowl> jesly, i recently had to work with packets so i did class Array; def poop(); map { |x| x.hex.chr } end end then called it like %w[AE 02 FF 9B].poop
<fowl> i called it #poop because i couldnt think of anything better
<shadoi> that's just fowl.
<jesly> poop??
<jesly> lol
<fowl> ;)
<jesly> fowl: guess it goes good.. :)
helichopter has quit [#ruby]
pygmael has joined #ruby
RORgasm has joined #ruby
zeknox has quit [#ruby]
fivetwentysix_ has joined #ruby
swarley has joined #ruby
philips has joined #ruby
hubble has joined #ruby
<hubble> trying to do tests without loading rails here, anyone know how to get Rails::Engine::ActionDispatch defines?
bryricker has joined #ruby
<hubble> defined*
scombinator has joined #ruby
fase74_ has joined #ruby
EvanR has joined #ruby
EvanR has joined #ruby
fase74_ has quit [#ruby]
swarley has joined #ruby
Asebolka_ has joined #ruby
smackdab has joined #ruby
smackdab has quit [#ruby]
albemuth has joined #ruby
hubble has quit [#ruby]
helichopter has joined #ruby
Azure has joined #ruby
zodiak has joined #ruby
<helichopter> Hey shadoi, icy, jesly; I just wanted to thank you guys for helping me with the problem, I finally got it running fine now
Vert has joined #ruby
fase has joined #ruby
MopMopperton14 has joined #ruby
wallerdev has joined #ruby
<swarley> so uh
<swarley> what is thqt
<swarley> that*
Karmaon has joined #ruby
comron has joined #ruby
<comron> Hi everyone, I've got a question about a stack level too deep exception.
<comron> The backtrace I get doesn't display any recursion at the top, or anything else that would be a telltale sign of a stack level problem.
RangerMauve has joined #ruby
<RangerMauve> Anyone here have experience using WEBrick? If so could i maybe get help using cookies?
<swarley> RangerMauve, im not sure, maybe asking in #rubyonrails might help too, i only say that because i believe rails uses WEBrick
daed has joined #ruby
<RangerMauve> Okay, thank you swarley
phantomfakeBNC has joined #ruby
<swarley> no problem
brianpWins has joined #ruby
Guest64428 has joined #ruby
jmfcool has joined #ruby
radic_ has joined #ruby
Ontolog has joined #ruby
yoklov has joined #ruby
banisterfiend has joined #ruby
friskd has joined #ruby
ZachBeta has joined #ruby
wilmoore has joined #ruby
RangerMauve has quit [#ruby]
ringotwo_ has joined #ruby
phantasm66 has joined #ruby
sam113101 has joined #ruby
ed_hz_ has joined #ruby
sarmiena_ has joined #ruby
brianpWins has joined #ruby
h4mz1d has joined #ruby
seoaqua has joined #ruby
comron has quit [#ruby]
S1kx has joined #ruby
fayimora has joined #ruby
cha1tanya has joined #ruby
<fayimora> Hey guys, just a quick question.. Should I use rvm or rbenv. I am quite confused on which one to use! I just want to be able to keep my dependencies so I can easily continue development without worrying about some version of a gem :D
<swarley> I would use rvm
<swarley> i dont use it
<swarley> but it is recommended
<swarley> lo
<fayimora> swarley: any reason why you suggest rvm instead?
<fayimora> lool
<swarley> because its easier to upgrade lol
<swarley> and more widely used
<swarley> afaik
<swarley> so why am i making the openssl in ext/ again?
<swarley> oh
<swarley> rails
<swarley> right
<fayimora> lol
<fayimora> ok
<fowl> fayimora, go with rbenv
gianlucadv has joined #ruby
<fowl> you dont need to upgrade it
<banisterfiend> fowl: why not
lukevisinoni has joined #ruby
crescendo has joined #ruby
pu22l3r has joined #ruby
pygmael has joined #ruby
<swarley> wish me luck
<swarley> im building rakudo
<swarley> x_x
pu22l3r has joined #ruby
<banisterfiend> anyone here familiar with objc/cocoa?
gen0cide_ has joined #ruby
<swarley> nope
<swarley> i was looking to getting into it
<swarley> but since apple will be adding a ruby interface for the iOS idc anymore
<shevy> fayimora I recommend to be a man and use neither of em, instead compile your ruby on your own
<fayimora> hmmmmmm
<banisterfiend> swarley: since when are they doing that?
<banisterfiend> swarley: got a link?
<swarley> no i dont
<swarley> let me find it
<banisterfiend> cool
<swarley> banisterfiend, i cant find it
<swarley> but
<swarley> that dev team is working on it
<banisterfiend> swarley: macruby seems kind of dead, im sorry i dont think you're right, unfortunately.
<banisterfiend> it's a shame
<swarley> really?
<swarley> i read an article on it
<swarley> some where
<swarley> let me find tha
<swarley> lol
<banisterfiend> swarley: Yeah, the lead dev of macruby left apple and hasn't committed in months
<banisterfiend> it seems to be progressing at a snails pace
<fowl> yeah he uses linux now
friskd has joined #ruby
baroquebobcat has joined #ruby
<swarley> apparently there is no reason you cant do it with jail break apps
robkinyon has joined #ruby
<swarley> so i dont know how i convinced myself what i did
<swarley> but i managed to some how
thecreators has joined #ruby
krz has joined #ruby
<shevy> cool
<shevy> from mac to linux
<shevy> that is a tradition that should be more common
<swarley> indeed
archdori_ has joined #ruby
havenn has joined #ruby
wyhaines has joined #ruby
baroquebobcat has joined #ruby
<archdori_> hi there. I'm not a ruby user, but have to use gem to install some packages (here codersdojo). The install process asked to sudo gem install it, and here is what I see now: http://paste.pocoo.org/show/571859/. codersdojo is installed and can be run from root. But I'd like it to be runnable by my user, and be listed in my $PATH. Did I miss something ?
gokul has joined #ruby
<shevy> gems are all kept in a dir. on my system it is at /usr/lib/ruby/gems/1.8/cache/
<shevy> you need to find out where your gems are kept
<archdori_> /root/.gem/ruby/1.9.1/bin/
<archdori_> maybe I didn't install gem correctly then, need to change that path
<shevy> impossible
<shevy> that cache dir has .gem files listed
<shevy> under bin/ just resides some executable
<archdori_> oh right
<archdori_> I have it
rippa has joined #ruby
<shevy> actually I think people always switch to sudo and install gems globally for everyone
<shevy> if it is just a binary, you could use this by making it executable for others too
frontendloader has joined #ruby
fivetwentysix_ has joined #ruby
skrewler has joined #ruby
archdori has joined #ruby
Seisatsu has joined #ruby
Seisatsu has joined #ruby
baroquebobcat has joined #ruby
ghvandoorn has joined #ruby
baroquebobcat has joined #ruby
yoklov has joined #ruby
wyhaines_ has joined #ruby
ctwiz has joined #ruby
frontendloader has joined #ruby
eddie has joined #ruby
wyhaines has joined #ruby
<Quadlex> A stylistic question
<Quadlex> If a method needs several pieces of data
<Quadlex> And all of those are just various hashes
<Quadlex> Is it better to have parameters for each, or just take an options hash?
skrewler_ has joined #ruby
<Quadlex> I think the options hash is messy and unhelpful, but I'm not sure what benefits is has
nemesit has joined #ruby
c0rn has joined #ruby
ipoval has joined #ruby
ipoval has quit [#ruby]
greenarrow has joined #ruby
[Neurotic] has joined #ruby
havenn has joined #ruby
joukokar has joined #ruby
Morkel has joined #ruby
Maxou56800 has joined #ruby
bigkm has joined #ruby
frontendloader has joined #ruby
ringotwo has joined #ruby
Dezzimal_ has joined #ruby
yxhuvud has joined #ruby
Emmanuel_Chanel has joined #ruby
i8igmac has joined #ruby
blueadept has joined #ruby
blueadept has joined #ruby
havenn has joined #ruby
sonkei has joined #ruby
deadly_hcs has joined #ruby
dwon has joined #ruby
tonini has joined #ruby
francisfish has joined #ruby
acts_as_david has joined #ruby
shruggar has joined #ruby
looopy has joined #ruby
deadly_hcs has joined #ruby
Vert has joined #ruby
acekiller has joined #ruby
acts_as_david has joined #ruby
x0F__ has joined #ruby
thetrav has joined #ruby
davejaco1s has joined #ruby
<thetrav> so I have an array of items, I want to map that to another array where each map operation will produce one or two elements for the new one
<thetrav> do I need to do a map then a flatten? or does ruby have a flatmap equivalent?
burgestrand has joined #ruby
<swarley> what
<rippa> thetrav: flat_map
djdb has joined #ruby
scalebyte has joined #ruby
<thetrav> ta
dotemacs has joined #ruby
<scalebyte> count = (current_user.following_user_ids & community.members_user_ids.members.map(&:to_i)).size gives me Error (undefined method `size' for nil:NilClass
Prezioso has joined #ruby
<shevy> why do you have a nil
JohnBat26 has joined #ruby
ipoval has joined #ruby
<scalebyte> shevy: community.members_user_ids.members.map(&:to_i).size returns 8 current_user.following_user_ids returns a redis object <Redis::Set:0xd9a7fb0> but count = (current_user.following_user_ids & community.members_user_ids.members.map(&:to_i)).size returns NoMethodError: undefined method `size' for nil:NilClass
ipoval has quit [#ruby]
RORgasm has joined #ruby
tatsuya_o has joined #ruby
ipoval_ has joined #ruby
<scalebyte> shevy: any idea ?
<shevy> scalebyte your code sucks
ipoval_ has quit [#ruby]
<shevy> something in it suddenly becomes nil
<shevy> and nil.size wont ever work
<scalebyte> count = (current_user.following_user_ids & community.members_user_ids.members.map(&:to_i)) returns nil so I am trying to call .size on nil
sam113101 has joined #ruby
schovi has joined #ruby
emmanuelux has joined #ruby
cobranet has joined #ruby
ph^ has joined #ruby
CheeToS has joined #ruby
waxjar has joined #ruby
sspiff has joined #ruby
sspiff has joined #ruby
tvw has joined #ruby
tewecske has joined #ruby
c0rn has joined #ruby
dhruvasagar_ has joined #ruby
mafolz has joined #ruby
nemesit has joined #ruby
zommi has joined #ruby
artm has joined #ruby
lynrix has joined #ruby
<lynrix> hi guys is it possible to use msfxploit with ruby?
looopy has joined #ruby
AxonetBE has joined #ruby
<banisterfiend> lynrix: if you believe in yourself you can do anything
<lynrix> alright
pi3r has joined #ruby
ipoval_ has joined #ruby
apeiros_ has joined #ruby
_null has joined #ruby
trivol has joined #ruby
LMolr has joined #ruby
Guest92496 has joined #ruby
ipoval_ has joined #ruby
zetm has joined #ruby
a_a_g has joined #ruby
wefawa has quit [#ruby]
Azure|dc has joined #ruby
akemrir has joined #ruby
dhruvasagar has joined #ruby
BiHi has joined #ruby
gokul has joined #ruby
havenn has joined #ruby
francisfish has joined #ruby
shruggar has joined #ruby
xnm has joined #ruby
ukwiz has joined #ruby
ringotwo has joined #ruby
blacktulip has joined #ruby
flou has joined #ruby
gianlucadv has joined #ruby
tewecske has joined #ruby
tvw has joined #ruby
Squarism has joined #ruby
<Squarism> id like to override a method of a third party lib during "runtime" (for a test)... how is that done?
MissionCritical has joined #ruby
mklappstuhl has joined #ruby
<banisterfiend> Squarism: just redefine the method
<banisterfiend> Squarism: do you want to override on just the particular instance or on the whole class?
jlebrech has joined #ruby
eldariof has joined #ruby
gtuckerkellogg has joined #ruby
ephemerian has joined #ruby
ephemerian1 has joined #ruby
arturaz has joined #ruby
ipoval has joined #ruby
ipoval has quit [#ruby]
arturaz has joined #ruby
<Squarism> banisterfiend, how can i do that within a testcase before method?
<Squarism> ...if my class TheClass is defined TheModule ?
<Squarism> ...and the method is the_method
<banisterfiend> Squarism: do you want to override a method on TheModule or TheClass ?
<Squarism> TheClass
<banisterfiend> Squarism: TheClass.class_eval { def the_method; "sup /b/"; end }
cobranet has joined #ruby
fowl has joined #ruby
<Squarism> banisterfiend, thanx man
twinturbo has joined #ruby
heftig has joined #ruby
roolo has joined #ruby
_null has joined #ruby
jonteru has joined #ruby
falena has joined #ruby
bier has joined #ruby
cobranet` has joined #ruby
qwerxy has joined #ruby
bpgoldsb has joined #ruby
tommyvyo has joined #ruby
tatsuya_o has joined #ruby
gtuckerkellogg has joined #ruby
stefanp has joined #ruby
stefanp has joined #ruby
mengu has joined #ruby
schovi has joined #ruby
adambeynon has joined #ruby
adambeynon has joined #ruby
banisterfiend has joined #ruby
<Squarism> can i call a private method in a test?
<Tasser> Squarism, #send
<gogiel> is there something like %w() for symbols?
<rippa> gogiel: %s
a_a_g has joined #ruby
<gogiel> rippa: it makes only one symbol, i need to create an array
<gogiel> like %something(symbol1 symbol2)
<rippa> then, no
fixl has joined #ruby
<JohnBat26> hello
<JohnBat26> How can I format date to 2012-03-22T18:00:00.000+03:00 ?
blacktul_ has joined #ruby
<heftig> %w(foo bar baz qux).map(&:to_sym)
<heftig> but honestly [:foo, :bar, :baz, :qux] is simpler
<JohnBat26> fowl: time.strftime("%Y-%m-%dT%H:%M:%S.000+"+time.utc_offset.to_s )
shruggar has joined #ruby
<JohnBat26> fowl: 2012-03-27T13:09:09.000+14400 but I need +03:00 for timzone
DarthGandalf has joined #ruby
<heftig> Time.now.strftime("%Y-%m-%dT%H:%M:%S%z")
cek has joined #ruby
<heftig> er
<cek> hi. what data format does this look like: a:10:{s:13:"branding_name";s:12:"Installatron";s:16:"branding_support";s:25:"https://xxx";s:13:"branding_host";s:5:"eeeee";etc...}
<heftig> JohnBat26: Time.now.strftime("%Y-%m-%dT%H:%M:%S.%3N%:z")
<heftig> that should be what you want
etehtsea has joined #ruby
<JohnBat26> heftig: Thanks !
codespectator has joined #ruby
<JohnBat26> heftig: Where can I find doc about it ?
<banisterfiend> heftig: sup hefty boy
<gogiel> heftig: yes, but i use a lot of arrays of symbols and i'm wearing out my ':' key ;)
<heftig> JohnBat26: ri strftime
<cek> anyone?
<JohnBat26> heftig: Ok
<fowl> hey everyone, heftig 's giving out free code
<heftig> cek: i've seen that before, but i can't place it
<banisterfiend> gogiel: "hello my little duck".split.map(&:to_sym)
<fowl> quick compel him to finish your homework
<banisterfiend> JohnBat26: is your last name really "Bat" ?
<banisterfiend> that's kind of unfortunate
<JohnBat26> banisterfiend: No
<drizz_> unfortunate?
<JohnBat26> batogov
<drizz_> that's freaking awesome
<drizz_> that's not freaking awesome :<
drizz_ has quit [#ruby]
drizz_ has joined #ruby
<cek> better than Bait
<JohnBat26> because historically
<JohnBat26> )
drizz has joined #ruby
lobolars has joined #ruby
kc8qvp has joined #ruby
<kc8qvp> Is RDoc as bad as people on the internet seem to suggest? I'm considering using it for something, but apparently it has some seriously annoyances?
<drizz> it sucks.
<drizz> use yard
<banisterfiend> kc8qvp: use YARD
daganu has joined #ruby
<kc8qvp> Oh, I'm sorry. I didn't mean the RDoc, the tool. I meant RDoc, the light-weight markup format.
<banisterfiend> kc8qvp: use markdown then
<kc8qvp> The tools that will process it are actually puppetdoc, and probably yard, and maybe some other stuff.
mcwise has joined #ruby
<kc8qvp> puppetdoc wants it to be RDoc, at least for the in-code documentation.
<banisterfiend> ok
<kc8qvp> What's the current best-practice for documentation embedded in Ruby code?
<kc8qvp> does it have to be RDoc, or is it considered OK to embed markdown in Ruby code?
<banisterfiend> kc8qvp: it's YARD
<kc8qvp> If markdown in ruby comments is commonly done, then I'll find some way to make that work for puppet too.
<banisterfiend> kc8qvp: we told u that already
<kc8qvp> ok, ok, sorry; you don't have to be a dick about it.
<kc8qvp> yard's a tool, not a format.
<kc8qvp> so I didn't understand what you meant.
<banisterfiend> kc8qvp: yard is a format as well
<banisterfiend> kc8qvp: and i wasn't being a dick, i was being honest :)
<kc8qvp> You're right, it is a format; I appologise.
Nathandim has joined #ruby
josephwilk has joined #ruby
LowKey has joined #ruby
pygmael has joined #ruby
tommyvyo has joined #ruby
emmanuel_ has joined #ruby
M- has joined #ruby
heftig_ has joined #ruby
bluenemo has joined #ruby
nflamel has joined #ruby
ecolitan has joined #ruby
dkamioka has joined #ruby
Nathandim has joined #ruby
dkamioka has joined #ruby
visof has joined #ruby
visof has joined #ruby
heftig has joined #ruby
mikewintermute has joined #ruby
Faris has joined #ruby
Russell^^ has joined #ruby
mikewintermute has joined #ruby
trivol has joined #ruby
mikewintermute has joined #ruby
davidpk has joined #ruby
berserkr has joined #ruby
tatsuya_o has joined #ruby
stuffmc has joined #ruby
DarthGandalf has joined #ruby
cobranet` has joined #ruby
<stuffmc> Seems kinda dead on #rails -- anybody up for a simple rails debugging/pry question? :)
<banisterfiend> stuffmc: sure, what's your pry question
<stuffmc> NameError: undefined local variable or method `category' for #<Class:0x007ff94a888290>
<stuffmc> how do I know "where"?
<stuffmc> like, how do I get the call stack?
<banisterfiend> stuffmc: what version of pry are you using?
<stuffmc> 0.9.7.4
<banisterfiend> stuffmc: you need to upgrade
<banisterfiend> that version is ancient ;)
<banisterfiend> stuffmc: we're on 0.9.8.4 now i think
jifxx has joined #ruby
<banisterfiend> stuffmc: but if u dont want to upgrade (where u can use the wtf? command) you can just type: cat --ex
<banisterfiend> a number of times
<banisterfiend> or _ex_.backtrace
<banisterfiend> stuffmc: cat --ex shows you the code context for the backtrace element, kind of cool
<stuffmc> will try that
rohit has joined #ruby
pygmael has joined #ruby
<banisterfiend> stuffmc: let me knwo how u get on
<banisterfiend> stuffmc: if u upgrade to 0.9.8 the 'help' command is actually more helpful
daglees has joined #ruby
daglees has joined #ruby
samnang has joined #ruby
RORgasm has joined #ruby
shtirlic_ has joined #ruby
senthil has joined #ruby
fayimora_ has joined #ruby
shtirlic_ has joined #ruby
Orva has joined #ruby
fayimora has joined #ruby
gyre007 has joined #ruby
<Orva> can anyone say what goes wrong: I use NET::Http to send post request (with ssl and basic-auth), sending is fine but response parsing fails because HttpResponse#read_status_line starts reading from body of the response and not from actual first line
frontendloader has joined #ruby
<Orva> same happens with both ruby 1.8.7 and 1.9.3
<banisterfiend> stuffmc: how did u get on?
jonteru has quit [#ruby]
<stuffmc> yeah it helped.
kesor_ has joined #ruby
<stuffmc> and I updated to 0.9.8.4
<stuffmc> thanks!
<Orva> I tried also sending same data to server by hand and response isn't malformed
pyreal has joined #ruby
pyreal has joined #ruby
Maxou56800 has joined #ruby
pyreal has joined #ruby
burgestrand has joined #ruby
dhruvasagar has joined #ruby
stuffmc_ has joined #ruby
fayimora_ has joined #ruby
gianlucadv has joined #ruby
dbgster has joined #ruby
Jer1ko has joined #ruby
baroquebobcat has joined #ruby
frishi has joined #ruby
n1x has joined #ruby
dhruvasagar has joined #ruby
dekroning has joined #ruby
schovi has joined #ruby
<dekroning> i'm a bit confused about naming: class Foo < Bar; end == Bar extends Foo ? or should I say Bar is-a/inhertis-from Foo
<dekroning> i'm confused because of the mixin's include/extend naming
bwlang has joined #ruby
cha1tanya has joined #ruby
<heftig> dekroning: Foo inherits from Bar
<Tasser> or 'is derived from'
<dekroning> because bar would only extend foo if it was written as: class Foo; extend Bar; end ? or that's not correct eitehr?
<dekroning> foo extends bar i mean
<Tasser> dekroning, extend is something entierly different from the java extends
<dekroning> Tasser: right, that's think my confusion
<dekroning> Tasser: is "is direved from" called extends in java?
<heftig> yes
sspiff has joined #ruby
<dekroning> ruby extend keyword is for mixin's then right ?
LMolr has joined #ruby
Squarepy has joined #ruby
<Tasser> nope, that's include
<dekroning> Tasser: ah so mixin is only instance level?
<Tasser> yep, extend does a mixin at class level
<dekroning> ok, so both are called "mixin's" ?
<Tasser> I never used the term 'mixin'
nanderoo has joined #ruby
<Orva> basicly extend adds module contents to given instance, and class is also valid instance which can be "extended"
Squarepy has joined #ruby
<Tasser> class << self; include X; end is equivalent to extend X - more or less
<Orva> so if you extend instance of class, module methods are extended only to that instance but if you extend class all new instances also get that module
<dekroning> Tasser: so how do you describe mixin? just include's extends ?
fayimora has joined #ruby
batmanian has joined #ruby
<Tasser> dekroning, I don't use the term mixin, so you gotta define that yourself or ask someone else
<dekroning> Tasser: ok
ZachBeta has joined #ruby
<Tasser> dekroning, it's a bunch of methods you add to a class
<Tasser> dekroning, the difference between ruby an JS is that in JS the methods are on the object, where in Ruby they are on the class of the object
<Tasser> dekroning, but every object may have its own eigenclass, so you can do def obj.foo; end to define a method on that object only
<dekroning> Tasser: class meaning instance of Object right ?
<Tasser> dekroning, class as in obj.class
<dekroning> Tasser: right, got it
acekiller has joined #ruby
<Orva> http://mwrc2008.confreaks.com/11farley.html is quite instructional if you want to understand inheritance and mixins in ruby
qwerxy has quit [#ruby]
MrGando has joined #ruby
sbanwart has joined #ruby
Pacra has joined #ruby
fayimora has joined #ruby
Bauer has joined #ruby
<Bauer> Guys, we have a problem, we got a Ruby script which has a lot of requires, and is working from CLI, but says: "[ERROR] Install missing ruby gem. Please see README file...." when I run it from PHP: $path = "cd /pentest/web/wpscan/ && ruby wpscan.rb --url $url --proxy 127.0.0.1:8118 2>&1";
<Bauer> $output = shell_exec($path);
<dekroning> Orva: thanks
<Bauer> I tried adding in PHP: chdir('/pentest/web/wpscan/'); but it did not help\
<keymone> check if there are differences in echo $PATH in your cli and shell_exec('echo $PATH') in your php
<keymone> Bauer:
tommyvyo has joined #ruby
BiHi has joined #ruby
heftig has joined #ruby
<Bauer> keymone: do you mean to compare the same path from php? like $_ENV["PATH"]
<Bauer> ?
<keymone> yes
<Bauer> keymone: I get Notice: Undefined index: PATH
Progster has joined #ruby
<keymone> ok then try to puts ENV['PATH'] in your ruby script executed from both cli and php and see if there is the difference there
kesor_ has joined #ruby
tatsuya_o has joined #ruby
M- has joined #ruby
eldariof has joined #ruby
<Bauer> keymone: this is when executed from php: /usr/local/bin:/usr/bin:/bin while from CLI it is much more complex: /usr/local/rvm/gems/ruby-1.9.2-p318/bin:/usr/local/rvm/gems/ruby-1.9.2-p318@global/bin:/usr/local/rvm/rubies/ruby-1.9.2-p318/bin:/usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/etc/alternatives/gem-bin
<Orva> oh, got my problem solved:
<Orva> it turns out that server I was talking to responds with malformed http-response IF authentication fails
<keymone> Bauer: you're using rvm then, php doesn't invoke it to fill in paths for ruby and gems
<Orva> which causes response parsing to fail
rohit has joined #ruby
<Bauer> keymone: yes, and?
<Bauer> keymone: how to fill in the paths misisng?
<Orva> oh wait, actually response isn't malformed
<keymone> Bauer: instead of what you're shell_exec'ing do something like this: cd … && rvm use 1.9.2 && ruby blah
<keymone> Bauer: not portable version, should work locally but if you deploy that somewhere then it might not work
wyhaines has joined #ruby
philcrissman_ has joined #ruby
<Tasser> system('which rvm')
<Tasser> /home/tass/.rvm/bin/rvm
<Tasser> doesn't php use the same?
<keymone> i don't think php cares about rvm
fayimora has joined #ruby
<Tasser> the question is wherever it cares about $SHELL
<Tasser> ehh, wherever it cares about what your shell is according to /etc/passwd
<shevy> rvm only cares about itself :(
<Bauer> keymone: I tried your way, but I get blank output, not sure what to make of it
<keymone> Bauer: your ENV['PATH'] is empty when you run it from php?
<keymone> i mean when you exec ruby from php?
greywolf` has joined #ruby
stefanp has joined #ruby
stefanp has joined #ruby
berserkr has joined #ruby
simpleharmonicmo has joined #ruby
twinturbo_ has joined #ruby
fearoffish has joined #ruby
nari has joined #ruby
<Bauer> keymone: as I said, the PATH variable when executed from PHP is /usr/local/bin:/usr/bin:/bin
<Bauer> which is much shorter than the CLI path
antonishen has joined #ruby
<Bauer> keymone: I found out, when I execute it like: "ruby-1.9.2-p318 /pentest/web/wpscan/wpscan.rb --url $url --proxy 127.0.0.1:8118" I get output not actually empty, but NULL
RORgasm has joined #ruby
nonotza_ has joined #ruby
simao has joined #ruby
sacarlson has joined #ruby
td123 has joined #ruby
acekiller has joined #ruby
<Tasser> shevy, welcome to mac ecosystem
mikewintermute has joined #ruby
<keymone> Bauer: here, run this
<keymone> php -r 'echo shell_exec("ruby -e '\''puts ENV[\"PATH\"]'\''");'
* keymone hates escaping quotes in shell
trkemist has joined #ruby
trkemist has joined #ruby
<Tasser> keymone, if you do two or three layers of escaping :D
<keymone> 4 layers there
<keymone> just like that
Guest92496 has joined #ruby
Guest92496 has joined #ruby
<denysonique> Ruby is beautiful
<keymone> i love ruby's backticks
<denysonique> backticks are not recommended btw
<denysonique> it's nicer to use system
pawdro has joined #ruby
<Bauer> keymone: /usr/local/rvm/gems/ruby-1.9.2-p318/bin:/usr/local/rvm/gems/ruby-1.9.2-p318@global/bin:/usr/local/rvm/rubies/ruby-1.9.2-p318/bin:/usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/etc/alternatives/gem-bin
<keymone> denysonique: yeah i know but for simple stuff like ps | grep | cut it's great
<Bauer> keymone: that is from CLI of course
<denysonique> What is MacRuby like?
<keymone> Bauer: then you need to send same PATH along with your shell_exec
<keymone> Bauer: do something like shell_exec("PATH=blah ruby …")
pu22l3r has joined #ruby
Asher has joined #ruby
<pawdro> hi, is there any way to change iterator variable inside "for loop " ?
ryannielson has joined #ruby
fayimora has joined #ruby
<shevy> pawdro not sure. it's a crazy idea, sane people won't need it. you could perhaps redeclare the iter variable and assign a new Enumerator inside the for block
<shevy> but it is crazy so i am glad to not think about it anymore
<pawdro> shevy: ok, i will recreate my algorith, thank you ;]
seanstickle has joined #ruby
seanstickle has joined #ruby
<keymone> another ugly chunk of code successfully averted by shevy
al_ol has joined #ruby
davidpk has joined #ruby
<Bauer> keymone: works! thanks.. when I added the PATH= before the rest, it works :) will have to copy/paste that nasty path into php.ini
Jackneill has joined #ruby
<Tasser> pawdro, and there's #each, for is ancient
<pawdro> Tasser: i'm just in the beginning, i will keep it in mind
<keymone> Bauer: be careful with that, your PATH in shell is managed by rvm so if you deploy hardcoded PATH from your local environment things will not work
<pawdro> Tasser: it's quite hard to switch to ruby way in a second ;]
<keymone> Bauer: if it's just local script you want to run then go ahead, otherwise - check what works on your server and configure it properly
araujo has joined #ruby
<keymone> Tasser: for is actually quite faster than #each
<Tasser> keymone, it doesn't construct a new scope, so yep - but you shouldn't code for speed too much
tomzx has joined #ruby
<keymone> Tasser: it's just a fact worth knowing :)
bwlang has joined #ruby
<matled> keymone: (0..10_000_000).each { |i| i + 1 } takes ~0.92s and the equivalent for takes 0.98s for me
twinturbo has joined #ruby
d3vic3 has joined #ruby
<jlebrech> if i do .to_s on an array, will it add --- to it? dumb question maybe.
pu22l3r has joined #ruby
theRoUS has joined #ruby
<seanstickle> jlebrech: huh?
<jlebrech> ahh i could test that myself :P
<matled> jlebrech: Array#to_s depends a bit on the ruby version, but it doesn't add "---" to it in any I have
<jlebrech> I'm getting reports of email addresses coming up with --- before the address. in my app
<matled> that's probably #to_yaml
<keymone> jlebrech: --- is probably coming from yaml, #to_yaml for that
<matled> it adds "--- \n"
<jlebrech> matled yeah that.
badelat has joined #ruby
<jlebrech> matled any idea why that is?
badelat has joined #ruby
<shevy> keymone I think he will go his route anyway :(
<shevy> ugly code always attracts certain people. you know, like flies ... :>
<keymone> shevy: at least you planted the idea into his head
<keymone> shevy: like di caprio (flex)
dql has joined #ruby
<jlebrech> i have plenty of ugly code :P
geekbri has joined #ruby
drake10 has joined #ruby
kc8qvp has quit [#ruby]
fr0gprince_mac has joined #ruby
tobym has joined #ruby
crankycoder has joined #ruby
fbernier has joined #ruby
dv310p3r has joined #ruby
king313 has joined #ruby
jtrudeau has joined #ruby
thelarry has joined #ruby
LBRapid has joined #ruby
<arturaz> <Grauwolf> The best thing about UDP jokes is that I don't care if you get them or not.
<thelarry> Hi! what do i need to install to use the ruby bindings for qt? qtruby or qt4-qtruby or both? What is the difference between the 2 gems and what are they meant to be used for?
qos has joined #ruby
JonSchuff has joined #ruby
fmcgeough has joined #ruby
MrGando has joined #ruby
fmcgeough has joined #ruby
<visof> if i have a hash {:one => 1, :two => 2, :three => 3} and i want to start from the second element and iterate to the end
<visof> ?
<Asher> #slice
<Asher> hash.slice( 1, -1 ).each
<Asher> or hash[ 1, −1 ].each
bbttxu has joined #ruby
bwlang has joined #ruby
Sailias has joined #ruby
liluo has joined #ruby
bbttxu has joined #ruby
<apeiros_> Asher: you think of arrays, not hashes
<nacengineer> visof since this is a Hash you can't use slice unless you use .to_a and then slice it. Then you'll have to go convert back to a Hash. http://stackoverflow.com/questions/39567/what-is-the-best-way-to-convert-an-array-to-a-hash-in-ruby
<apeiros_> visof: hashes are not by index. unless you have 1.9+, they don't even have order. convert your hash to an array and slice it.
<apeiros_> e.g. hash.to_a[offset..-1]
<apeiros_> in 1.9, you can convert that back to a hash using Hash[result]
bbttxu has joined #ruby
<Asher> 1.9 is the current ruby :P
<Asher> 1.8 is obsolete
<apeiros_> Asher: still bad to just assume 1.9
<Asher> assuming 1.8 is valid just encourages people not to update
<Asher> my software and/or advice will never support 1.8 b/c 1.9 is current
<Asher> … but if i'm still wrong about hash then i apologizef or that ;)
<apeiros_> if you resolve the confusion that occurs when you give mismatching advice…
EvanR has joined #ruby
<apeiros_> but if I have, I'll kick your ass :-p
albemuth has joined #ruby
<Asher> and i guess i'm wrong
foo-bar- has joined #ruby
<Asher> so sorry for that
phantasm66 has joined #ruby
bwlang_ has joined #ruby
yoklov has joined #ruby
tatsuya_o has joined #ruby
linoj has joined #ruby
tatsuya_o has joined #ruby
c0rn has joined #ruby
MrGando has joined #ruby
mmokrysz has joined #ruby
robkinyon has joined #ruby
uris has joined #ruby
csavola has joined #ruby
niqdanger has joined #ruby
<dekroning> is it possible to call a method in the base class with super? e.g. super.method_in_base_class
carlyle has joined #ruby
ephemerian has joined #ruby
<JohnBat26> hello all
<fbernier> dekroning: it's the kind of question you could test yourself using irb in 2 minutes
pi3r has joined #ruby
<dekroning> fbernier: i'm unable to, but I think it's because i'm not using the right syntax
<JohnBat26> I have 5 resque jobs, and want to do shared mutex
<JohnBat26> How it do in Ruby ?
cousine has joined #ruby
baroquebobcat has joined #ruby
<fbernier> dekroning: your class inherit every public methods from the superclass, so you shouldn't need super.
<fbernier> and if you redefine the method in your class, but want to call the superclass version, you can use this workaround
<dekroning> fbernier: what I would like to do is call ... hehehe that's exactly what I wanted
<fbernier> ;)
evangelion has joined #ruby
<evangelion> hello
<evangelion> what's wrong in this piece of code http://pastebin.com/BAHG0DWb ?
<evangelion> when ipCpe points to a cpe that make Net::Telnet to raise a Timeout::Error
<evangelion> the script stops
<evangelion> i would expect it to jump to the next iteration of bas.cmd( "show users" )
internet_user has joined #ruby
ananthakumaran has joined #ruby
[[thufir]] has joined #ruby
<[[thufir]]> for uninitialized Logger: https://gist.github.com/2216162 what's the missing import statement? require ____?
<ukwiz> is there a ruby function which will return yesterdays date?
deryl has joined #ruby
<Tasser> [[thufir]], require 'logger'
<Tasser> ukwiz, Date.today -1
<Tasser> ukwiz, you'll need a require 'date'
<[[thufir]]> Tasser: undefined method `logger=' when I add that, though.
<Tasser> O.o
<Tasser> looks like Net::NTTP doesn't support logger then
fbernier has joined #ruby
dhruvasagar has joined #ruby
<[[thufir]]> it has a class variable @@logger which needs to be initialized, according to the error. oddness
<[[thufir]]> I suppose I'll have to look at the source, I was jut going by the docs. ok, thnaks.
<Tasser> if it's a class variable, try Net::NTTP.logger =
<[[thufir]]> ah, thanks.
niqdanger has quit ["Leaving"]
kevinbond has joined #ruby
<[[thufir]]> https://gist.github.com/2216162 not sure how to set it. I'll look at the docs again, but htought somoene might have a suggestion.
snip_it has joined #ruby
wmoxam has joined #ruby
<ukwiz> Tasser: I tried yesterday = Date.today -1; yesterdaydate = yesterday.strftime("%Y-%m-%d") which returned 2012-03-27
ghvandoorn has joined #ruby
<ukwiz> Tasser: Looks like the space after today is significant (or perhaps the lack of space after the =)
vicapow has joined #ruby
<ukwiz> Tasser: So, thanks for the pointer
vicapow has quit [#ruby]
<Tasser> ukwiz, the space between - and 1 I'd say
fayimora has joined #ruby
<Tasser> because -1 is interpreted as 1.@-
tatsuya_o has joined #ruby
MrGando has joined #ruby
wyhaines has joined #ruby
arkonova has joined #ruby
pygmael has joined #ruby
dql has joined #ruby
kpshek has joined #ruby
bwlang_ has joined #ruby
mafolz has joined #ruby
RORgasm has joined #ruby
AxonetBE has quit [#ruby]
ph^ has joined #ruby
iocor has joined #ruby
EzeQL has joined #ruby
bananastalktome has joined #ruby
alx- has joined #ruby
hSATAC has joined #ruby
kuzushi has joined #ruby
mikeycgto has joined #ruby
selvakumaran has joined #ruby
heftig has joined #ruby
<selvakumaran> Hello there?? I wanna install QTRuby on my opensuse machine, Need help?
wallerdev has joined #ruby
<shevy> selvakumaran do you have all header files from qtruby
<shevy> and did you even download qtruby
vipaca has joined #ruby
vipaca has joined #ruby
<[[thufir]]> Ok, I don't get it. the docs are here: http://rubydoc.info/gems/ruby-net-nntp/1.0.0/frames and I'm following that sample as so: https://gist.github.com/2216162 and am unclear how to initiallize as per: uninitialized class variable @@logger in Net::NNTP which the website docs don't mention at all. I did "gem install log4r tmail" .
malcolmva has joined #ruby
DrShoggoth has joined #ruby
<[[thufir]]> Net::NNTP.logger = ...what?
d3c has joined #ruby
<d3c> I need the timestamp of the current minute. I'm doing this which works but I'm not sure if it's a very pretty solution: http://pastebin.com/5hXYhzsH
Maxou56800 has joined #ruby
<artm> I don't see the { foo: "bar" } form of hash literals used much, is it less popular or something?
wyhaines has joined #ruby
pgpkeys has joined #ruby
bwlang_ has joined #ruby
<Tasser> [[thufir]], Logger.new
<Tasser> artm, it's not 1.8 compatible
<Tasser> d3c, time.now.gm ?
<artm> Tasser I see. thanks.
<shevy> yeah, code that has the new form wont work on 1.8
<[[thufir]]> Tasser: ah, ok. I was just about to post this: https://forge.secure.at:10443/hgweb/projects/ruby-net-nntp/file/c3318cb0b5af/lib/net/nntp.rb the source for that problem. ok, I'll try that, thank you.
Morkel has joined #ruby
<Tasser> artm, ehh, Time.now
<d3c> Tasser: needs to be the current minute, not second.
<Tasser> artm, sorry
<Tasser> d3c, ehhhhh
<Tasser> d3c, / 60 ? ^^
<artm> np
<shevy> d3c: Time.now.strftime "%M" # => "52"
Drewch has joined #ruby
fayimora has joined #ruby
<keymone> d3c: Time.now.min
<d3c> shevy: maybe I'm not clear but I need the timestamp of the current minute. that is, the epoch. that's what I'm trying to achieve in my script by always setting seconds to zero.
<keymone> Time.now.to_i/100
<keymone> no forget that
<d3c> keymone: yeah… I want the point in time when the current minute started.
<d3c> keymone: what I pasted does actually find that but I don't find it very pretty
<keymone> d3c: n=Time.now;n.to_i-n.sec
tess has joined #ruby
brngardner has joined #ruby
<[[thufir]]> i read the log4r webpage a bit, and tried some variants: https://gist.github.com/2216162 still getting name errors, though.
<d3c> keymone: that's more like it. awesome :) thanks. for gmtime, it would just be n.gmtime, right?
yoklov has joined #ruby
PsiliPharm has joined #ruby
<keymone> d3c: can't say from top of my head, play around with it
rbrooks_ has joined #ruby
acekiller has joined #ruby
alek_b has joined #ruby
ElderFain_ has joined #ruby
rippa has joined #ruby
selvakumaran has joined #ruby
flagg0204 has joined #ruby
Foxandxss has joined #ruby
Morkel has joined #ruby
workmad3 has joined #ruby
JwbF75ug has joined #ruby
RORgasm has joined #ruby
rbrooks has joined #ruby
albemuth has joined #ruby
CheeToS has joined #ruby
ElderFain has joined #ruby
niku4i has joined #ruby
senthil has joined #ruby
niqdanger has joined #ruby
IrishGringo_ has joined #ruby
nru has joined #ruby
lkba has joined #ruby
devinus has joined #ruby
devinus has joined #ruby
devinus has joined #ruby
devinus has joined #ruby
devinus has joined #ruby
devinus has joined #ruby
devinus has joined #ruby
thwest has joined #ruby
devinus has joined #ruby
devinus has joined #ruby
devinus has joined #ruby
devinus has joined #ruby
devinus has joined #ruby
IrishGringo_ has joined #ruby
devinus has joined #ruby
devinus has joined #ruby
devinus has joined #ruby
hSATAC has joined #ruby
devinus has joined #ruby
sekretskwerl has joined #ruby
<sekretskwerl> anyone know if you can create custom events to fire in Cramp?
devinus has joined #ruby
devinus has joined #ruby
jgrevich has joined #ruby
ElitestFX has joined #ruby
devinus has joined #ruby
devinus has joined #ruby
devinus has joined #ruby
cha1tanya has joined #ruby
devinus has joined #ruby
devinus has joined #ruby
wilmoore has joined #ruby
devinus has joined #ruby
<regedarek> hi, how to increase nil by 1
<regedarek> nil + 1 is wrong
devinus has joined #ruby
<sekretskwerl> yes it is, but 0+1 isn't
<senthil> regedarek: you can't
<regedarek> hmm
<senthil> unless you open NilClass and add '+' method and have that point to some global var
devinus has joined #ruby
tess has joined #ruby
<senthil> but why would you
<sekretskwerl> regedarek: i'm guessing you just need a data rethink.
ElderFain_ has joined #ruby
<regedarek> im trying to update_attribute(:some_attribute(which is nil), @some_attribute + 1)
devinus has joined #ruby
devinus has joined #ruby
<senthil> regedarek: set some_attribute default value as 0
devinus has joined #ruby
kpshek has joined #ruby
devinus has joined #ruby
<niqdanger> Is anyone here using the activedirectory gem and can explain why my activedirectory::user.find is not?
<matled> regedarek: @some_attribute.to_i or @some_attribute || 0 might work for you too
devinus has joined #ruby
daniel_hinojosa has joined #ruby
Squarism has joined #ruby
devinus has joined #ruby
devinus has joined #ruby
adamn_yyc has joined #ruby
<regedarek> matled: thx
devinus has joined #ruby
<senthil> matled: nil.to_i works?
devinus has joined #ruby
<senthil> so it does, odd
<matled> what's odd about it?
<sekretskwerl> matled: 'nil' and '0' are not the same thing.
<sekretskwerl> it's no doubt something that was thrown in to make life easier
becom33 has joined #ruby
<senthil> all chars also translate to 0 'a'.to_i, 'aaa'.to_i 'b'.to_i
<becom33> in this http://pastebin.com/pS20MNsz if I enter a invaild address or if the response got late script exits , how can I keep the script if its not responsing keep it going timeout and if the IP is invaild make it give a normal error like response error
devinus has quit [#ruby]
berserkr has joined #ruby
lukevisinoni has joined #ruby
bricker88 has joined #ruby
mengu has joined #ruby
krisfremen has joined #ruby
<Mon_Ouie> senthil: to_i stops after the first non-digit characters it finds
<Mon_Ouie> "10a".to_i is 10
<sekretskwerl> ah, that would explain it.
<deryl> with 0 being a default value correct?
MrGando has joined #ruby
<sekretskwerl> so as soon as it sees nil, it just returns 0
<Mon_Ouie> Yep
<senthil> Mon_Ouie: ah, that's actually helpful, no need to regexp it
<Mon_Ouie> sekretskwerl: No, NilClass#to_i and String#to_i are different methods
<sekretskwerl> ah
<Mon_Ouie> Also notice string.to_i doesn't always ignore characters. e.g. "a".to_i 16 #=> 10
<Mon_Ouie> I mean letters*
<sekretskwerl> Mon_Ouie: so does NilClass#to_i actually recognize nil
<Mon_Ouie> It's like class NilClass; def to_i; 0; end; end
<sekretskwerl> ah
ed_hz_ has joined #ruby
SamFigueroa has joined #ruby
thelarry has quit [#ruby]
EvanR has joined #ruby
arvidkahl has joined #ruby
dbgster has joined #ruby
hydrozen has joined #ruby
chimkan has joined #ruby
<lectrick> I'm looking at some code online and there is this one line, "World(Capybara::Driver::Sessions)". What does that do? It fails on my setup
<lectrick> I tried googling "ruby language world" and... well, you already know how well that went
<senthil> lectrick: isn't World Cucumber thing?
arvidkahl has joined #ruby
<senthil> i wish names were more google/programmer friendly
<shevy> senthil hehehe
<shevy> it was hard to google for the * operator
<senthil> shevy: and `
<shevy> oh yeah
<lectrick> senthil: Aha. Makes sense now. It extends an Object-like class with modules, so as not to pollute the global namespace.
<senthil> and <=>
<lectrick> shevy: Shoulda googled "splat" :)
trkemist has joined #ruby
baroquebobcat has joined #ruby
<Mon_Ouie> lectrick: For the record, googling for "ruby method world" yields more relevant results
<lectrick> Mon_Ouie: Thanks for the google scoping tip :)
<shevy> lectrick yeah when one knows the name, it is easy. * for splat, ` for backtick
<shevy> it would be nice if there could be certain search modes used in google easily
apeiros_ has joined #ruby
<senthil> too bad we can't do subject searches in Google, instead having to prefix every thing with "ruby" or "rails"
<shevy> "wear ruby hat" -> show only ruby-relevant results
<shevy> yeah
niqdanger has quit ["Leaving"]
bwlang_ has joined #ruby
<senthil> like ruby.google.com searches only ruby universe
twqla has joined #ruby
<lectrick> shevy: agreed on nerdy google search mode
<rippa> they'd have to index way more that way
PsiliPharm has joined #ruby
<rippa> for marginal benefits
brngardner has joined #ruby
Russell^^ has joined #ruby
ascarter has joined #ruby
hSATAC has joined #ruby
ilyam has joined #ruby
aantix has joined #ruby
LMolr has joined #ruby
t0mmyvyo has joined #ruby
eldariof has joined #ruby
wyhaines has joined #ruby
davidcelis has joined #ruby
centipedefarmer has joined #ruby
hSATAC has joined #ruby
maletor has joined #ruby
Indian has joined #ruby
cmpf has joined #ruby
yoklov has joined #ruby
trkemist has joined #ruby
cloke has joined #ruby
moshef has joined #ruby
fmcgeough has joined #ruby
io_syl has joined #ruby
<d3c> I'm using the lzoruby gem to compress JSON with LZO. however, I can decompress the compressed JSON. does anyone know if this gem is broken or something?
<d3c> s/can/can't/
bwlang_ has joined #ruby
kenichi has joined #ruby
<Tasser> { "name": "Jruby/Lucene", "sections": [ {"Intro":"intro"}, {"CTD":"ctd"}, {"Task":"tries"} ] } <- where is that invalid json?
eywu has joined #ruby
<d3c> Tasser: jsonlint.com ?
williamcotton has joined #ruby
eywu has quit [#ruby]
Banistergalaxy has joined #ruby
dbgster has joined #ruby
Guest___ has joined #ruby
<Tasser> showoff bugs a bit
<Tasser> or I didn't read the docu 100%
<Tasser> b)
zakwilson has joined #ruby
schovi has joined #ruby
adeponte has joined #ruby
ephemerian has joined #ruby
wataken44 has joined #ruby
SegFaultAX|work has joined #ruby
banisterfiend has joined #ruby
Eiam has joined #ruby
ghvandoorn has joined #ruby
prometheus has joined #ruby
jay has joined #ruby
stkowski has joined #ruby
bwlang_ has joined #ruby
banisterfiend has joined #ruby
ringotwo has joined #ruby
nerdy has joined #ruby
banisterfiend has joined #ruby
adamkittelson has joined #ruby
baroquebobcat has joined #ruby
apok has joined #ruby
sebastorama has joined #ruby
burgestrand has joined #ruby
t0mmyvyo has joined #ruby
Araxia has joined #ruby
jasond has joined #ruby
artm has joined #ruby
stkowski has joined #ruby
eignerchris has joined #ruby
ascarter has joined #ruby
Squarism has joined #ruby
adeponte has joined #ruby
greenarrow has joined #ruby
nfluxx has joined #ruby
ballpointcarrot has joined #ruby
trkemist has joined #ruby
_adeponte has joined #ruby
moshef_ has joined #ruby
blueadept has joined #ruby
timonv has joined #ruby
mxweas_ has joined #ruby
daniel_hinojosa has joined #ruby
|REM| has joined #ruby
<|REM|> is there a place where i can download old versions of ruby? looking specifically for 1.8.5
delinquentme has joined #ruby
visof has joined #ruby
LBRapid has joined #ruby
mmokrysz has joined #ruby
ipoval has joined #ruby
hadees has joined #ruby
<shevy> |REM| hmmm
<shevy> |REM| ftp://ftp.ruby-lang.org/pub/ruby/1.8/
akemrir has joined #ruby
<shevy> ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.5.tar.gz
<Mon_Ouie> I think ruby's website keeps at least some releases
<Mon_Ouie> And even if it weren't there, you could use SVN to get any revision
<shevy> wow ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.0.tar.gz
<shevy> 2003!
<shevy> I GO BACK IN HISTORY :)
<shevy> awwww
<shevy> ossl_ssl.c: In function 'ossl_sslctx_get_ciphers':
<shevy> ossl_ssl.c:289: error: 'STACK' undeclared (first use in this function)
<|REM|> awesome. Thanks!
luxurymode has joined #ruby
pyreal has joined #ruby
evenix has joined #ruby
<evenix> Hi all
jgarvey has joined #ruby
blueadept has joined #ruby
c0rn has joined #ruby
ringotwo has joined #ruby
ringotwo has joined #ruby
SphericalCow has joined #ruby
adam_lowe has joined #ruby
schovi has joined #ruby
<shevy> at least I can still compile the latest ruby 1.8.x
tenshihan has joined #ruby
<tenshihan> hi what's missing here to print out a json encode string that i can use $.parseJson (from jquery) on?
daniel_hinojosa has joined #ruby
ilyam has joined #ruby
hydrozen has joined #ruby
ringotwo_ has joined #ruby
ringotwo_ has joined #ruby
xnm has joined #ruby
brngardner has joined #ruby
apok_ has joined #ruby
havenn has joined #ruby
artm has joined #ruby
cbuxton has joined #ruby
jcromartie has joined #ruby
MrGando has joined #ruby
<jcromartie> I loaded a document with Nokogiri, and it seems to be unable to execute XPath on it
ipoval has quit [#ruby]
bosborne has joined #ruby
<bricker88> I've set @time = Time.now and then did a benchmark on strftime, ~18 seconds to run it 100,000 times. Does that sound right? Seems kind of slow to me.
<jcromartie> wouldn't doc.xpath("//coordinates") give me all of the "coordinates" elements regardless of their location?
<TTilus> bricker88: it kinda depends
<jcromartie> but it returns nothing
<bricker88> TTilus: go on?
<TTilus> bricker88: id expect it to depend on the format string
voodoofish430 has joined #ruby
fayimora has joined #ruby
<bricker88> TTilus: It was fairly robust, "%A, %B %e, %l%P" - However I just ran the benchmark.measure method again and it was significantly faster, ~0.25 seconds, maybe that's a false result though
swarley has joined #ruby
<tenshihan> i have a question
<bricker88> or maybe the first time was false
<tenshihan> if i have an array of objects
<tenshihan> how do i encode it into json?
<Orva> bricker88: well, default ruby date/datetime implementation is quite (really) slow
<tenshihan> so i can just parse it with anything else
`brendan has joined #ruby
SphericalCow has joined #ruby
brianpWins has joined #ruby
theRoUS has joined #ruby
<tenshihan> I'm being argued with that ruby some how can not turn an array of objects into a well form json string
<tenshihan> simple objects like { "test":"one"}
<tenshihan> how do i refute? I don't do ruby but this guy is being stubborn out of spite.
RORgasm has joined #ruby
<bricker88> tenshihan: well an array doesn't have key/value pairs like a JSON object does, that's not Ruby, in fact that's not even programming, that's just english
<burgestrand> tenshihan: you walk away, it’s an odd argument made from somebody who does not know what he’s talking about, you’re wasting your time
<apeiros_> you ask him what about the result of { "test":"one"}.to_json is not well formed
jmfcool has joined #ruby
<apeiros_> tenshihan: anyway, that guy is an idiot, and bothering with him is probably a waste of time
<burgestrand> \o/
<apeiros_> also, you probably wanted {test: "one"}
<apeiros_> or did you mean the json side?
<apeiros_> ruby-1.9.2:012:0>> puts({test: "one"}.to_json)
<apeiros_> {"test":"one"}
<TTilus> bricker88: less than second sounds about right, http://pastie.org/3679521
manizzle has joined #ruby
bwlang has joined #ruby
<tenshihan> ["\"{\\\"test\\\":\\\"one\\\"}\"", "ok", "{\"test\":\"one\"}"]
<apeiros_> tenshihan: what's that supposed to be?
<tenshihan> no
<tenshihan> finalyl got him to
<tenshihan> ["{\"test\":\"one\"}"],"{\"test\":\"one\"}"]
<tenshihan> i know it can be {"test":"one"}]
<tenshihan> with no effort
brngardner has joined #ruby
<apeiros_> tenshihan: wtf?
<TTilus> bricker88: ...and that was on an ancient 1.2GHz C220
<bricker88> TTilus: Thanks, must have just been my computer contemplating the task the first time
<tenshihan> how do you work with someone who purposely sabotages shit?
<apeiros_> tenshihan: is that guy you're arguing with by any chance you yourself?
<tenshihan> lol
<TTilus> bricker88: what ruby was it?
<tenshihan> clever boy
<apeiros_> tenshihan: ah, so that's his code?
artm has joined #ruby
<tenshihan> yeah
<tenshihan> that's his
<TTilus> bricker88: and was the 18 sec wall clock time?
<lopex> % require 'json'
snearch has joined #ruby
<apeiros_> so boy who can't use his tools blames his tools for his failures… common story.
<lopex> % {test: "one"}.to_json
<lopex> doh
axl_ has joined #ruby
multibot_ has joined #ruby
<TTilus> bricker88: prolly just other processes eating up your cpu or some weird warmup thingy
<lopex> % require 'json'
<multibot_> true
<tenshihan> that's already in there
<apeiros_> tenshihan: "#{@survey_array}" <-- what does he want with that? it'll call to_s on @survey_array
<tenshihan> i've told him to call t_json
<tenshihan> but he just says, no do it my way
<tenshihan> spite
<tenshihan> is there a #notateamplayerhelp channel?
schaerli has joined #ruby
<apeiros_> I see so much fail in that code…
schaerli has joined #ruby
schaerli has quit [#ruby]
codespectator has joined #ruby
<apeiros_> 1. tabs for indent, 2. Array.new instead of [], 3. globals, 4. badly named variables (r2, srsly?), 5. for … in, 6. ivar as lhs in the for … in, 7. JSON.decode, 8. for… in + << instead of map, 9. "#{@survey_array}"
<apeiros_> I wouldn't wonder if in all that fail I missed even more fail…
<apeiros_> I'd assume that $r2.get("survey:#{@survey_id}") is fail too, but since I don't know what $r2 is…
schaerli has joined #ruby
<apeiros_> tenshihan: http://pastie.org/3679570
<bricker88> TTilus: It was "real time" from the benchmark output, I would guess it was closer to about 10 seconds clock time. Yes, I think you're right, was probably just my computer
<TTilus> bricker88: total cpu time (third num) is the one you should be looking at by default when benchmarking
hooper has joined #ruby
axl_ has joined #ruby
axl_ has joined #ruby
centipedefarmer has joined #ruby
mdw has joined #ruby
trkemist has joined #ruby
shell0x_ has joined #ruby
<TTilus> bricker88: "real time" i.e. wall clock time may reflect more the overall cpu load of you system than your process
<axl_> #colloquy
<bricker88> TTilus: I see - in that case the first run was on ~0.5s
<bricker88> only*
Jake232 has joined #ruby
<TTilus> bricker88: ok, that explains, your box happened to be under heavy cpu load or for some other reason kernel decided to schedule very little cpu time for your benchmarked bit of code
zodiak has joined #ruby
swarley has joined #ruby
pastjean has joined #ruby
JNZ` has joined #ruby
<TTilus> bricker88: during the 10+ seconds of wall clock time your code got mere half a second of cpu time from scheduler
<TTilus> bricker88: somebody else got the rest of it ;)
JNZ has joined #ruby
theRoUS has joined #ruby
axl_ has joined #ruby
sacarlson has joined #ruby
kirun has joined #ruby
axl_ has joined #ruby
varreli has joined #ruby
varreli has joined #ruby
ascarter has joined #ruby
artm has joined #ruby
fayimora has joined #ruby
kesor_ has joined #ruby
axl_ has joined #ruby
Okasu has joined #ruby
workmad3 has joined #ruby
<Okasu> hello
<Okasu> can you expplain the difference between net/http in ruby 1.8 and ruby 1.9?
sectionme has joined #ruby
<Okasu> for exaple some site i can access with ruby 1.9
<Okasu> but with 1.8 i stuck with site's bit protection
<Okasu> does ruby 1.9 make proper headers with user agent or somthing?
shadoi has joined #ruby
axl_ has joined #ruby
cpruitt has joined #ruby
ghanima has joined #ruby
emmanuelux has joined #ruby
jlebrech has joined #ruby
Squarepy has joined #ruby
<tenshihan> apeiros_: thanks it worked
<tenshihan> he conceded finally
mrsolo has joined #ruby
axl_ has joined #ruby
Squarepy has joined #ruby
axl_ has joined #ruby
Evixion has joined #ruby
Jackneill has joined #ruby
chimkan_ has joined #ruby
dsh80|wark has joined #ruby
mikewintermute has joined #ruby
fayimora has joined #ruby
axl_ has joined #ruby
BlakeRG has joined #ruby
<Norrin> trying to install rvm
<Norrin> " bash -s stable < <"
<Norrin> what does that do?
<BlakeRG> is `.blank?` a standard method in ruby?
ilyam has joined #ruby
<Norrin> the -s is 'read cmds from stdin?
mikewintermute has joined #ruby
axl_ has joined #ruby
<Norrin> if so, if the "stable" appended or prepended?
<shadoi> BlakeRG: it's an active_support method
<BlakeRG> shadoi: do I need to require that?
<shadoi> BlakeRG: I recommend http://www.gotapi.com/rubyrails to find where stuff is (or Pry)
<Norrin> anyone installed rvm before?
<shadoi> BlakeRG: It's part of Rails, so I'm not sure if that's what you're trying to use.
Russell^^ has joined #ruby
<BlakeRG> shadoi: I've in inherited an app that was supposedly built ontop of Sinatra, it came with all of the source except for the main controller. I've got some routes defined but one of my .erb templates is throwing an error "undefined method `blank?' for nil:NilClass"
Gerty_ has joined #ruby
axl_ has joined #ruby
axl_ has joined #ruby
<Norrin> this is why i scream every time someone tells me i need rvm in order to install ruby. WHY this extra layer of trouble. so i waste 30 minutes trying to figure out how to install rvm
<Norrin> or longer
<shadoi> BlakeRG: probably need to require active_support
<shadoi> just give it a shot
<BlakeRG> Norrin: I just started messing with ruby today and I've got RVM down pat :)
<BlakeRG> shadoi: yeah, no go :(
<Norrin> BlakeRG: thank you for answering the rvm questions i posted
<shadoi> Norrin: it's simply wrapping all the things you'd do manually to install from source.
<shadoi> Norrin: you'd make all the same mistakes many times over. :)
axl_ has joined #ruby
<BlakeRG> RVM is nice, just wish debian system packages where up to date so I didn't have to deal with it
<shadoi> I just built my own debian packages
<shadoi> I got sick of all of it.
<Norrin> how can i install rvm system wide?
<Norrin> that's my end goal
<BlakeRG> Norrin: install as root
<Norrin> the installation instructions have this bash syntax i have no idea what it does. so convoluted i can't even figure out how to run it as root
<Norrin> wtf does " bash -s stable < <" mean?
<BlakeRG> copy+paste the "install rvm" line from the site
<Norrin> BlakeRG: that's a home dir installation
<Norrin> that's my problem
brngardner has joined #ruby
wilmoore has joined #ruby
<shadoi> Norrin: you have to use sudo
<Norrin> shadoi: so sudo bash -s stable < < >?
<Norrin> shadoi: so sudo bash -s stable < < ?
<shadoi> yes, just prefix it with sudo
axl_ has joined #ruby
<BlakeRG> Norrin: if you run it as root with sudo, it will install under /usr/local/rvm/
<BlakeRG> then you can do
<BlakeRG> install 1.9.3
<BlakeRG> use 1.9.3
<BlakeRG> etc
alfism has joined #ruby
<becom33> http://pastebin.com/8EV3Yp7N in here when I type new isnt it suppose to print "This is somthing new "?
falsetto has joined #ruby
<Norrin> thanks. that should work.
<Norrin> looking at " bash -s stable < <", I had no idea where to put the sudo in there
<BlakeRG> sudo rvm install 1.9.3
justinmcp has joined #ruby
<BlakeRG> sudo rvm use 1.9.3
havenn has joined #ruby
alfism has joined #ruby
alanp has joined #ruby
<becom33> umm ?
<BlakeRG> shadoi: is `to_js` apart of ruby or rails?
<sekretskwerl> technically neither, it's a gem.
<BlakeRG> JSON ?
<sekretskwerl> that you can use in either, and that is automatically included in Rails.
<sekretskwerl> the to_json you're referring to is most likely the one that ActiveRecord uses, which I think is multi_json
<sekretskwerl> but there's a json gem that does it too, yes.
<BlakeRG> sekretskwerl: which gem?
axl_ has joined #ruby
imsplitbit has joined #ruby
<sekretskwerl> BlakeRG: json
<BlakeRG> sekretskwerl: http://pastebin.com/qefmzzxk
<BlakeRG> I still get "undefined method `to_js' for nil:NilClass"
<sekretskwerl> to_js or to_json
<swarley> [12] pry(main)> {:hi=>:there}.to_json
<swarley> => "{\"hi\":\"there\"}"
<becom33> http://pastebin.com/8EV3Yp7N in here when I type new isnt it suppose to print "This is somthing new "?
<sekretskwerl> BlakeRG: also, if its saying nil:NilClass, you may have a bigger issue.
<sekretskwerl> BlakeRG: what you pasted has no to_json in it.
B|aster has joined #ruby
<BlakeRG> sekretskwerl: the method is being called by a .erb template view
<swarley> [18] pry(main)> nil.to_json
<swarley> => "null"
<sekretskwerl> swarley: that is not the result on some versions.
<swarley> its the json that come with ruby
<sekretskwerl> BlakeRG: if it says to_js in there, they either messed it up, or have some override method that isn't declared.
<swarley> why would you use to_js
<swarley> to_javascript??!?!
<BlakeRG> sekretskwerl: I inherited this code base from someone else, SOB's didn't include the main controller. It was suposedly done in Sinatra so I am trying to re-construct it myself
<sekretskwerl> BlakeRG: then that would likely be your issue.
<sekretskwerl> BlakeRG: JSON'ing an object is really easy. Just include the json gem, and its likely you'll want to override the to_json anyhow.
axl_ has joined #ruby
<sekretskwerl> BlakeRG: Rails does provide formatting methods for which pieces of information go out in JSON. I do not know anything about Sinatra, so I can't tell you if it does.
<sekretskwerl> but you can always just write it out in Ruby in 3-4 lines
<sekretskwerl> google 'ruby to_json'
<swarley> you can do
<swarley> load 'json.rb'
<swarley> and it will use the one in the ruby path :[
<sekretskwerl> require 'json'
<lopex> % {:hi=>:there}.to_json
<multibot_> {"hi":"there"}
<sekretskwerl> % nil.to_json
<multibot_> null
<sekretskwerl> but yeah, you can define to_json overrides
<swarley> % {:hi=>:there}.to_json.pretty_inspect
<multibot_> (NoMethodError) undefined method `pretty_inspect' for "{\"hi\":\"there\"}":String
<BlakeRG> I just defined a blank method called "to_js" and I finally have some template views showing whoohooo
<swarley> why..
<swarley> if its for json..
<swarley> just to_json..
<sekretskwerl> swarley: because to_json includes all fields, and you might not want it to.
<sekretskwerl> sometimes you only want to save specific fields.
<swarley> like?
<sekretskwerl> and in the case of rails, if you "just to_json" you'll end up with public password hashes.
<BlakeRG> swarley: why would the orignal developer speciically have a method called "to_js" if that one works
<swarley> i thought it wasnt working
<swarley> annd that was the problem
<sekretskwerl> both of you should go google..
<swarley> i dont need to
<swarley> im not using it
<swarley> im just wondering what going on
<swarley> i can just leave
<swarley> o/
Drewch has joined #ruby
banisterfiend has joined #ruby
jmfcool_ has joined #ruby
red5 has joined #ruby
<BlakeRG> is this a method call? <%= yield %>
<BlakeRG> or an echo of a var
<sekretskwerl> neither
<sekretskwerl> well, technically a method call I guess.
<sekretskwerl> It's the yield from your ruby code.
<sekretskwerl> you put it in application template
axl_ has joined #ruby
<delinquentme> is there a ruby "continue" equivalent?
<delinquentme> I dont want to break out of the loop .. but simply continue on to the next iteration
<heftig> next
<Squarepy> haha
releod has joined #ruby
<swarley> delinquentme, next
<delinquentme> swarley, heftig thanks!
<swarley> np
releod has quit [#ruby]
burgestrand has joined #ruby
trivol has joined #ruby
tvw has joined #ruby
Vert has joined #ruby
dbgster has joined #ruby
blueadept has joined #ruby
blueadept has joined #ruby
souuell has joined #ruby
<souuell> hey guys, im new to ruby so I am looking for a little help on the best way to do x task. I need to take a date or range of dates and turn them into a directory tree, ie: 2012/05/01 = $PATH/2012/05/01, or create an array of directories from the range
<souuell> is there any library i should be looking at is Date / Stringifying good enough?
trivol_ has joined #ruby
cobragoat has joined #ruby
choffstein has joined #ruby
Russell^^ has joined #ruby
Imapickle has joined #ruby
<swarley> oh
<swarley> wel
<swarley> souuell, you can try
Vert has joined #ruby
<swarley> Time#strftime
c0rn has joined #ruby
bwlang_ has joined #ruby
<swarley> Time.strftime("%y/%m/%d")
<Imapickle> <3 Rubyness
<swarley> Time.new.strftime*
<souuell> checking that out now, is ruby-doc.org the best documentation for methods / classes etc?
<swarley> yes
<swarley> souuell, [5] pry(main)> Time.new.strftime("%Y/%m/%d")
<swarley> => "2012/03/27"
<souuell> swarley: thanks a lot dude. Do you have any good links regarding date math in ruby? Is there an extensive library that does that?
timonv has joined #ruby
workmad3 has joined #ruby
<swarley> souuell, let me check for you
<swarley> what are you trying to do?
<swarley> maybe that will help me help you some
<souuell> uhmm
<souuell> so as i said above. I am basically taking a date range and then performing date math to find files within that range on a system
<souuell> and the directories are like $PATH/2012/03/27/dir/[files i want]
<Imapickle> ruby is so easy if you been using C++ for about a year +
<Imapickle> :D
<souuell> heh, this is my first object oriented language
<swarley> hm
Azure has joined #ruby
<swarley> well
<souuell> ive been dabbling it in because i want to learn it, but its so different from procedural programming.
<swarley> you could
<Imapickle> hehe
<swarley> uhhh
<swarley> i dont know xD
<sekretskwerl> Python and Ruby are great intros to OO language. But, they do mask a lot of the "computer science" if you don't dig for it, which I'm a big proponent for people understanding.
<souuell> hah
<sekretskwerl> Also, you can just perform math operations on date values. You can use Time.now for current time
<souuell> sekretskwerl: i agree, thats why i learned C 5 years ago. it teaches you the most of any language you can learn.
<sekretskwerl> and can figure out duration or whatever that way. Lots of things.
<souuell> we need more people like you
<CrazyPickles> apart from assembly and binary :)
<sekretskwerl> lol
<CrazyPickles> C++ will not get you too far in Assembly its a hole different visuality
<souuell> everyone who programs should know asm
<souuell> i dont, but everyone should
<swarley> i wonder how time ranges work
<sekretskwerl> I did NASM for a bit, but I've never written anything in straight hex/binary
<CrazyPickles> I actaully agree souuell
Vert has joined #ruby
<wmoxam> Ruby has binary operators
<wmoxam> :p
<CrazyPickles> assembly is faster then c++ :P
<souuell> CrazyPickles: haha
<CrazyPickles> haha
<wmoxam> CrazyPickles: not really
<CrazyPickles> get 2 windows one written in best optimized assembly and c++ optmized best you will see the difference
<CrazyPickles> cmd windows :)
<wmoxam> in simple cases you can hand optimize better than an assembler, but in many cases you'd be hard pressed to
<souuell> im thinking i might have to take the values in as string, regular expression them, then add them to path. the math part im not so sure of. In bash i did it with find -cnewer ! -cnewer
<CrazyPickles> anyways :)
<sekretskwerl> souuell: you should never have to do all that just to do a date range.
<souuell> but the reason why i started writing this in ruby is because i figured that was silly and ruby could do it better.
<souuell> bash is TERRIBLE at date math
<sekretskwerl> souuell: you are just trying to find the amount of time between two dates?
<souuell> find a list of files inbetween two given date ranges when their directories are technically the dates. log files for 2012/03/27 would reside in 2012/03/27 in the filesystem
<sekretskwerl> ahh
<sekretskwerl> then yeah, you'd have to parse the name, make date objects, then subtract to find the duration if you wanted to use actual dates.
<sekretskwerl> if you're taking textual input though, you could just use text parsing on the filename and not even bother with dates.
<sekretskwerl> you could say like ./getfiles.rb 2 8
BlakeRG has quit [#ruby]
<sekretskwerl> and it would find all files from month 02 to month 08 just via text parsing
<sekretskwerl> there's a bunch of ways to do it.
<swarley> sekretskwerl, i worked with NASM and AT&T
<swarley> i prefer AT&T tbh
<swarley> it makes more sense imo
<swarley> since its mov %AX, X
foo-bar-_ has joined #ruby
<swarley> %BX*
<souuell> well most of those places also use erlang right swarley ?
<swarley> instead of mov BX, AX
<sekretskwerl> uh
<swarley> well, AT&T syntax is the style
<sekretskwerl> so the % makes it more readable?
<sekretskwerl> that makes no sense.
<swarley> no
<sekretskwerl> they are practically the sam.e
y3llow_ has joined #ruby
<swarley> no..
<swarley> move AX to BX
bluOxigen has joined #ruby
s0ber_ has joined #ruby
bluOxigen has joined #ruby
<swarley> in AT&T mov %AX, %Bx
<swarley> nasm mov BX, AX
<sekretskwerl> yes, so %
<swarley> no..
<swarley> the order is reversed
<fowl> this isnt ruby
<fowl> plz stfu
<sekretskwerl> lol
<swarley> lol
<swarley> and yes % means registers
<gogiel> AT&T sucks
<sekretskwerl> dest,src is a better order i think.
<swarley> :[ the phone company tes
<sekretskwerl> most modern apis use that order as well
<gogiel> using those % is so frustrating. and revesred order
<swarley> well, it makes more sense to me
<swarley> and GCC uses it
<swarley> so it cant be too bad
ascarter has joined #ruby
<swarley> ; as the comment messes me up thou
<swarley> i dont know why
havenn_ has joined #ruby
<swarley> i always liked the haskell -- and -{ -}
robbyoconnor has joined #ruby
<souuell> i read an article that said haskell is as fast as C recently.
robbyoconnor has joined #ruby
<fowl> luajit is pretty fast, without all the crazy new math professor concepts
axl_ has joined #ruby
<swarley> haskell can handle like 1,000,000 haskell threads i read somewhere
<swarley> i've always been interested, but its hard to go from oo to functional
eywu has joined #ruby
<gogiel> swarley: yes
<gogiel> but erlang is fun
mfournier has joined #ruby
foo-bar- has joined #ruby
<sekretskwerl> golang is great as well.
artm has joined #ruby
<gogiel> it's worth trying, but it's not language for anything like ruby
<swarley> yeah
<swarley> well
<swarley> it can do anything
<swarley> but expect work
<swarley> im a follower of Pugs the haskell perl6 interpreter
<gogiel> facebook chat is written in erlang afaik
<nate_h> what's the proper ruby string fuction to get the last character in a string
<gogiel> nate_h: string[-1]
<nate_h> thanks man
ChampS666 has joined #ruby
rock-n-rolla has joined #ruby
comron has joined #ruby
rock-n-rolla has quit [#ruby]
Junebouvier has joined #ruby
<comron> Hey everyone. Does anyone know how to interpret a SystemStackError where the backtrace shows no sign of recursion?
<becom33> http://pastebin.com/8x0VwY9X how can I keep the history in command prompt like this ?
chson has joined #ruby
<swarley> comron, check your loops
<becom33> I kinda try doing it with arrays . but it was a failor
<swarley> you'll have to use general debugging im afraid :c
<swarley> becom33,
<swarley> you mean
<swarley> you enter a string
<swarley> and its saved
<swarley> so you can press up?
<swarley> and get it again?
<becom33> yes
<swarley> you can use Readline
<swarley> require 'readline'
<swarley> STDIN.readline
<swarley> STDIN.readline('>')
<swarley> that sets your prompt
twixmix has quit [#ruby]
<swarley> or not
<swarley> lol
<comron> check my loops for what? the stack too deep seems to pop up in slightly different places, but always when dealing with files
<swarley> uhm i dont know
<comron> for example, this is the top of the backtrace: https://gist.github.com/4e95146095316af5c2c4
<becom33> swarley: yea I know I can use readline module. but if Im doing it custome how can I do it
<swarley> u3m
<swarley> um*
<comron> swarley: and the backtrace is only about 150ish calls deep.
<swarley> well
<swarley> you'll either need a data structure to hold it
<swarley> or a file
<Mon_Ouie> swarley: IO#readline != Readline#readline
<Mon_Ouie> Readline.readline ">"
wefawa has joined #ruby
<swarley> yeah i just remembered that lo
elake has joined #ruby
<comron> swarley: maybe i need to up the ulimit of my stack depth.... ill try that
<swarley> o_o
schovi has joined #ruby
Maxou56800 has joined #ruby
robbyoconnor has joined #ruby
<comron> swarley: its the only thing I can think of. there is NO recursion in this system, yet it fails with a stack too deep, and it fails at RANDOM places
<comron> its driving me nuts
<swarley> o-O
<rippa> comron: do you use splats?
<axl_> does any of you use vim? any plugin for a quickly commenting out blocks of code?
<rippa> like, maybe, passing lines of a file as arguments to some method
<comron> rippa: yes, that is very possible
<wmoxam> 16:s/^/#/
<wmoxam> axl_: ^
<wmoxam> :p
<comron> rippa: you think there is too many big args on the stack?
<rippa> comron: splat fails with stack exhaustion if you pass too many arguments
<comron> ooooooh
<comron> interesting
<comron> rippa: that makes a lot of sense, I am dealing with a bunch of files.
<comron> I'll look for this specifically. Thanks for the lead :)
<rippa> though limit is quite high
<rippa> it only fails at about a million of arguments for me
<comron> hrm
<rippa> so i doubt it's that
<comron> what is your ulimit for stack size?
bwlang has joined #ruby
<rippa> no idea
<rippa> lol, i segfaulted ruby
<comron> k
shruggar has joined #ruby
<comron> lol
heftig has joined #ruby
mdw has joined #ruby
<axl_> wmoxam: thanks
LMolr has joined #ruby
hiten_ has joined #ruby
fase has joined #ruby
foo-bar- has joined #ruby
<swarley> lol
thwest has quit [#ruby]
brngardner has joined #ruby
robbyoconnor has joined #ruby
havenn has joined #ruby
sdeobald has joined #ruby
Okasu has quit [#ruby]
bwlang_ has joined #ruby
pastjean has joined #ruby
Aaaarg has joined #ruby
jrist has joined #ruby
PsiliPharm has joined #ruby
robbyoconnor has joined #ruby
looopy has joined #ruby
Aaaarg has joined #ruby
straind` has joined #ruby
dcolebatch has joined #ruby
heftig has joined #ruby
pygmael has joined #ruby
badelat has joined #ruby
libertyprime has joined #ruby
pu22l3r_ has joined #ruby
robbyoconnor has joined #ruby
yoklov has joined #ruby
foo-bar-_ has joined #ruby
tommyvyo has joined #ruby
kesor_ has joined #ruby
jakky has joined #ruby
<comron> swarley: How did you get stack exhaustion with splats?
<comron> swarley: I want to try it myself.
robbyoconnor has joined #ruby
<swarley> uh. who was it that suggested it
<swarley> uhm
<swarley> well crap
<swarley> well
<swarley> you could do something like
rckts has joined #ruby
<comron> I segfault ruby before i get a stack too deep...
<swarley> def recursion(*hi); recursion hi << hi; end
<comron> but this is recursion *and* splats...
<swarley> uhm
<swarley> i dont know
<swarley> lol
<comron> hah, ok
<swarley> sory i cant help
<comron> no problem. you've been very helpful, actually :)
become33 has joined #ruby
<become33> in this script http://pastebin.com/AFF8Sk6r
thone_ has joined #ruby
<become33> if I type the command "test help" if should puts "this is help" but it not printing like that
<swarley> becom33,
<swarley> self.__send__
jbw has joined #ruby
<become33> swarley: its not printing "This is help" when I type "test help" . btw doesnt give any error
<swarley> oh sorry
<become33> I think the loggic Im using isnt correct swarley
Danielpk has joined #ruby
<shadoi> becom33: put some debugging in there to see what buf.chomp and buf.split is (btw, whitespace is the default split character for strings)
io_syl has joined #ruby
<become33> shadoi: wait
<shadoi> becom33: also, make a list of allowed commands, instead of using send raw like that, it's a security hole.
bashdy has joined #ruby
<shadoi> become33: generally you don't want a loop in your initialize either
<shadoi> put that in a "run" method or something.
wefawa has quit [#ruby]
eywu1 has joined #ruby
<become33> shadoi: how to set a list of commands ?
<shadoi> def command_list; %w[this that these foo blah]; end
tom___ has joined #ruby
eywu1 has joined #ruby
<shadoi> or have it be an instance variable, or whatever
<shadoi> then you can say: self.send(cmd, args) if command_list.include?(cmd)
<tom___> (10..1).min returns Nil. Also, iterating over (10..1) doesn't iterate over 10 values. What am I misunderstanding?
<become33> btw shadoi http://pastebin.com/fH8U827V . it prints the parameter so it means its inside the not null if
<shadoi> become33: you can just say "if para", that's a test if it's nil
<become33> aghh ok
<tom___> Oh damn, the API describes this.
robbyoconnor has joined #ruby
<become33> if para means if para!= nil right shadoi
<shadoi> yes
<become33> shadoi: still when I type "test help" its not printing "This is help"
S2kx has joined #ruby
<shadoi> when you do your split, put the command and arguments in separate variables for clarity
<shadoi> command, argument = buf.split
<shadoi> print them both out
king313 has joined #ruby
<become33> shadoi: just take a quick look at this http://pastebin.com/Aabzug6k
S1kx has joined #ruby
albemuth has joined #ruby
<shadoi> the if statement where you do self.__send__ is wonky
<become33> it prints if I type "test lol" it prints lol in line 18 puts , it means the parameter is passed
<become33> whats wonky
<become33> ?
bwlang_ has joined #ruby
<shadoi> the command_list test is on a separate line
<shadoi> but maybe it's just pastebin
<become33> shadoi: i just made a test for that test comamnd on command_list it works
<become33> shadoi: it prints the para from the puts in line 18 it means the paramter passed right ? still why when I do para == "help" it doesnt work ?
<shadoi> become33: you removed your chomp, so it probably has a newline
<become33> wait lemme try with a chomp :)
trivol has joined #ruby
<become33> shadoi: I did a buf = buf.chomp
<shadoi> just use buf.chomp!
<become33> shadoi: you mean like while buf.chomp ?
<shadoi> buf.chomp! is equivalent to buf = buf.chomp
<become33> shadoi: didnt know that , thanks :)
<become33> shadoi: http://pastebin.com/f1KhSC8f stil "test help" doesnt print "Thsi is help"
tom___ has quit [#ruby]
somazero has joined #ruby
<shadoi> you need the exclamation
<shadoi> buf.chomp!
<shadoi> or it doesn't modify buf
<shadoi> you can also put .chomp at the emd of line 7
<become33> ok
<shadoi> end*
<become33> still no
<become33> shadoi: do I have annything wrong with my logic ?
burgestrand1 has joined #ruby
MasterIdler has joined #ruby
MasterIdler has joined #ruby
JC_SoCal has joined #ruby
S2kx has joined #ruby
alex__c2022 has joined #ruby
<become33> umm shadoi are you trying somthing over there ?
<shadoi> become33: must be a whitespace or newline issue with the para var
CarterL has joined #ruby
<CarterL> anyone checked out the browserquest thingy?
<become33> shadoi: still how can I fix that ? :/
<shadoi> become33: strip and/or chomp on para
<become33> u want me do para.chomp! ?
<shadoi> become33: you need to know exactly what the string is, you should figure out how to print it out in a raw form :)
<shadoi> become33: I'd recommend using pry
Seventoes has quit [#ruby]
<become33> shadoi: I just wanetd to know do u see anything wrong with my logic ?
<become33> self.respond_to?(m) shadoi doing that I
addisaden has joined #ruby
<become33> I'll be able to check the method avaible right ? but now I wanna check if it requires a parameter to pass . how can I do that ?
jakky has joined #ruby
addisaden has quit [#ruby]
sam113101 has joined #ruby
<CarterL> would it be possible to write the backend for an mmo using ruby?
pygmael has joined #ruby
pen has joined #ruby
<shadoi> become33: make a valid_command? method that checks if the command is in the command_list and the class responds to the method.
<shadoi> CarterL: sure but it would require careful design and performance would rely heavily on concurrent and distributed systems.
<become33> shadoi: no . I did self.respond_to?(m) to see if the method exsist
<become33> but the problem is I wanna know if has any paramter to pass
<shadoi> become33: not sure what you mean
<become33> well wait I'll paste and show you
<CarterL> shadoi: makes sense
seanp2k has joined #ruby
<seanp2k> terenary derp: puts domain if q.available? else print '.'
<seanp2k> ternary** ...how would I write that as one?
<matti> puts q.available? ? domain : '.'
<matti> ?
<shadoi> q.available? ? puts domain : puts '.'
<seanp2k> matti: well, I want to only print if q.available? => false
luckyruby has joined #ruby
<seanp2k> shadoi: syntax error, unexpected tIDENTIFIER, expecting keyword_do or '{' or '(
<seanp2k> shadoi: that's where I'm at too :)
<shadoi> seanp2k: matti was right
<shadoi> puts true ? "yes" : "no"
<matti> Yay me.
<seanp2k> shadoi: but I need to print in one case and puts in the other
<seanp2k> if q.available? then puts domain else print '.' end
<seanp2k> does what I want
<matti> seanp2k: Isn't that the same thing?
<shadoi> seanp2k: you can just print both times and include a newline with domain
<shadoi> print true ? "yes\n" : "no"
pygmael has joined #ruby
* matti smells PEBKAC ...
<shadoi> seanp2k: the if is probably more readable in the long run anyway.
<matti> shadoi: "Whatever works" :)
vjacob has joined #ruby
<seanp2k> matti: not the same thing at all. What if I wanted to do two completely different things?
<matti> seanp2k: Why did you ask about ternary then? :)
<matti> seanp2k: I am not criticising ;p
<seanp2k> would still like to know how to use ternary operator to do this for future reference even though I'm just leaving it as if...then...else...end
wallerdev has joined #ruby
tenderloaf has joined #ruby
Karmaon has joined #ruby
<become33> shadoi: doing like User.respond_to?('name') it checks if the method name exists right ?
wallerdev has joined #ruby
wallerdev has joined #ruby
fayimora has joined #ruby
tatsuya_o has joined #ruby
MasterIdler has joined #ruby
nacengineer has joined #ruby
ascarter has joined #ruby
<become33> ummm :/
<daed> ummm.
notjohn has joined #ruby
<shadoi> become33: it makes sure the User class responds to the "name" method
notjohn has joined #ruby
nacengineer has joined #ruby
<shadoi> and in that case, it's asking if it has a class_method that matches that, not an instance method.
become33_ has joined #ruby
trkemist has joined #ruby
liluo has joined #ruby
jwang has joined #ruby
stringoO has joined #ruby
patrick99e99 has joined #ruby
somazero_ has joined #ruby
hadees has joined #ruby
havenn has joined #ruby
keymone_ has joined #ruby
cafesofie has joined #ruby
carlyle has joined #ruby
Houdini has joined #ruby
nacengineer has joined #ruby
<Houdini> tv and v is the same
souuell_ has joined #ruby
<shadoi> Houdini: yeah seems redundant, but technically .dup can have behavior that changes the object.
<shadoi> not usual though, and probably not needed there.
<Houdini> hm,.. could you show example when dup change object?
<Houdini> please
<shadoi> if you define initialize_copy
<shadoi> it will be called when you call .dup or .clone
pen has joined #ruby
SolarisBoy has joined #ruby
IPGlider has joined #ruby
nacengineer has joined #ruby
<Houdini> thx, I didn't know it. So the redundant is v variable? so we copy tv = duplicate[k] to not call initialize_copy
<Houdini> tv.is_a?(Hash) is enough
wyhaines has joined #ruby
<shadoi> Houdini: it's just being careful that it only recursively calls when the type matches, I'd leave it :)
tess has joined #ruby
tatsuya_o has joined #ruby
mikeric has joined #ruby
deryl has joined #ruby
<robacarp> is there an elsunless?
<shadoi> robacarp: no.
<shadoi> which is why unless…else..end is disgusting.
ilyam_ has joined #ruby
<shadoi> well, not the only reason, but yeah...
simpleharmonicmo has joined #ruby
waxjar has joined #ruby
i8igmac has joined #ruby
philcris_ has joined #ruby
tess has joined #ruby
<tess> slt j'ai un probleme lib/setup.rb:118:in `require': no such file to load -- /var/www/jobsworth/lib/config/environment.rb (LoadError)
<tess> from lib/setup.rb:118:in `<main>'
nari has joined #ruby
<nate_h> what is the ruby 1.8 way to remote the last char from a string?
<nate_h> err
<nate_h> return the the string minus the last char
<shadoi> tess: utiliser: require_relative 'config/environment'
<shadoi> nate_h: str[0…-1]
tommyvyo has joined #ruby
<nate_h> hmm three dots, ok maybe that's what i was missing
<shadoi> 3 means exclusive
<nate_h> hmm
<tess> shadoi : je t'ai pas compris
<nate_h> syntax error
<nate_h> let me try in a a test script
<shadoi> tess: est la version 1.8?
sbanwart has joined #ruby
<nate_h> nvermind
<nate_h> my fault
<tess> shadoi : ruby 1.9.2p318
fowl has joined #ruby
<shadoi> tess: in setup.rb, il est probable que d'une ligne à "require" config/environment.rb
<shadoi> tess: paste code gist.github.com
ilyam has joined #ruby
<tess> merci je vais v
tommyvyo has joined #ruby
<tess> shadoi : voila ce que j'ai trouver
<tess> # Load the rails application
<tess> require File.expand_path('../application', __FILE__)
<tess> require File.expand_path('../environment.local.rb', __FILE__) if File.exist?(File.expand_path('../environment.local.rb', __FILE__))
<tess> # Initialize the rails application
<tess> Jobsworth::Application.initialize!
<shadoi> tess: utiliser gist.github.com or pastbin.com
Guest___ has joined #ruby
<tess> shadoi : comment je vais l'utiliser
<shadoi> tess: Je devine que environment.local.rb essaie de charger environment.rb et il n'utilise pasle truc expand_path.
<shadoi> tess: Je ne sais pas français, je suis juste en utilisant google.com / translate :)
<tess> shadoi : c'est quoi la solution
<become33_> I still can't get this done :/ http://pastebin.com/NjrpdJip
<tess> are you talking english
zakwilson has joined #ruby
<shadoi> tess: yes :)
<become33_> "test help" should output "This is test"
<tess> ok
<tess> keep talking english
<tess> i'll try to undertand
<become33_> shadoi: I tried everything :/ still I cant figerout why isnt it working
<shadoi> tess: you need to find (probably in environment.local.rb) where it requires environment.rb, and use: require File.expand_path, with the correct path.
<shadoi> become33_: para is an array, not a string. :)
<tess> shadoi : i have to change this path '../environment.local.rb ?
ascarter has joined #ruby
<shadoi> tess: it depends what is in it.
become33 has joined #ruby
<become33> I still can't get this done :/ http://pastebin.com/NjrpdJip
<become33> "test help" should output "This is test"
freeayu has joined #ruby
chimkan has joined #ruby
<shadoi> become33: para is an array. You didn't do what I told you with the split :)
<tess> shadoi: can you write me a solution?
<shadoi> tess: not without your files, sorry.
<become33> shadoi: how is it a array ?
fayimora has joined #ruby
<shadoi> become33: split returns an array
SpitfireWP_ has joined #ruby
<shadoi> become33: use this instead of lines 10 and 11: m, cmd = buf.split
<tess> shadoi:which files exactly
<become33> oh for crying out lowed
<become33> now it works
<become33> thanks alot a shadoi
<shadoi> become33: :)
<shadoi> become33: I really recommend you checkout pry.github.com
<shadoi> become33: get good at using it, your life will be a lot easier.
<become33> shadoi: I have a one more question . gimme a second
ohcibi has joined #ruby
tatsuya_o has joined #ruby
jamesbrink1 has joined #ruby
senj has joined #ruby
artOfWar has joined #ruby
darthdeus has joined #ruby
<tess> shadoi : You must first create a config/database.yml according to the instructions
prometheus has joined #ruby
<tess> can you help me
<tess> ?
<shadoi> tess: you should check for a french rubyonrails channel or something. #rubyonrails may help but a french speaking channel would save you a lot of time.
<tess> i understand english but i have problem with ruby on rails
<shadoi> try #rubyonrails then, they can help with rails specific problems.
<tess> ok thx
bwlang has joined #ruby
kevinbond has joined #ruby
jamesbrink has joined #ruby
becom33 has joined #ruby
wyhaines has joined #ruby
<becom33> http://pastebin.com/DH72D2MH in this if I didnt pass any paramters to the test method , it crashes . is there any way to keep the defut parameter nil ?
abdelrhman has joined #ruby
mdel has joined #ruby
ZachBeta has joined #ruby
<shadoi> becom33: either make a default for the cmd, or put it back how you had it with: def test(para=nil)
<shadoi> becom33: like… line 11 could be: cmd ||= "help"
Chryson has joined #ruby
tomzx has joined #ruby
<becom33> if I do cmd ||= "help" when I do "like" method like will crash coz it doesnt require any parameters
<becom33> hmm i was doing para=nil on every method . I was thinking if there is a better way
phantasm66 has joined #ruby
<becom33> thats why shadoi I asked you before is there any way to find if the method requires a parameters
<shadoi> becom33: see if you can figure out how to use that :)
<becom33> shadoi: I think I got it , lemme try that