Topic for #ruby is now Ruby programming language || ruby-lang.org || RUBY SUMMER OF CODE! rubysoc.org/ || Paste >3 lines of text in http://pastie.org || Para a nossa audiencia em portugues http://ruby-br.org/
banisterfiend has joined #ruby
sorin has joined #ruby
t0mmyvyo has joined #ruby
saurb has joined #ruby
demet8 has joined #ruby
demet8 has quit [#ruby]
demet8 has joined #ruby
demet8 has quit [#ruby]
wroathe has joined #ruby
emmanuelux has joined #ruby
gyre007 has joined #ruby
Ownatik has joined #ruby
soulnafein has joined #ruby
iocor has joined #ruby
iocor has joined #ruby
<gyre007>
rubyists and rubystas?I started learning ruby from the Programming Ruby 2nd edition, the author keeps using the :: in a lot of expressions before clarifying what it actually is for ie SomeClass::Somethin or even SomeClass::Something::Else
<gyre007>
anyone could shed some light on this ?
<soulnafein>
gyre007: have you used any other prog language before?
nowthatsamatt has joined #ruby
<gyre007>
yes, I'm assuming that it is some sort of referencing of the defined variables/objects ?
<soulnafein>
gyre007: what language have you used?
<gyre007>
like in C++ when you referring to global variable you'd say Class::global_var
<gyre007>
C C++
danishkhan has joined #ruby
<soulnafein>
are there namespaces in C++?
<gyre007>
yes
<soulnafein>
so in ruby you have modules
<soulnafein>
which you can use like namespaces sometime
<ElderFain>
why can't i do something like [var.to_a,var2.to.a]
momo_ has joined #ruby
<ElderFain>
i have to do var.to_a; var2.to_a; [var,var2] which kind of bothers me
<soulnafein>
gyre007: so if I have a class Dog in a module Animals I refer to it as Animals::Dog
<gyre007>
soulnafein: mm I see. ok so this explains one thing
<gyre007>
what about Animals::Dog::puppy
MasterIdler_ has joined #ruby
<soulnafein>
you can have classes inside classes in ruby
<soulnafein>
and modules inside modules
dibri has joined #ruby
<gyre007>
I've also seen a case where a class is defined and it has a constant defined as its var, which is ten referenced as CLass::Constant
<gyre007>
I mean field, not var
nowthatsamatt has quit [#ruby]
philcrissman has joined #ruby
<banisterfiend>
gyre007: so long as it's a Constnat or a class method it can be accessd using the :: notation
<gyre007>
so even the class methods can be called via ::
<banisterfiend>
gyre007: yah
<gyre007>
mm..cool
<banisterfiend>
gyre007: have you seen 'labyrinth' ? the movie by jim henson
pdtpatr1ck has joined #ruby
soulnafein has quit [#ruby]
<gyre007>
banisterfiend nope, but that name sounds familiar
<gyre007>
any good ?
<gyre007>
isnt that the puppet guy ?
<gyre007>
from Star Wars
randym has joined #ruby
CacheMoney has joined #ruby
twoism_ has joined #ruby
i8igmac has joined #ruby
looopy has joined #ruby
tomzx has joined #ruby
havenn has joined #ruby
tayy has joined #ruby
<tayy>
hi everyone! how do i get Mechanize to print http headers?
diegok has joined #ruby
momo_ has joined #ruby
tatsuya_o has joined #ruby
chimkan has joined #ruby
<startling>
have any of you folks used citrus? I'm having some trouble walking the parse tree
matthias3 has joined #ruby
ZachBeta has joined #ruby
sythe has joined #ruby
fallen has joined #ruby
moshee has joined #ruby
moshee has joined #ruby
robacarp has joined #ruby
seanstickle has joined #ruby
ZachBeta has joined #ruby
<dark3rdre4ms>
Hello, I am trying to compile xchat-ruby against ruby 1.9
<dark3rdre4ms>
my problem is ruby.h
<dark3rdre4ms>
is it like, ruby/ruby.h
<dark3rdre4ms>
actually, nvm
chrxn has joined #ruby
<CacheMoney>
I'm trying to use the 'mysql' gem and the website (http://www.tmtm.org/en/ruby/mysql/) states I need to download a .tar.gz file. How do I unzip a file like that?
momo_ has joined #ruby
<startling>
CacheMoney: tar xzf myfile.tar.gz
<startling>
CacheMoney: that's how you would do it on a unixy os, anyway.
jordanstephens has joined #ruby
<CacheMoney>
startling: I did that and got an error message saying "The term 'tar' is not recognized as the name of a cmdlet, fucntion, ....." Do I need to install tar or a tar gem?
<startling>
CacheMoney: what os are you on?
<CacheMoney>
windows
tsd_usa has joined #ruby
<startling>
CacheMoney: ah.
<dark3rdre4ms>
CacheMoney: Yeah, that will be a problem
<diegok>
CacheMoney: I think winzip is able to uncompress...
andrewhl has joined #ruby
<dark3rdre4ms>
Download 7zip
<dark3rdre4ms>
7zip is better really
aBound has joined #ruby
<CacheMoney>
dark3rdre4ms: okay I'll check it out. Thanks!
<dark3rdre4ms>
you are welcome
<aBound>
Hello all, are there any book recommendations for learning Ruby for a beginner like me?
<diegok>
dark3rdre4ms: no idea. I would install cygwin und then use tar :)
<dark3rdre4ms>
diegok: same
<dark3rdre4ms>
aBound: Well, I began learning Ruby with Why's Poignant Guide
<dark3rdre4ms>
excellent "book"
<aBound>
dark3rdre4ms, I'll check that out.
<startling>
aBound: seconding the poignant guide, though it might be slow if you have programming experience already
<aBound>
startling, Nope no programming experience here.
<dark3rdre4ms>
I also have the book The Ruby Programming Language
<dark3rdre4ms>
aBound: yep, why's poignant guide will be great for you :P
<aBound>
:P
<dark3rdre4ms>
ruby is my first language and now I'm kind of dabbling in C
<dark3rdre4ms>
but I don't ever see myself leaving though
<dark3rdre4ms>
heck, right now I'm trying to get xchat-ruby to compile for ruby 1.9
g0bl1n has joined #ruby
<aBound>
By the way are there any exercises within this book?
<startling>
aBound: yes, kind of.
<startling>
aBound: it's a weird book. just go with it
<dark3rdre4ms>
yeah, kind of
<dark3rdre4ms>
yeah it is very weird
<dark3rdre4ms>
but very good
<aBound>
haha
<aBound>
No doubt.
tsd_usa has joined #ruby
jxpx777 has joined #ruby
<dark3rdre4ms>
_why definitely had an imagination
<dark3rdre4ms>
I wish he would show up out of the blue.
robacarp_ has joined #ruby
<aBound>
It does seem a bit weird indeed but I'll get used to it more or less. :P
<dark3rdre4ms>
aBound: yes, it will make you laugh
<aBound>
Which kind of editors and/or IDE's do you guys tend to use?
wroathe has joined #ruby
nat2610 has joined #ruby
<dark3rdre4ms>
aBound: GVIM just for an editor. When I'm really working on a project I use Aptana Studio
<startling>
aBound: vim
<dark3rdre4ms>
aptana is an excellent IDE
moted has joined #ruby
<aBound>
Seems VIM gets a lotta attention. I'll check em both out I have a little to much RAM. :P
<nat2610>
Hi, I must be really bad with google but I don't find a nice way to some something like curl --interface eth0.1234 foobar.com in "pure" ruby
<diegok>
aBound: RAM is not what you'll need for vim :)
<aBound>
I know but he also said Aptana Studio. :P
<aBound>
:)
<diegok>
aBound: then yes, RAM and a lot of patience I guess :)
mkscrg has joined #ruby
jergason has joined #ruby
<dark3rdre4ms>
aBound: you'll need a lot of ram with Aptana studio
<dark3rdre4ms>
it's written in Java
<aBound>
Patience is a virtue. :-)
<startling>
that explains it. :3
<CacheMoney>
startling: http://www.tmtm.org/en/ruby/ I unzipped the file with 7zip but I'm still left with a .tar file. Can I use this file on Windows?
<dark3rdre4ms>
yep, I can run it with 2GB's of ram, KDE, and a few instances of Chrome open just fine
<startling>
aBound: vim should be able to do whatever you need though, if you don't mind the learning curve
<aBound>
dark3rdre4ms, Shouldn't be an issue for me with 16GBs of RAM.
colint_ has joined #ruby
<startling>
CacheMoney: I have no idea, I don't dev on windows
<dark3rdre4ms>
aBound: nope.
<dark3rdre4ms>
CacheMoney: extract the tar file
<diegok>
aBound: I'm a vim big fan, but there is a new editor that's having a lot of good words around: http://www.sublimetext.com/2
<dark3rdre4ms>
the same way you extracted the other one
<startling>
CacheMoney: but you do need to untar it somehow
<dark3rdre4ms>
I'm an ex-Windows rubyist
<dark3rdre4ms>
so, yeah.. >.<
Ripp__ has joined #ruby
<aBound>
diegok, I heard about that editor but I seen you had to purchase it or somewhat.
Karmaon has joined #ruby
<diegok>
aBound: yep :)
dibri has joined #ruby
<aBound>
EX-Windows user. <<
<startling>
dark3rdre4ms: welcome home
<diegok>
I would prefer to pay to not use a java thingy :p
<dark3rdre4ms>
ha
<dark3rdre4ms>
diegok: overall it's a pretty nice IDE
<dark3rdre4ms>
it's based on Eclipse
<diegok>
<puke>
<dark3rdre4ms>
:|
<diegok>
:-p
<dark3rdre4ms>
eclipse is a pretty decent IDE
<diegok>
but you need a cluster to start it :p
<aBound>
Looks like all I have to do is wait till Ubuntu 12.04 LTS gets released before doing anything special.
<dark3rdre4ms>
diegok: LOL
<dark3rdre4ms>
I feel right at home here. xD
namidark has joined #ruby
<dark3rdre4ms>
lulz
<diegok>
dark3rdre4ms: there are two things I dislike in this world: java and eclipse :)
<dark3rdre4ms>
well, of course you dislike eclipse because you dislike java
<dark3rdre4ms>
lol
<banisterfiend>
dark3rdre4ms: that lol was unwarranted i demand u retract it!
<diegok>
nah, I don't dislike eclipse because it run on the jvm...
<diegok>
I just dislike it for being what it is :-)
<aBound>
Some of the bluray disc are written in Java it seems.
<diegok>
Indeed, I'm somehow like the jvm but hate java as a computer language.
<diegok>
:)
<diegok>
java just doesn't fit in my perlish mind :)
<aBound>
Alright guys thanks for the advice and I appreciate it. Have a good day. :P
<CacheMoney>
dark3rdre4ms: Did you use 7zip on the command line at all when you were developing on Windows?
<dark3rdre4ms>
CacheMoney: no
pingfloyd has joined #ruby
headius has joined #ruby
<startling>
is there a style guide most people use for ruby?
<td123>
bstarek: an updated ruby to p105 with those changes will be pushed tomorrow to testing and probably move to stable repos soon
<td123>
after
<bstarek>
td123: great man, are u a developeer?
<td123>
ya
mksm has joined #ruby
<bstarek>
td123: keep up the good work man
kpshek has joined #ruby
<td123>
i plan to :p I still have some more plans for ruby changes (hopefully for the better)
voodoofish4301 has joined #ruby
fayimora_ has joined #ruby
al3xnull_ has joined #ruby
baroquebobcat has joined #ruby
sjang1 has joined #ruby
seivan has joined #ruby
<bstarek>
td123:wish u guys good luck
<bstarek>
td123:what is arch biggest advantage?
<bstarek>
speed is crazy i gotta say
<td123>
my favorite is the simplicity and that it doesn't hide anything away from you, you basically get vanilla pkgs
<bstarek>
i used to be a debian user ... i am really looking for something more challenging and i have to say that arch puts u to the test from the very first day
<bstarek>
agree with you....comes with very limited packages, the rest is your preference
<bstarek>
i meant basic packages at the install
<td123>
ya, it definitely doesn't sugarcoat anything :P
<bstarek>
it doesnt overwhelm the user with extra stuff....u choose u install it
nim__ has joined #ruby
<bstarek>
td123: anyway, thanks for the help, im out! ;)
voodoofish430 has joined #ruby
Deele has joined #ruby
<CacheMoney>
is anyone famillar with Rubygame?
<CacheMoney>
*familiar
saurb has joined #ruby
<RubyPanther>
CacheMoney: nobody gets familiar with any of it, everybody is very distant and aloof when use code.
pu22l3r has joined #ruby
Karmaon has joined #ruby
<banisterfiend>
CacheMoney: rubygame is dead
<banisterfiend>
CacheMoney: use Gosu instead
pu22l3r has joined #ruby
manizzle has joined #ruby
dv310p3r has joined #ruby
nerdy has joined #ruby
<CacheMoney>
I just came across it on YouTube, was watching the tutorial but it was old and wondered if anyone still uses it
tangledhelix has joined #ruby
<CacheMoney>
thanks, i'll check out Gosu
Sivart has joined #ruby
<CacheMoney>
banisterfiend: do you know of any good resources/examples/tutorials for Gosu?
czn has joined #ruby
nim__ has joined #ruby
panthrodeb has joined #ruby
<banisterfiend>
CacheMoney: the gosu website, libgosu.org
<CacheMoney>
banisterfiend: yeah i'm on there... just curious to know if you had any other resources.
viper1092 has joined #ruby
<banisterfiend>
CacheMoney: look at the tutorials that come with the gem
replore_ has joined #ruby
_|christian|_ has joined #ruby
czn has joined #ruby
tsd_usa has joined #ruby
andrewhl has joined #ruby
zakwilson has joined #ruby
cbuxton has joined #ruby
startlin1 has joined #ruby
matthias_ has joined #ruby
mcoffee has joined #ruby
ckrailo has joined #ruby
c0rn has joined #ruby
sorin has joined #ruby
p0y has joined #ruby
ben_alman has joined #ruby
c0rn has joined #ruby
matthias2 has joined #ruby
pu22l3r has joined #ruby
headius has joined #ruby
radic_ has joined #ruby
blueadept has joined #ruby
blueadept has joined #ruby
chimkan has joined #ruby
pingfloyd has joined #ruby
cashman has joined #ruby
adeponte has joined #ruby
ryannielson has joined #ruby
gokul has joined #ruby
havenn has joined #ruby
<startling>
what's the best way to turn a string into an integer?
<senthil>
regedarek: you should remove this line "builder.use Faraday::Response::Logger" when building the faraday object. when i ran the tests it polluted the screen
snearch has joined #ruby
zomgbie has joined #ruby
<senthil>
regedarek: @client.new_link("http://wp.pl", title = 'wp', description = 'WP').status.should == ''. if you care just about success/failure, i'd do that
baniseterfiend` has joined #ruby
xpot-arcturus has joined #ruby
DrShoggoth has joined #ruby
<regedarek>
thx it works :) thx a lot ;)
<baniseterfiend`>
regedarek: np
enherit has joined #ruby
senthil has joined #ruby
senthil has quit [#ruby]
senthil has joined #ruby
sizz has joined #ruby
twelvechairs has joined #ruby
startling has joined #ruby
bluOxigen has joined #ruby
snearch has joined #ruby
Morkel has joined #ruby
dibri has joined #ruby
snearch has joined #ruby
mafolz has joined #ruby
<twelvechairs>
esoteric question. Is there a simple way to be able to sort objects in a regular way (eg by object_id) however, where enumerables, ensure that duplicates (eg. 2 arrays with the same contents) always end up in the same spot?
Guest62662 has joined #ruby
eldariof has joined #ruby
ph^ has joined #ruby
stoffus has joined #ruby
nerdy has joined #ruby
atmosx has joined #ruby
pi3r has joined #ruby
zommi has joined #ruby
simonwh has joined #ruby
JohnBat26 has joined #ruby
bier has joined #ruby
Sliker has joined #ruby
QaDeS has joined #ruby
<CacheMoney>
I'm using the 'Crack' gem to parse JSON. However, the .json file I was given is producing an error when I attempt to parse it. Error message reads "line 2: syntax error, unexpected ':', expecting tASSOC". I realize Ruby wants a '=>' in place of the ':'. Is there any way around this?
<startling>
CacheMoney: don't use that json parser?
<CacheMoney>
startling: which do you recommend? I'm new to programming and it's the only parser I've used so far, although it was with XML
neko_gata_s has quit [#ruby]
<startling>
CacheMoney: I've never used one; the google might help you
<CacheMoney>
thanks
elliot_ has joined #ruby
ephemerian has joined #ruby
cyri_ has joined #ruby
daglees has joined #ruby
daglees has joined #ruby
iocor has joined #ruby
Mekkis has joined #ruby
eldariof has joined #ruby
saurb has joined #ruby
hukl has joined #ruby
choi0hun has joined #ruby
don9z has joined #ruby
fortysixandtwo has joined #ruby
senthil has joined #ruby
saurb has joined #ruby
don9z has quit [#ruby]
bjensen has joined #ruby
DuoSRX has joined #ruby
patjoh has joined #ruby
alek_b has joined #ruby
dross has joined #ruby
fayimora has joined #ruby
willb has joined #ruby
Helius has joined #ruby
stringoO has joined #ruby
Guest14918 has joined #ruby
Mekkis has joined #ruby
gianlucadv has joined #ruby
BiHi has joined #ruby
ikaros has joined #ruby
pen has joined #ruby
nd_____ has joined #ruby
fayimora has joined #ruby
patjoh has joined #ruby
award85 has joined #ruby
award85 has joined #ruby
bluOxigen has joined #ruby
pen has joined #ruby
davidpk has joined #ruby
<shevy>
dumdedum
<shevy>
who volunteers as my testie!
<baniseterfiend`>
shevy: me!
eka has joined #ruby
<shevy>
but I need an inexperienced dude who makes many mistakes :(
<shevy>
in ancient times, fowl did that
robotmay has joined #ruby
<baniseterfiend`>
shevy: fowlie is gone forever left gone away forever gone gone gone
<shevy>
yeah :(
bstarek has joined #ruby
<shevy>
skyrim changed him
<shevy>
I can only warn people about it
iocor has joined #ruby
Mekkis has joined #ruby
Sivart has joined #ruby
kin9 has joined #ruby
krz has joined #ruby
Targen has joined #ruby
iocor has joined #ruby
ephemerian has joined #ruby
bluOxigen has joined #ruby
arturaz has joined #ruby
<CacheMoney>
I'm trying to take an array of strings ["a2", "f6", "r1", "a2", ...], take the first character and save it as a key, save the second character as the value in a new hash. I'm having trouble doing this for some reason
<baniseterfiend`>
senthil: so instead of my_object.users << User.new
<baniseterfiend`>
senthil: do this: my_object.add_user User.new
<baniseterfiend`>
senthil: that way you can also do some basically sanity tests over the data
<baniseterfiend`>
so u can raise if someone passes in a Horse.new
<shevy>
hehe
<senthil>
oh!
<senthil>
what about getters? why not use them
Spockz has joined #ruby
<baniseterfiend`>
senthil: getters can expose implementation details of your object that u dont necessarily want exposed
iocor has joined #ruby
<senthil>
baniseterfiend`: then what's the alternative?
<baniseterfiend`>
senthil: also it enables people to change the object outside of your api
<baniseterfiend`>
senthil: like, my_object.users #=> a UserCollection instace is returned
tatsuya_o has joined #ruby
<senthil>
so return just the details?
<baniseterfiend`>
senthil: then someone can just start blindly adding to UserCollection whenever they want
<baniseterfiend`>
with none of the safeguards of add_user, and they can also modify it in other ways
<baniseterfiend`>
senthil: well some people say if you *really* want a getter then make sure the getter returns a dup of the object instead of teh real object
<baniseterfiend`>
so that if some guy does mess with it, it wont affect your actual data
eighty4 has joined #ruby
<senthil>
baniseterfiend`: seems paranoid
<baniseterfiend`>
senthil: it's just about insuring that people cant mess with your object aside from using your APIs
<baniseterfiend`>
ensuring*
<baniseterfiend`>
senthil: because you can make guarantees about your APIs and you can be sure that the state of your object is going to be sane
<baniseterfiend`>
but if people work around your APIs then all bets are off, and you have to put more error checking code into yoru methods
<CacheMoney>
can I sort a hash alphabetically based on it's keys?
<baniseterfiend`>
senthil: whereas if you can rely on them using your APIs then you yourself dont have to code so defensively
<senthil>
baniseterfiend`: interesting
<senthil>
baniseterfiend`: how about you? do you return clone objects?
<senthil>
baniseterfiend`: i mean in pry or something
saurb has joined #ruby
simonwh has joined #ruby
<baniseterfiend`>
senthil: not really, i just dont provide getters sometimes, but mostly i just dont care as nothing too bad could happen, and anyway the API is not the main way of interacting with Pry, the REPL itself is, so it's kind of different to most projects
<karantan>
what does "::" mean in ruby? (class Myclass < Smt::AA::BB)
<sacarlson>
is there a way of listing the methods available on an object? my error undefined method `get_active' I want to see what is there that can be done to this object
<Asher>
karamtan - namespacing.. just means BB is in the context of AA
<Asher>
sacarlson - obj.methods
<sacarlson>
ok cool I'll try the pust obj.methods
<sacarlson>
opps puts
<shevy>
hehe pust pust pust
lorandi has joined #ruby
<baniseterfiend`>
Asher: ashraff:)
<Muon>
senthil: what about the class << self voodoo?
<Asher>
baniseterfiend` what's up
<Asher>
muon - opens the context for the eigenclass of self
<senthil>
Muon: You don't need it if you extend the module. class << self in a module defines module class methods
<Muon>
okay
<baniseterfiend`>
Asher: added `up regex` so you can move to the next parent stack frame that matches the regex, pretty fucking sexy if u ask me, ashraff!!
<Asher>
neat
<Muon>
senthil: but what if I want the module class method thing to remain?
<baniseterfiend`>
Asher: so there's a stack frame further up the stack called 'run' (the run method) instead of having to type 'up 5' or whatever to move to it, i can just go: up run
<baniseterfiend`>
or even `up r` (if no other matches for r)
tayy has joined #ruby
fayimora has joined #ruby
<senthil>
Muon: You want a Module class method and a Class class method of the same name?
<headius>
fwiw, I looked into this today for arturaz...binding carries a filename and line number with it, so it's going to be the file and line at the point you call binding
<headius>
it's not the line at which you call eval
<arturaz>
yeah, that makes sense :)
<arturaz>
use binding.eval str, __FILE__, __LINE__
<arturaz>
as headius pointed out
<headius>
baniseterfiend`: oh, I see...if you hit __LINE__ earlier it uses that again
<headius>
as with rbx, passing explicit line works
iocor has joined #ruby
<headius>
I'm not sure how useful __LINE__ is here anyway if you're not passing explicit file and line to eval
trivol has joined #ruby
<baniseterfiend`>
headius: we need to recover the original line using binding.eval("__LINE__") though, but for us it just always returns 1
<headius>
it's not going to reflect what you think it does
<headius>
"original line"?
<baniseterfiend`>
whereas we need the line that the `binding` method was called on
<headius>
so you actually want the line where binding was called
<baniseterfiend`>
headius: yeah
<headius>
not the line where you eval
<baniseterfiend`>
headius: right
<headius>
what for?
<baniseterfiend`>
headius: in MRI, if we store that binding and later on call that_binding.eval("__LINE__") we get thet line where the `binding` method was originally invoked
<baniseterfiend`>
headius: for a debugger
<baniseterfiend`>
headius: they invoke: `binding.pry` in tehir code, and we want to display lines of code either side of that, to capture the context around the `binding.pry` call
<headius>
mmm ok
<baniseterfiend`>
so we grab that_binding.eval("__LINE__") and then retrieve 5 lines +- that line
zommi_ has joined #ruby
<headius>
sure
<headius>
that's totally bizarre that it resets to 1
visof has joined #ruby
visof has joined #ruby
<headius>
I don't know why that would happen
<headius>
__LINE__ is just parsed directly into a fixnum AST node
<headius>
system ~/projects/jruby2 $ ast -e "__LINE__"
<headius>
AST:
<headius>
RootNode 0
<headius>
NewlineNode 0
<headius>
FixnumNode 0
<headius>
I don't know why hitting it would cause binding's behavior to change
mengu has joined #ruby
<headius>
ahh, this is a bug in the compiler
<headius>
it works in interpreter
<baniseterfiend`>
interesting
nari has joined #ruby
<headius>
both interpreters are ok
rohit has quit [#ruby]
<headius>
heh, I know why
<headius>
compiled code doesn't track line numbers
<headius>
the JVM does it at that point
<headius>
baniseterfiend`: file the bug
<headius>
it's nontrivial
davidpk has joined #ruby
<headius>
a core optimization in JRuby's compiler is eliminating the tracking of line numbers that other impls have to do
<baniseterfiend`>
headius: thanks, it's really edgecasey and we can get around it anyway using caller() but i'll file it anyway
<headius>
yeah, caller works because it actually walks the JVM stack trace
<headius>
binding would have to do something similar, or I'd have to have the compiler pass position information to it at the point of call
iaj_ has joined #ruby
gvt has joined #ruby
telling has joined #ruby
telling has joined #ruby
Muz has joined #ruby
kaktus has joined #ruby
tessi has joined #ruby
mbreit has joined #ruby
dcarper has joined #ruby
sayakb has joined #ruby
randym has joined #ruby
bluenemo has joined #ruby
LMolr has joined #ruby
pdelgallego_ has joined #ruby
pdelgallego has joined #ruby
bjensen has joined #ruby
pdelgallego has quit [#ruby]
pdelgallego_ has quit [#ruby]
pdelgallego_ has joined #ruby
pdelgallego_ has quit [#ruby]
Jeena_ has quit [#ruby]
pdelgallego has joined #ruby
MoMo has joined #ruby
dl3r has joined #ruby
<nim__>
i'm trying this
<nim__>
def show
<nim__>
@kiniseis << @current
<nim__>
@current.x = @nextpos.x
<nim__>
@current.y = @nextpos.y
<nim__>
puts @current.x
<nim__>
puts @current.y
<nim__>
puts @kiniseis.last.x
<nim__>
puts @kiniseis.last.y
<nim__>
end
<nim__>
why th last element in kiniseis Array changes when i change the current.x and the current.y
<nim__>
any ida?
<nim__>
idea
<baniseterfiend`>
headius: sorry where do i go to file issues for jruby?
chaitanya has joined #ruby
<baniseterfiend`>
nm i found it
fayimora has joined #ruby
<senthil>
if you've two modules with same name methods and include them in a class, will calling super on the last one call the first one?
<baniseterfiend`>
senthil: the last included one will call the first included one
<JonnieCache>
yes
<JonnieCache>
rails 3 is heavily based on that pattern
<senthil>
baniseterfiend`: only solution i can think is to get the method directly and bound it like you mentioned a while back
jamesaxl has joined #ruby
<baniseterfiend`>
senthil: my gosh that code is crazy
<baniseterfiend`>
:)
<Phlogistique>
nim__: because arrays are copied by reference
<senthil>
baniseterfiend`: hehe, i'll take that as a complement
<Phlogistique>
if you want it not to happen you have to use @current.clone
<baniseterfiend`>
senthil: why not just call super by default
<baniseterfiend`>
instead of post-hoc decorating the methods with a super call
<senthil>
Then Single.new.map wouldn't work
<nim__>
thx senthil
<senthil>
I should've named it better, Single and Double are linked lists. Iteration and IterationReverse Enumerable like modules
iocor has joined #ruby
<nim__>
i found it
<senthil>
nim__: found what?
jds has joined #ruby
nanderoo has joined #ruby
<baniseterfiend`>
senthil: i think whatever your'e doing that code is much too complicated, at least in my 4 years of ruby i've never had to write code like that
sterNiX has joined #ruby
<senthil>
baniseterfiend`: hmm
<nim__>
i'm too tired and i make some stupid mistakes
<nim__>
thx anyway
<nim__>
:)
<baniseterfiend`>
senthil: but it's a learning process i think, it's good you know how to write code like that, and solve complicated metaprogramming puzzles
<arturaz>
um, where do you host gems now?
<baniseterfiend`>
cos then at least u know how to do it
<baniseterfiend`>
even if eventually you stop doing things like that
<senthil>
nim__: glad to help
<nim__>
:)
<senthil>
baniseterfiend`: yep!
<JonnieCache>
yeah code like that is all well and good but it shouldnt be allowed near anyone whos givign you money
gavit has joined #ruby
<senthil>
all i'm trying to do is renaming the methods in IterationReverse to _reverse if Iteration is included
<senthil>
*rename
<senthil>
I mean add _reverse at the end of them
BiHi has joined #ruby
<JonnieCache>
renaming methods is just mean
<JonnieCache>
add new methods based on old ones, fair enough, but renaming methods is just pulling the rug out from under the poor developer
<senthil>
JonnieCache: I don't disagree with you one bit. Just playing around with stuff really.
<JonnieCache>
yeah fair enough. you could try undefine_method
<JonnieCache>
think thats what its called
<JonnieCache>
instead of just trying to overwrite it like that
<senthil>
JonnieCache: I tried it earlier, it undefed it from the module, not just the class like i want
<CannedCorn>
guys, i've got a method that can take host+port arrays as arguments currently and i want to have it take a single array of strings instead
<CannedCorn>
can't really think of how to do it in an elegant way
philcrissman has joined #ruby
<virunga>
we should do ruby proselytizing in the other prog langs channels :D
<virunga>
like "you could that much easily in Ruby"
<virunga>
*do
csherin has joined #ruby
Skaag has joined #ruby
Skaag has joined #ruby
pencilcheck has joined #ruby
csavola has joined #ruby
porco has joined #ruby
<geekbri>
What is the difference between require and include?!=
phantomfake has joined #ruby
PaciFisT has joined #ruby
headius has joined #ruby
<CannedCorn>
is using blah.first.last bad form?
<virunga>
geekbri, include?
<virunga>
CannedCorn, what's blah?
<virunga>
or include?!=
hck has joined #ruby
Jay_Levitt has joined #ruby
jxpx777_ has joined #ruby
bitrot has joined #ruby
enherit has joined #ruby
Sailias_ has joined #ruby
<pencilcheck>
is there a standard way in ruby to debug? is there a guide for that?
<geekbri>
virunga i meant just "include" the other where just my exasperation :)
<csavola>
geekbri: require is a short cut for class << self; include foo; end
p0y has joined #ruby
nowthatsamatt has joined #ruby
<rippa>
csavola: you mean extend ?
nowthatsamatt has quit [#ruby]
<csavola>
rippa: yeah my bad. no caffeine this morning
<virunga>
geekbri, include A couple of points about the include statement before we go on. First, it has nothing to do with files. C programmers use a preprocessor directive called #include to insert the contents of one file into another during compilation. The Ruby include statement simply makes a reference to a named module. If that module is in a separate file, you must use require to drag that file in before using include. Second, a Ruby include does not simply c
<virunga>
opy the module's instance methods into the class. Instead, it makes a reference from the class to the included module. If multiple classes include that module, they'll all point to the same thing.
<virunga>
from ruby-doc
<virunga>
good for meta-programming i think
<geekbri>
ah i see.
<geekbri>
or at least i think i get it
albemuth has joined #ruby
adambeynon has joined #ruby
wmoxam has joined #ruby
<virunga>
u make a ninja wanna fuck bitch
waxjar has joined #ruby
albemuth has joined #ruby
rfloriano has joined #ruby
emmanuelux has joined #ruby
<geekbri>
Well i'm gonnna guess thats unrelated.
saurb has joined #ruby
shlevy has quit [#ruby]
<virunga>
:)
<virunga>
is there anyone from Canada?
<twixmix>
virunga: Absolutely.
Skaag_ has joined #ruby
<virunga>
twixmix, absolutely in english means absolutely yes or absolutely no?
<twixmix>
virunga: Yes, I meant yes.
<virunga>
in my language the former
<virunga>
ah ok
gabeh_ has joined #ruby
<virunga>
twixmix, is there in Canada penal servitude like in USA?
kp666 has joined #ruby
<virunga>
twixmix, do you work with ruby?
<twixmix>
virunga: Can't say I know if there's Penal Servitude or not.
<deryl>
yeah. do something stupid you end up in prison, and then get to work the road gangs
<twixmix>
virunga: And I do some ruby on the side, not for my day job though.
<virunga>
i thought Canada was a civil country...
<virunga>
:)
<deryl>
that is civil
<deryl>
absolutely nothing wrong with having prisoners repair roads, clean up trash, make license plates
BrianE has joined #ruby
<virunga>
constrain they to worl against their will..
<deryl>
you did something wrong, you got busted. you're doing time to pay back society for the stupidity you did. doing all that during your sentence is A) perfectly legal and B) how you pay back society. :shrug:
<deryl>
virunga: tough shit. net time tell them not to break the law and be so stupid
<deryl>
s/net/next/
Mosselman has joined #ruby
<Mosselman>
hi guys, I am getting a " `encode': "\xCC" on US-ASCII (Encoding::InvalidByteSequenceError) " error when I run: `find -L "#{path}" -type f ! -name '.*'`.encode('UTF-8').split("\n")
<deryl>
*excessive* abuse of a prisoner is wrong. using them without regard for sleep, pain, ect is wrong. Just because they're a prisoner doesn't mean you trat them like shit. However most countries treat their prisoner population like crap. the USA isn't the only one
sorin has joined #ruby
<Mosselman>
Before that I used to get errors about ASCII as well, but it was a different one.
<virunga>
deryl, my country is between them country
jds has joined #ruby
<virunga>
anyhow..
<deryl>
virunga: myriad of different ways to handle the troublemakers amongst us. Unfortunately, in order to handle that mass, the innocent sometimes get lost in that system. a system not designed *for* innocents.
emmanuelux has joined #ruby
<deryl>
yeah, anyhow ;)
<Mosselman>
It happens when it encounters files with names that include special chars.
emmanuelux has joined #ruby
jxpx777_ has joined #ruby
spanner has joined #ruby
senthil has joined #ruby
<virunga>
deryl, last thing: give a look at the servitude etymology
emmanuelux has joined #ruby
<virunga>
:D
<virunga>
but i understand yuor point of view
<deryl>
virunga: i spent most of my adult life in the military. Servitude was my mddle name :)
<deryl>
<grin>
jxpx777- has joined #ruby
jxpx777-_ has joined #ruby
<virunga>
:)
emmanuelux has joined #ruby
<shevy>
yeah even without "i"
<shevy>
only remember the necessary things :>
<deryl>
hehe
msuszczy has joined #ruby
moshee has joined #ruby
<deryl>
"There is no 'I' in TEAM, troops! Remember that!"
gregorg has joined #ruby
gregorg has joined #ruby
<deryl>
oh, and you quickly remove the word 'volunteer' from your vocabulary
<virunga>
:D
emmanuelux has joined #ruby
<deryl>
ok, time to walk the pooch, then come back to sit and stare aimlessly at the screen while I try to pull a few blog articles from my brain.
<deryl>
later
<virunga>
bye
kp666 has joined #ruby
DrShoggoth has joined #ruby
namidark[w] has joined #ruby
<Phlogistique>
Mosselman: if it's not guaranteed to be valid UTF-8 data, don't encode it in UTF-8
<Phlogistique>
or you will run into horrible nightmares
BrianE has joined #ruby
<Mosselman>
Phlogistique: what should I do then? Because this is breaking my app.
macabre has joined #ruby
<Phlogistique>
Mosselman: what do you want to do with your "find" results?
<Mosselman>
Is there a standard lib that will allow me to list all paths inside of a subfolder? Because that is basically what that thing is doing. But then in a way that WILL give me valid utf-8 nameS?
<Phlogistique>
Mosselman: Dir["*"] should be closer to what you're looking for
perturbedpanda has joined #ruby
<Tasser>
Mosselman, depends on your filesystem
<Mosselman>
I am using 'play' and app by github for playing music at the office. What the find command does is list all files inside of the specified folder (path) and then the script will split each new line and scan the audio file at every full path to a file and index it.
<Mosselman>
Phlogistique: thanks, I will look into that.
elliot_ has joined #ruby
<Mosselman>
Tasser: I am on unix, mac to be precise.
kp666 has joined #ruby
<Phlogistique>
Mosselman: then you don't need it to reencode it?
<Mosselman>
Phlogistique: well the problem was that before reencoding I would get errors when non ASCII files were found.
<Phlogistique>
(I can't give much more help without ranting)
<Phlogistique>
Mosselman: oh
<Mosselman>
even setting utf-8 everywhere in the app I could possibly think of didn't help
<Mosselman>
Phlogistique: I can take it ;), thanks for the help so far. I will dive into this some more.
bbttxu_ has joined #ruby
<Phlogistique>
that's Ruby 1.9 for you. Try setting everything to BINARY instead? (default external, default internal, and source code)
neurodrone has joined #ruby
neurodrone has joined #ruby
<Mosselman>
I will give that a try
nemesit has joined #ruby
emmanuelux has joined #ruby
TaTonka has joined #ruby
<Mosselman>
hmm no changes
<Phlogistique>
tbf, yesterday I was working on a quick & dirty web app of mine and used some Ruby 1.9 syntax in the process (keyword arguments). Just before saving the file, I felt cold sweat dropping in my back just thinking of how many ways it would fail if I ran it through Ruby 1.9; so I made it 1.8 compatible and ran it under 1.8.
kp666 has joined #ruby
BrianE has joined #ruby
dyer_ has joined #ruby
senthil has joined #ruby
sixdahs has joined #ruby
<Phlogistique>
Mosselman: could you provide a minimal failing exemple?
ph^ has joined #ruby
kp666 has joined #ruby
iocor has joined #ruby
<Mosselman>
as in the error I got back?
C0NNER has joined #ruby
<Phlogistique>
yes; a minimal exemple exhibiting your problem
etehtsea has joined #ruby
<Mosselman>
sure thing
<Mosselman>
hang on
emmanuelux has joined #ruby
emmanuel_ has joined #ruby
tsd_usa has joined #ruby
<Mosselman>
this is the file that executes the code, I have been messing around in it so it might look like shit sometimes
<Mosselman>
Phlogistique: thanks :) I will put that in
<Mosselman>
see what happens :)
<Phlogistique>
Mosselman: 1. Your file begins with coding: utf-8, therefore litteral strings are UTF8
<Phlogistique>
therefore "\n" in split("\n") is UTF8
<Phlogistique>
so split can only operate on UTF8 strings
<Mosselman>
yeah it should be
<Mosselman>
oh like that
<Mosselman>
hmm
<Mosselman>
I hate this encoding, too much of a noob
notjohn has joined #ruby
<Mosselman>
:)
<Mosselman>
I will give your snippet a try
kp666 has joined #ruby
mephux has joined #ruby
<Phlogistique>
my snippet is not what rubyist would advise, mind you; I just find 1.9's behaviour so horrible that I do that in order to get an as-naive-as-possible 1.8-like behaviour
<Mosselman>
Phlogistique: I want it to work first, then I'll see if I can get it 'pretty' later :).
<Mosselman>
I got further ahead though, now it is giving my mysql errors about collations, so I am getting closer :)
<Phlogistique>
Mosselman: by the way, you can avoid doing split("\n") by using String#to_a :)
<Mosselman>
Phlogistique: that might actually work better.
<Mosselman>
I didn't write that piece of code for getting all file names. The guys at github did.
<Mosselman>
doesn't mean they wrote it in the best way possible. kind of ugly even to do it like that if you ask me, instead of using default libs
<Phlogistique>
17:04:53 < Mosselman> Phlogistique: I want it to work first, <- I just helped you slipping the problem under the carpet; the program is still wrong
<Phlogistique>
but by asking Ruby to be naive, you can get it not to notice it.
chimkan_ has joined #ruby
blueadept has joined #ruby
<Mosselman>
Phlogistique: true, but that is how debugging sometimes goes
<Phlogistique>
yeah, the problem with Dir["**/.*"] is that it won't follow symlinks
<Mosselman>
There is also the 'File' class no?
<Phlogistique>
yeah but it doesn't provide a method for that
skitrees has joined #ruby
soulnafein has joined #ruby
sterNiX has joined #ruby
emmanuel_ has joined #ruby
<Mosselman>
`query': Mysql2::Error: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE)
fr0gprince_mac has joined #ruby
<Tasser>
Mosselman, looks like you need to reencode those data
<Mosselman>
yep
<Mosselman>
Tasser: just doing that, seems to work for now.
<Tasser>
#encode('utf-8') # =
TheShrew has joined #ruby
<Tasser>
Mosselman, why 'for now' - that's the correct way to do it
<Mosselman>
Tasser: because I have tried several possible solutions to this encoding problem, some more for a while and then another exception comes up. So I have learned not to trust it when I don't get errors the first time round.
skitrees has joined #ruby
<Mosselman>
Phlogistique: thanks for the help, it seems to be working now.
<Mosselman>
Tasser: what does "# =" do?
statarb3 has joined #ruby
emmanuelux has joined #ruby
alex__c2022 has joined #ruby
gvt has joined #ruby
Targen has joined #ruby
chimkan has joined #ruby
maxyz_ has joined #ruby
mayankkohaley has joined #ruby
<Tasser>
Mosselman, that was a comment (#) and should have been a ?
<Mosselman>
Tasser: haha sorry, got confused I am doing this: `find -L "#{path}" -type f ! -name '.*'`.encode('UTF-8').split("\n")
<Mosselman>
is that wrong?
dkannan has joined #ruby
tsd_usa has quit [#ruby]
<Tasser>
Mosselman, so you want all dotfiles?
hoelzro has joined #ruby
andrewhl has joined #ruby
blenny has joined #ruby
<Mosselman>
no just all files in all subfolders of {path}
emmanuelux has joined #ruby
Nathandim has joined #ruby
skitrees has joined #ruby
pdelgallego has joined #ruby
_srp has joined #ruby
Spockz` has joined #ruby
mikepack has joined #ruby
lkba has joined #ruby
graft has joined #ruby
spanner has joined #ruby
<graft>
okay, how do i replace all but the last occurence of a match?
<graft>
specifically if i have a string like "blah.blah.blah.ok.wut" I want to squash all the . except for the last one
enroxorz has joined #ruby
samsonjs has joined #ruby
senthil has joined #ruby
addisaden has joined #ruby
<virunga>
graft, a ugly idea is find the first match starting from the end and then search the matches in the substring from 0 to the point of the that match. This because i don't regular exp in Ruby
<theRoUS>
does anyone know of a way in ruby to extract the same information from an ssh pubkey file as 'ssh-keygen -l' does? namely, the encryption type, the fingerprint, and the number of bits? i can get the fingerprint all right, but the other parts are still stumping me..
spanner_ has joined #ruby
headius has joined #ruby
<virunga>
*know
<hoelzro>
graft: /\.([^.]+)\./?
cbuxton has joined #ruby
lkba has joined #ruby
<hoelzro>
hmm...actually you would have to invoke that multiple times...nevermind.
LnL has joined #ruby
<hoelzro>
you *could* extract everything up until the final dot, replace all of the matches in that prefix, and prepend to it to the original suffix
skitrees has joined #ruby
<graft>
this is the best i got: .sub(/(.*)(?=\.)/) { |m| $1.sub(/\./,"") }
<graft>
basically what you just said :)
ckrailo has joined #ruby
<graft>
theRoUS: why don't you just go read the ssh-keygen source?
fayimora has joined #ruby
jergason has joined #ruby
<theRoUS>
graft: haven't found it (haven't done more than a cursory search, though).
<theRoUS>
graft: was hoping it had already been done.
<ZenoArrow>
Hi all, quick question, should be straightforward to answer. Having problems with 'each_with_index'. Please see code here: http://pastie.org/3395622
<ZenoArrow>
Can anyone explain why it's not working for me? Even if you're not sure, I'm open to suggestions!
<JonnieCache>
i dont think the index does what you think it does
<ZenoArrow>
Okay, can you explain further?
<JonnieCache>
what should in your mind be happening with that code?
<JonnieCache>
i dont know hwat youre trying to do
ByteCrunch has joined #ruby
<ZenoArrow>
What I'd like is to print each array item, just like the top code does
<senthil>
ZenoArrow: include rowarray
<virunga>
ZenoArrow, Does that code run?
minijupe has joined #ruby
<JonnieCache>
ah ok well the index variable is a counter which increases with each iteration of the loop
enroxorz has joined #ruby
enroxorz has joined #ruby
<JonnieCache>
whereas the line does the same thing as it does in the top example
wedgeV has joined #ruby
<JonnieCache>
so if you wanted it to do the same thing you would just puts line like in the top one
<graft>
ZenoArrow: you just want rowarray[index] instead of line[index]
ZenoArrow_ has joined #ruby
<JonnieCache>
what youre doing is treating the each item in the array as if it were an array itself, using the [] syntax. what that does depends on whats in the array
<graft>
line is still the same as it is in the first loop, it's the actual array element, you're indexing into it instead of into the array
<graft>
yeah
Sliker has joined #ruby
<ZenoArrow_>
Sorry, lost connection, back now. What did I miss?
<graft>
heh
<graft>
ZenoArrow: you just want rowarray[index] instead of line[index]
<graft>
make sense?
<ZenoArrow_>
Let me explain...
enroxorz-work has quit [#ruby]
<ZenoArrow>
This code is just a test for using FasterCSV
<ZenoArrow>
As far as I know, I need to be able to add each array item individually, that's why I'm trying out each_with_index
stayarrr has joined #ruby
ph^ has joined #ruby
<ZenoArrow>
So, perhaps a better example would be, how do I print out all array items with index ID 5..9 ?
<Phlogistique>
ZenoArrow: array[5..9].each &:puts
<senthil>
rowarray[5...9]
<senthil>
ZenoArrow: add as in addition or add to another array
<ZenoArrow>
Phlogistique, senthil, yes I know that, but I can't hard code the indexes, it was just an example.
tommyvyo has joined #ruby
<ZenoArrow>
senthil, let me start from the beginning.
<graft>
a very good place to start
<ZenoArrow>
;-)
<Phlogistique>
ZenoArrow: here's a corrected version of your code http://sprunge.us/Baii
<ZenoArrow>
Let's say I have a CSV file with 25 lines. What I want to to is take that CSV file, look for a certain line of text in each line, write the lines that match to an array, then overwrite the CSV with the array contents (so that the only lines that remain are those that had the text I searched for). Does this help explain what I'm doing?
davidpk has joined #ruby
<Phlogistique>
yes, but you could do it in a much simpler way
<Phlogistique>
see Array\#select
<Afal>
or even not use ruby and just use grep on the command line
Mekkis has joined #ruby
<Phlogistique>
Afal: indeed
<senthil>
or ack
<hoelzro>
ack++
<Phlogistique>
or grep using ruby by doing ruby -ne 'print if ~/regex/'
<senthil>
what is ack++
<graft>
ZenoArrow: do you mean certain line by index, or certain line by match?
<ZenoArrow>
I'm definitely open for suggestions, whatever's easiest!
<hoelzro>
senthil: I'm just agreeing that ack is awesome =)
<Phlogistique>
ZenoArrow: easiest is just using grep
<senthil>
hoelzro: oh lol
voodoofish430 has joined #ruby
<graft>
i agree with Phlogistique it seems like you don't care about its CSV-ness at all
<graft>
and you can use Array.filter or some such
<graft>
err Array.map i guess
<ZenoArrow>
Phlogistique, tried your amendment, seems to work. Thanks. :-) However, now I'm interested in grep. So let's say I was looking for the text "_Opened_", how would I iterate through all .csv files in a folder and overwrite the files so that only the rows with that line of text was returned?
<graft>
can't keep my languages straight
danishkhan has joined #ruby
<Phlogistique>
ZenoArrow: for i in *.csv; grep -i 'that line of text' $i; done
<graft>
ZenoArrow: if you want in-place edits in the shell with sed or something, #ruby is probably not the place to ask
kenperkins has joined #ruby
davidcelis has joined #ruby
<Phlogistique>
wait, grep does not have in-place edit?
<graft>
i don't think so
<Phlogistique>
well
<graft>
grep is just regexp search, as it should be
<graft>
sed does in place edits though
<graft>
and also does regexp matching
<ZenoArrow>
Okay, I'll go digging into sed. Thanks for all of your help!
<graft>
probably easier in ruby tho
<graft>
with Dir.glob() and File.open
<Phlogistique>
then ruby -pe 'print if ~/regex/' -i file
<Phlogistique>
for i in *.csv; ruby -pe 'print if ~/regex/' -i $i; done
<graft>
that won't update the file for him tho
<Phlogistique>
yes it will
<graft>
oh -i i see
coucher has joined #ruby
yxhuvud has joined #ruby
<graft>
that seems pretty short and sweet
<ZenoArrow>
Will try that out now, thanks!
yopp has joined #ruby
jgrevich has joined #ruby
<Phlogistique>
well, except it's -ne, not -pe
kpshek has joined #ruby
<JonnieCache>
why use bash for loops with grep when you can just use the awesomeness of ack?
ieo has joined #ruby
<theRoUS>
JonnieCache: KeyManager doesn't want to deal with just-plain-.pub files, apparently.
<senthil>
Phlogistique: running "for i in *.rb; ruby -ne 'print if ~/Rails/' -i $i; done" - i get bash: syntax error near unexpected token `ruby'
* theRoUS
keeps snooping through net::ssh
<Phlogistique>
senthil: yeah, you're missing a "do"
<yopp>
anyone tried to build ruby on OSX 10.8 preview?
<Phlogistique>
for i in *.rb; do ruby -ne 'print if ~/Rails/' -i $i; done
<JonnieCache>
yopp: is the preview actually out?
SegFaultAX|work has joined #ruby
savage- has joined #ruby
<JonnieCache>
thought it was just an announcement
<yopp>
JonnieCache: yup, availiabe in mac dev center
<ZenoArrow>
Ah, I should've mentioned, I'm running Windows (I've got Linux installed though), sed and awk aren't available as far as I can tell.
<ZenoArrow>
Might have to wait until I get home.
fermion has joined #ruby
<JonnieCache>
i may abandon osx in favor of linux tbh. not happy at all about this signing bollocks
<yopp>
JonnieCache: you can disable it. but, anyway, someday they silently remove this feature :)
CacheMoney has joined #ruby
<JonnieCache>
i was really excited about smashing all my money on a new macbook pro when they come out, with their 15" retina displays and such.
ZenoArrow has quit [#ruby]
<JonnieCache>
dont care if you can disable it, its the default. thats bad enough
<yopp>
it's a geek-talk. regular users don't need to care about malware crap
badabim has joined #ruby
<yopp>
they want just to work, and code signing is good solution.
<senthil>
Phlogistique: oops, thanks
<JonnieCache>
yes and regular users wont be able to use software not sanctioned by the ghost of jobs
<JonnieCache>
we all know what its like trying to get apple to approve your code
samsonjs has joined #ruby
<JonnieCache>
how long before they deny keys to apps that compete with them like they do on the iphone?
<deryl>
they approve code for non pets?
<deryl>
:)
danishkhan has joined #ruby
mikepack has joined #ruby
<deryl>
(as in pet devs, not animals)
<JonnieCache>
they could easily have implemented a system of keys like apt uses, where anyone can have unlimited free keys which can then be revoked if an app is bad. instead they choose not to. the only possible reason for this is that they want to exert control in the future
C0NNER has quit [#ruby]
<Phlogistique>
ZenoArrow: well, yeah, or install cygwin; anyway, with ruby it isn't much harder: Dir["*.csv"].each {|f| l = File.readlines(f).select{|i| i=~/regex/}; File.open(l,'w') {|h|h.print l}}
maletor has joined #ruby
<hoelzro>
JonnieCache: that's the problem; it's not about what they *could* do, it's about what they *want* to do
<hoelzro>
which, in my opinion, is lock down your Macbook as tight as your iPad
<JonnieCache>
bascially they can fuck off and die. suggestions for high quality notebook hardware welcome to jonnie@cleverna.me
<deryl>
JonnieCache: when steve was alive he made no qualms about stating thats exactly what they were trying to do. only difference is apple's never admitted they were doing it to block competing apps.
* hoelzro
is a big fan of his new ThinkPad
<JonnieCache>
i am going to miss osx though
<hoelzro>
JonnieCache: hackintosh?
<JonnieCache>
i guess i can still use it at work
<deryl>
his reason was 'application quality'
<graft>
what is a retina display anyway?
<JonnieCache>
hoelzro: just because im not paying for it doesnt solve the moral problem
<hoelzro>
JonnieCache: ah
<JonnieCache>
graft: display with 10x the resolution of normal displays. basically the iphone screen
<JonnieCache>
means you have to have a resolution-indpeendent GUI.
<JonnieCache>
it may not actually be in the next macbook pros but its definitely coming
<graft>
must be expensive to have a 15" version of that
adeponte has joined #ruby
<JonnieCache>
the price will drop so much through when they start ordering those quantities
<JonnieCache>
remember when the price of NAND flash plummeted through the floor when the ipod nano came out?
<graft>
i wasn't paying attention...
MrGando has joined #ruby
<graft>
is that better for your eyes?
<JonnieCache>
no idea
<JonnieCache>
it certainly makes fonts easier to read
hooper_ has joined #ruby
<robacarp>
I doubt its better for your eyes
<robacarp>
staring at a streen is hard work regardless of what resolution
<robacarp>
but they look amazing
<davidcelis>
not better, not worse
<davidcelis>
its still looking at a screen
davidpk has joined #ruby
<davidcelis>
just a much sexier screen
<JonnieCache>
it might reduce the mental strain from reading a lot of text in some scenarios i guess
<graft>
well you don't have to worry about subpixel hinting and fuzzy lines and stuff like that
<robacarp>
JonnieCache: I could easily be convinced of that...my kindle epaper display is much easier to read
<graft>
although i guess it might mean 90% of the internet becomes wallet-sized
henrico has joined #ruby
<henrico>
anybody from california or NY here plz pvt-me
<robacarp>
graft: apple is smart enough to compensate for pixel density...unlike...well nevermind
<JonnieCache>
thats a good point, 90% of css uses px
daniel_hinojosa has joined #ruby
<davidcelis>
em
<Phlogistique>
JonnieCache: yeah but browsers support zooming while preserving proportions
<Phlogistique>
(because so much people use px)
<JonnieCache>
yeah true so they could just have it autozoom
tangledhelix has joined #ruby
<JonnieCache>
still itll inevitably be another massive compatibility headache for us web people
cloke has joined #ruby
soulnafein has quit [#ruby]
<henrico>
shall move to wheter california or NY i'm gathering information about thsese placies anyone who can help me here
Araxia has joined #ruby
<theRoUS>
JonnieCache: Net::SSH::KeyFactory.load_public_key(FILE) seems to be pretty close to what i want, but still not quite (just fyi)
<JonnieCache>
cool
phux has joined #ruby
<theRoUS>
JonnieCache: still looking for something that'll get me the type, the bits (size), the fingerprint, and the comment from the .pub file. i can so far get everything except the size in various ways
nowthatsamatt has quit [#ruby]
renanoronfle has joined #ruby
<JonnieCache>
cant you calculate the size manually?
<JonnieCache>
if you can get the actual key string then surely you can convert it to binary and get its size in bits
hobodave has joined #ruby
saurb has joined #ruby
TheTFEF has joined #ruby
TheTFEF has joined #ruby
<theRoUS>
JonnieCache: except for leading zeroes being dropped
Sum10Code has joined #ruby
<JonnieCache>
hmmm how do you mean
<JonnieCache>
where are they being dropped?
_john has joined #ruby
Knodi has joined #ruby
minijupe has joined #ruby
BBonifield has joined #ruby
lorandi has joined #ruby
MrGando has joined #ruby
sorin has joined #ruby
tommyvyo has joined #ruby
<robacarp>
sometimes I insert a debugger statement, refresh the page and start to get frustrated when its taking forever
adamkittelson has joined #ruby
saurb has joined #ruby
alfism has joined #ruby
flak has joined #ruby
patjoh_ has joined #ruby
robotmay has joined #ruby
chrxn has joined #ruby
mikepack has joined #ruby
emocake has joined #ruby
<senthil>
what's the cmd to output info about gist, is it !gist?
<robacarp>
I think only certain people are qualified to run !commands
<senthil>
ah man
<senthil>
i want to yell that ppl
<senthil>
*at
carlyle has joined #ruby
nfluxx has joined #ruby
rafa2000 has joined #ruby
eignerchris has joined #ruby
derailed_ has joined #ruby
<JonnieCache>
robacarp: yes and then you refresh the page like 10 times causing the requests to queue up for when you kill the debugger, then leading to more debuggers
<robacarp>
:-D
<JonnieCache>
it would be nice to use fibers to cause pry/rdebug to squirt html into the page when it fires
<JonnieCache>
would probably be a horrible mess to do that though
yopp has joined #ruby
csherin has joined #ruby
emocake has joined #ruby
marvin_ has joined #ruby
remink has joined #ruby
voodoofish430 has joined #ruby
Mosselman has joined #ruby
waxjar has joined #ruby
johnn has joined #ruby
cbuxton has joined #ruby
bluOxigen has joined #ruby
milkpost has joined #ruby
apok has joined #ruby
mikepack has joined #ruby
<apok>
matt: very strange, i get this error: ActionController::RoutingError (No route matches [GET] "/users/sign_in"):
<apok>
sorry wrong room
kidoz has joined #ruby
trivol has joined #ruby
svg__1 has joined #ruby
tvo has joined #ruby
Sailias_ has joined #ruby
<johnn>
rake question... i have some code to import a CSV table into an ActiveRecord model, this is not in rails (just ruby), how can i point to the 'environment' task so i don't get: "Don't know how to build task environment"? I'm not really sure where to look since i'm very unfamiliar with this
mickn has joined #ruby
<johnn>
right now i'm scrubbing data and it's getting to be too much to store in memory obviously, and i wrote the script in ruby--so i don't know if pure SQL would make more sense or not
<ElderFain>
theres two ways without sort, just apply the rest of your logic
<Guest37874>
ElderFain: why not just arr.max?
<Guest37874>
what index is for?
<ElderFain>
Guest37874: so you can pop it out
<ElderFain>
he doesn't need the max
<ElderFain>
he needs the alrgest ones
<ElderFain>
so pop out one, then pop out the next one, which is easy with the index
akemrir has joined #ruby
<rippa>
ElderFain: a.delete(a.max)
<ElderFain>
ElderFain: =p lots of ways to skin a cat =)
akemrir has joined #ruby
sterNiX has joined #ruby
mengu_ has joined #ruby
Silker has joined #ruby
akemrir has joined #ruby
Guest____ has joined #ruby
akemrir has joined #ruby
theRoUS has joined #ruby
dcarper_ has joined #ruby
berserkr has joined #ruby
luckman212 has joined #ruby
jergason has joined #ruby
baudehlo has joined #ruby
macmartine has joined #ruby
Liothen has joined #ruby
<baudehlo>
I'm trying to load thin (or mongrel) with rackup. Both gems are installed. But running "rackup -s thin" gives me: /opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/handler/thin.rb:1:in `require': cannot load such file -- thin (LoadError)
akemrir has joined #ruby
<baudehlo>
if I just do ruby -e 'require "thin"' it works fine. Anyone help me where to look to debug this?
fayimora has joined #ruby
jxpx777 has joined #ruby
<senthil>
baudehlo: are you using bundler?
<baudehlo>
senthil: I don't know much about ruby, am I?
<baudehlo>
we have a Gemfile.lock - is that where I need to look?
justinmcp has joined #ruby
<senthil>
baudehlo: that means you're using bundler
<senthil>
look into Gemfile (not Gemfile.lock)
<senthil>
see if there's thin in there, if not add to it like: gem 'thin'
<baudehlo>
k
<senthil>
then you'll need to get the gem: run "bundle install" in a terminal
<c_wraith>
rippa: right, finally found more complete documentation of break. Took me much longer than I expected
chimkan has joined #ruby
<rippa>
yeah, docs are somewhat lacking
<cesarstafe>
so, i guess that the clossest data that I got was Time.at((63496632219709/1000)+Time.new(0).to_i)
<cesarstafe>
* date
c_wraith has quit ["Leaving"]
<rippa>
cesarstafe: find offset experimentally and use that
<cesarstafe>
maybe differences in three hours are just localtime differences
<CannedCorn>
when creating documentation comments
<CannedCorn>
what is the second paramater to @param
minijupe has joined #ruby
<cesarstafe>
rippa: how do you say? .. try with offset for Time?
<senthil>
cesarstafe: one has -0500, another has -0300, so that's only two hours
<CannedCorn>
i'm having a really hard time trying to find the specifications for it
<senthil>
CannedCorn: in rdoc or yard?
<rippa>
cesarstafe: find how many ms you have to add/substract to get the right time
<cesarstafe>
senthil: yes, it's true
<rippa>
and use that
<cesarstafe>
ah
<cesarstafe>
ok
<cesarstafe>
understood
<CannedCorn>
yard
albemuth has joined #ruby
pingfloyd has joined #ruby
irakli has joined #ruby
Jay_Levitt has joined #ruby
senthil has quit [#ruby]
senthil has joined #ruby
Sum01Code has joined #ruby
gvt has joined #ruby
<cesarstafe>
many thanks people
<CannedCorn>
with yard how do you get an example text to stretch many lines
robotmay has joined #ruby
rossimatteo has joined #ruby
<rossimatteo>
room
badabim has joined #ruby
<CannedCorn>
hrm
<rossimatteo>
hi
clockwize has joined #ruby
td123 has joined #ruby
<CannedCorn>
that didn't work
rubyrobw has joined #ruby
<rubyrobw>
good evening everyone!
S2kx has joined #ruby
Ferdev has joined #ruby
<rubyrobw>
I would really appreciate it if someone could help me with some Rails basics
<rubyrobw>
I'm getting the following error: rake db:create Could not find gem 'rails (= 3.2.1) ruby' in any of the gem sources listed in your Gemfile. Run `bundle install` to install missing gems.
<rubyrobw>
I've already run 'bundle install'
<rubyrobw>
Any ideas?
cbuxton1 has joined #ruby
<rubyrobw>
Should I update my Gemfile? If yes, how?
hukl has joined #ruby
kpshek has joined #ruby
saurb1 has joined #ruby
<td123>
rubyrobw: use rvm to create an isolated environment
<rubyrobw>
any Rails pros out there?
<rubyrobw>
ok
<senthil>
rubyrobw: try #rails
<rubyrobw>
what's the process?
<td123>
rubyrobw: create a gemset, and never run gem update in it, only use bundle install to manage it
<td123>
rubyrobw: read the rvm docs for more info
<cesarstafe>
try to install rails 3.2.1 using 'gem install rails v=3.2.1'
<cesarstafe>
and run again bundle
<senthil>
rubyrobw: see if gem list rails returns the right gem or try "bundle update"
<rubyrobw>
I have installed the RVM
<rubyrobw>
bundle update didn't work
kirun has joined #ruby
<rubyrobw>
I'm running Ruby 1.9.2 and Rails 3.2.1
<senthil>
rubyrobw: bundle install --path vendor (it copies the gems into your vendor/)
jergason has joined #ruby
a_a_g has joined #ruby
senthil has quit [#ruby]
marvin_ has joined #ruby
senthil has joined #ruby
<rubyrobw>
senthil: I tried that that - thanks - and: bundle exec rake -T - No luck yet
<senthil>
do "bundle exec rake -T --trace" and paste that into gist
<rubyrobw>
This as well: bundle exec rake db:migrate
<rubyrobw>
gist? (apologies for my ignorance)
<senthil>
gist.github.com
henrico has joined #ruby
jamw has joined #ruby
Shamgar has joined #ruby
<rubyrobw>
I read somewhere that I should update my Gemfile?
<shajen>
i have in my controller sth like @all=Corporation.includes(:quotations)
stephenjudkins has joined #ruby
<shajen>
how can i include only 2 last quotations (order by date)
luckyruby has joined #ruby
<luckyruby>
what logging library does ruby on rails use?
havenn has joined #ruby
<rubyrobw>
zlib
fayimora has joined #ruby
<rubyrobw>
senthil: what do I do in github once the file has been generated?
<senthil>
rubyrobw: huh? i mean copy and paste the error you're getting into gist, so we can tell teh exact nature of it
sorin has joined #ruby
<tommylommykins>
hmm, is there any reason to prefer "@thing = initialize_thing unless defined? thing" or "@thing = initialize_thing" if thing.nil?
<tommylommykins>
Is there any functional difference?
chairabanta has joined #ruby
<Tasser>
tommylommykins, try @thing = nil
<tommylommykins>
...that attemps to put nil in @thing??
<tommylommykins>
oh, I misplaced the endquotes in the second example
<rubyrobw>
robwatt@robsvr:~/shorty$ rake db:create Could not find gem 'rails (= 3.2.1) ruby' in any of the gem sources listed in your Gemfile. Run `bundle install` to install missing gems.
<rubyrobw>
I've already run 'bundle install" and a few other variations
omahajoe has joined #ruby
<senthil>
rubyrobw: try it with rake --trace, that gist has no new info
<senthil>
rubyrobw: post you Gemfile and Gemfile.lock
marvin_ has joined #ruby
marvin_ has joined #ruby
marvin_ has joined #ruby
tommyvyo has joined #ruby
<rubyrobw>
senthil: not sure how to do that
QaDeS has joined #ruby
marvin_ has joined #ruby
oposomme has joined #ruby
Skaag has joined #ruby
phantasm66 has joined #ruby
adeponte_ has joined #ruby
oposomme has joined #ruby
justinmcp has joined #ruby
<senthil>
rubyrobw: open them in a text editor. copy and paste
imsplitbit has joined #ruby
oposomme has joined #ruby
headius has joined #ruby
mkscrg has joined #ruby
oposomme has joined #ruby
<rubyrobw>
source 'https://rubygems.org' gem 'rails', '3.2.1' # Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git' gem 'sqlite3' # Gems used only for assets and not required # in production environments by default. group :assets do gem 'sass-rails', '~> 3.2.3' gem 'coffee-rails', '~> 3.2.1' # See https://github.com/sstephenson/execjs#readme for more supported runtimes # gem 'therubyracer' gem 'uglifier', '>= 1.0.3' en
<senthil>
rubyrobw: please use gist for anything longer than 2 lines
bash` has quit ["Konversation terminated!"]
savage- has joined #ruby
<td123>
anyone know what the vendor_specific module is? there are some commands that check for it with ruby -r vendor-specific -e "print 'true'" but I don't seem to have it installed on my computer
<wroathe>
What's the best way to sort a histogram by key?
<wroathe>
I mean Hash
<wroathe>
Sorry
<wroathe>
(Effectively what I'm trying to sort is a histogram)
savage-_ has joined #ruby
dcarper has joined #ruby
<virunga>
wroathe, i think you can take the keys using the appropiate method then use sort of Array class or sort_by of Enumerable module
parzo has joined #ruby
shtirlic has joined #ruby
sythe has joined #ruby
llaskin has joined #ruby
<llaskin>
if I want to alternate a variable between true and false how would I do that?
<hoelzro>
llaskin: var = not var?
<heftig>
or "var = !var"
phantasm66 has joined #ruby
<heftig>
the former actually doesn't work
<senthil>
if i saw that, it would take me a good 10 secs to figure it out
<hoelzro>
that worked, but 'var = not var' did not
<shevy>
def toggle; @flag = ! @flag; end
<heftig>
var = (not var) works
bbttxu_ has joined #ruby
axl__ has joined #ruby
RubyRobW_ has joined #ruby
<shevy>
yay lisp!
<shevy>
var = ((not) var)
c0rn has joined #ruby
mengu_ has joined #ruby
mengu_ has joined #ruby
<td123>
can anyone on a non-archlinux distro run ruby -r vendor-specific -e "print 'true'"
<td123>
also with ruby 1.9
justinmcp has joined #ruby
stephenjudkins has joined #ruby
_john has joined #ruby
<td123>
on arch that errors out
<shevy>
ruby: no such file to load -- vendor-specific (LoadError)
<heftig>
shevy: that's on?
llaskin has quit [#ruby]
Indian has joined #ruby
dyer has joined #ruby
dyer has joined #ruby
kpshek has joined #ruby
<shevy>
hmm
matthias_ has joined #ruby
s0ber has joined #ruby
y3llow has joined #ruby
canton7 has joined #ruby
fr0gprince_mac has joined #ruby
y3llow has joined #ruby
cbuxton has joined #ruby
MrGando_ has joined #ruby
tommyvyo has joined #ruby
y3llow has joined #ruby
alanp has joined #ruby
denom has joined #ruby
zomgbie has joined #ruby
<robert_>
shevy: HAIII. :D
Skaag has joined #ruby
senthil has quit [#ruby]
andrewhl has joined #ruby
R3dy has joined #ruby
<R3dy>
is there a way for socker.recv to have an unlimited amount
<R3dy>
so no mater how big the result is it will still store it
<shevy>
hey robert_
<robert_>
how's it going? :D
<robert_>
shevy: I'm trying to .to_s a string and use it to look up something in a hash, but it's not workeeeeng. D:
<shevy>
robert_ I am lately wondering why I have so much complexity in my scripts
<robert_>
I see.
<robert_>
e.g. record["Xyzzy".to_s]
<robert_>
but it doesn't wanna seem to work. :/
<shevy>
"Xyzzy".to_s is useless
<shevy>
it is already a string so why invoke #to_s again
<shevy>
record[] seems to be a hash, it most likely has no key called like that. do require 'pp'; pp record
rushed has joined #ruby
burgestrand has joined #ruby
<R3dy>
how do you loop through sock.recv while sock.recv has data to recieve?
denom has joined #ruby
hooper_ has joined #ruby
<R3dy>
is socket programming to complicated for people here?
jwang has joined #ruby
BrokenCog has joined #ruby
pingfloyd has joined #ruby
zulax has joined #ruby
pingfloyd has quit [#ruby]
pingfloyd has joined #ruby
Synthead has joined #ruby
<shevy>
dunno
<shevy>
I myself never had to do it
matthias2 has joined #ruby
v0yager_ has joined #ruby
<luckyruby>
i'm using the daemons gem. Is there a way to start up a daemon in the context of bundler?
<luckyruby>
I tried bundle exec ruby mydaemon start. didn't seem to work
<td123>
shevy: which distro did you run that on?
burgestrand has joined #ruby
badelat has joined #ruby
twixmix has quit [#ruby]
<shevy>
td123 hmm knoppix (debian) but all my ruby comes from the source
<td123>
shevy: thanks
nowthatsamatt has joined #ruby
startling has joined #ruby
designated has joined #ruby
crankycoder has joined #ruby
jergason has joined #ruby
tim_sharman has joined #ruby
<designated>
I'm reading "Programming Ruby 1.9" by Dave Thomas and he mentions using ri ClassName to get more information regarding classes but it doesn't seem to be working the way he explains it. As an example he uses ri assoc but when I type this I get "Nothing known about .assoc" Any suggestions?
<designated>
I'm running ruby 1.9.3p125
startling has joined #ruby
<deryl>
if you are running RVM, run rvm docs generate
KDiddy has joined #ruby
iocor has joined #ruby
tim_sharman has quit [#ruby]
<burgestrand>
designated: ^
<deryl>
the full docs aren't usually generated just to save space, but that command under any given ruby RVM controls will build and install the standard docs
emocake has joined #ruby
<designated>
deryl, thank you very much
<deryl>
np
momo_ has joined #ruby
<designated>
I'm guessing ruby is not multi threaded considering it currently has 1 of 8 cores @ 100%
<burgestrand>
designated: CRuby is multi-threaded but has a GIL, which means only one thread of Ruby runs at any given moment
<burgestrand>
designated: JRuby and Rubinius however do not have a GIL
<epochwolf|vps>
designated: mri can only use one core at a time per process due to GIL
ipoval has joined #ruby
<burgestrand>
or, well, rubinius 1.x has, not 2.x
tsharman has joined #ruby
badelat has joined #ruby
<designated>
burgestrand, epochwolf|vps, thank you
tsharman has joined #ruby
* Hanmac
is porting not thread-safe libs ... so it does not realy matter if my gem is not thread safe
redgetan has joined #ruby
chrxn_ has joined #ruby
badabim_ has joined #ruby
raluxgaza has joined #ruby
eka has joined #ruby
<Tasser>
Hanmac, on jruby, it does
nowthatsamatt has quit [#ruby]
stringoO has joined #ruby
<Hanmac>
currently i does not have seen any good tutorial how to make thread-safe gems in c ... i mean my methods are like return DBL2NUM(_self->getRed()); ... where should the ruby-thread functions go?
mxweas_ has joined #ruby
<shevy>
robert_ I tell you ... complexity is the root of all evil
<shevy>
if I ever make a programming language, I make it so SIMPLE that every idiot can use it and that the only valid code that works is SIMPLE TERSE and BEAUTIFUL
Axsuul has joined #ruby
stephans has joined #ruby
<robert_>
hah, yeah.
<nlew>
would that it were so easy
<shevy>
nlew well, you have to cut down on some things
ryannielson has joined #ruby
<shevy>
it wouldn't be as feature rich as ruby for sure
davidpk has joined #ruby
<BrokenCog>
the first compiler writer thought that was what he created, having been assembling previously.
<nlew>
there's a trade-off between features and expressiveness though
tommyvyo has joined #ruby
<shevy>
sure but I am getting confused about the simple things too
<shevy>
- should I turn this method into a class or not
<shevy>
- should I use methods in the first place or just write everything without classes and methods
<shevy>
and then I have to think about whether I need a specific feature or not
kevinbond has joined #ruby
<msch>
for debugging purporses i'd like to add a file to $LOADED_FEATURES so that it doesn't get required. is there a method that performs the same file lookup that Kernel.require does?
<msch>
e.g. i want to do $LOADED_FEATURES << Kernel.find_file_to_require 'some/file'
yopp has joined #ruby
<Hanmac>
Tasser: do you have a tutorial howto write threadsafe ruby-gems if the ported lib is not thread safe?
<Tasser>
Hanmac, define lib
<Hanmac>
libs like CEGUI, OGRE3D, or wx
statarb3 has joined #ruby
booginga has joined #ruby
<nlew>
msch: Why do you need that? $LOADED_FEATURES should just contain the string you passed to require, not the file that was actually loaded.
<msch>
nlew: in 1.9.3 it definitly contains the file that's actually been loaded
<nlew>
:O
dcarper has joined #ruby
<nlew>
Well so it does.. huh..
<msch>
nlew: our app has a rails-like script/console and i'm the only dev in the team that wants to use pry instead of irb. so i negotiated that we'll have a require './local_environement.rb' if File.exist? './local_environment.rb' and i want to stub out "require 'irb'" in there
ixti has joined #ruby
havenn has joined #ruby
Evixion has joined #ruby
havenn has joined #ruby
pen has joined #ruby
EddieS has joined #ruby
<nlew>
I can't find anything that exposes that behavior
<nlew>
you might look at rubinius, which has it all in ruby and broken into several methods
<startling>
I want to inherit from a class that defines the method `initialize`. I want to make it take another argument on instantiating. How do I do that and still call the parent's `initialize`?
<Hanmac>
startling: super
conor_ireland has joined #ruby
conor_ireland has joined #ruby
drewrm has joined #ruby
<shevy>
superduper
dju has joined #ruby
ests has joined #ruby
<startling>
Hanmac: super(initialize) evidently calls the method it's in; i get a `stack level too deep (SystemStackError)`.
<ests>
Good evening. Is anyone here attending wroc_love.rb conference?
linoj__ has joined #ruby
<burgestrand>
startling: just super
<burgestrand>
startling: or super() if you want to pass no args
<burgestrand>
startling: or super(args) if you want to pass your own args
stephenjudkins has joined #ruby
carlyle has joined #ruby
<startling>
burgestrand: ah, thanks.
<burgestrand>
startling: super(initialize) will call super with the parameter of whatever the initialize-method returns, which in turn calls super with the parameter of whatever the initialize-method returns, which in turn…
<startling>
yeah. I'm used to how python does it, I guess, which is `parent.__init__(self...)`
<burgestrand>
:)
<Hanmac>
and if you want to be on the safe side you can check with "defined(super)" if supercall is possible
<burgestrand>
super is very similar to just another method call, with the difference that if you pass no arguments and no parentheses it’ll pass the arguments given to the current method
<startling>
Hanmac: when wouldn't it be?
<Hanmac>
if you does not know if the parent method exist
<startling>
ah, okay. i think it always will in this instance, but that's good to know
jeffmjack has joined #ruby
krisfremen has joined #ruby
nari has joined #ruby
<startling>
what's the difference between MyModule::thing and MyModule.thing?
c0rn has joined #ruby
<shevy>
the latter is nicer
<shevy>
and you save one char
<shevy>
also, it's more often used
<shevy>
people usually do something like
ests has quit [#ruby]
<shevy>
Foobar::SOME_CONSTANT_HERE
<startling>
oh, so it does the same thing?
<shevy>
Foobar.kill('startling')
<shevy>
hmm kinda ... but they don't tend to be used in the same way. the :: is used to denote scoping
<shevy>
you can do
<shevy>
::FOOBAR
<shevy>
sometimes
<shevy>
you can never do
<shevy>
.foobar
<shevy>
unless you have an object before that line
chimkan_ has joined #ruby
<shevy>
in ruby code out there you often see something like
<shevy>
my_object = FooBar::SomeClass.new
<shevy>
my_object.thing
<shevy>
hmm
<shevy>
my_object::thing would be really ugly
c0rn has joined #ruby
<startling>
heh, alright.
saurb has joined #ruby
carlyle has joined #ruby
CacheMoney has joined #ruby
cbuxton has joined #ruby
v0yager has joined #ruby
<CacheMoney>
I have an array of strings http://pastie.org/3397791 that I want to remove the spaces between the numbers and save just the numbers to either a hash or an array. Any advice?
matthias2 has joined #ruby
kpshek has joined #ruby
chrxn_ has joined #ruby
<shevy>
you want to ...
<shevy>
get rid of all spaces? .gsub(/ /,'')
v0yager has joined #ruby
<CacheMoney>
i want to remove the spaces and then save them as ints
<shevy>
arr.map! {|x| x.gsub(/ /,'') }
<shevy>
.to_i
<CacheMoney>
shevy: thanks. thats a lot easier than what i was trying to do
<shevy>
but note that "1 1 1 1 1 1 1 1 1 1 1 1" will become a 111111111111 Fixnum
<CacheMoney>
hmmm... I'd like it to be [1, 1, 1, 1, 1, 1]
<jason_rad>
How do I print / list out all methods to a certain class? something like puts class.methods is what I'm looking for
<shevy>
object.methods.sort
<shevy>
Class.new.methods.sort
<shevy>
should work too, where Class is the name
minijupe has joined #ruby
<CacheMoney>
shevy: this is what you recommend arr.map!{|x| x.split(' ').map{|x| x.to_i}}. It's a lot cleaner than the approach I was taking... appreciate it
<jason_rad>
shevy: thank you
<shevy>
CacheMoney I am usually happy with the first solution that works
<shevy>
I just have no patience to be too creative
<shevy>
I like it when things stay small, simple, terse and not complicated
<ests>
Is #tap available in Ruby 1.8.7?
<CacheMoney>
i agree but because i'm pretty new to programming it's hard sometimes to not get caught in the weeds. Thanks again
<shevy>
ests dont think so
albemuth has joined #ruby
Helius has joined #ruby
<banister`sleep>
shajen: hey marcu
<banister`sleep>
shevy: marcus*
<banister`sleep>
jason_rad: i think u want Class.instance_methods
<jason_rad>
I'm getting a lot more information than I need. Basically I just want to print out all the "defined methods" i've created in my class