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/
heftig_ joined #ruby
tomzx joined #ruby
<Lann> burgestrand: what do you mean by encoding awareness?
<Lann> like ruby 1.8.7 cannot handle double byte characters?
tayy joined #ruby
<subr00t> gn8
otakutomo joined #ruby
heftig joined #ruby
RomD` joined #ruby
albemuth joined #ruby
austinbv_ joined #ruby
Guest78465 joined #ruby
Axs joined #ruby
Draco__ joined #ruby
MasterIdler joined #ruby
tomzx_ joined #ruby
ali_h_ joined #ruby
adeponte_ joined #ruby
pen_isident joined #ruby
rob125 joined #ruby
fcoury joined #ruby
RomD joined #ruby
randym joined #ruby
replore_ joined #ruby
otakutomo joined #ruby
sean_m joined #ruby
eywu joined #ruby
Indian joined #ruby
Indian joined #ruby
mgualt joined #ruby
ephemerian left #ruby
mxweas_ joined #ruby
otakutomo joined #ruby
h4mz1d joined #ruby
TheNumb_ joined #ruby
mindCrime_ joined #ruby
MasterIdler_ joined #ruby
milkpost_ joined #ruby
MasterIdler_ joined #ruby
nerded joined #ruby
notjohn joined #ruby
Backsorry joined #ruby
amacgregor joined #ruby
MasterIdler_ joined #ruby
travisjeffery joined #ruby
door1602 left #ruby
austinbv joined #ruby
flip_digits joined #ruby
bwlang joined #ruby
milkpost_ joined #ruby
rsampaio joined #ruby
mxweas_ joined #ruby
Draco_ joined #ruby
ablemike joined #ruby
Draco_ joined #ruby
yfeldblum joined #ruby
ablemike left #ruby
hasrb joined #ruby
minijupe joined #ruby
badabim joined #ruby
gentz joined #ruby
jwmann joined #ruby
adelcampo joined #ruby
otakutomo joined #ruby
badabim joined #ruby
<aces1up> how do i create a regexp.new from string that included /m ???
pen joined #ruby
<aces1up> Regexp::MULTILINE do i need to use that in the options?
<samuelkadolph> aces1up: Yes
pencilcheck joined #ruby
baroquebobcat joined #ruby
wyhaines joined #ruby
dbgster joined #ruby
nari_ joined #ruby
tomzx joined #ruby
tdubellz left #ruby
tdubellz joined #ruby
dotnull joined #ruby
jfredett joined #ruby
<tdubellz> |^j0ng^Il: can you cut it out?
pen joined #ruby
<tdubellz> !ops if you're there |^j0ng^Il is spamming on join via /msg
otakutomo joined #ruby
robyurkowski joined #ruby
mikeric joined #ruby
mikeric left #ruby
amacgregor_ joined #ruby
rboyd joined #ruby
nari joined #ruby
cbuxton joined #ruby
luckyruby joined #ruby
Squee-D joined #ruby
roaminghorse joined #ruby
austinbv joined #ruby
Banistertab joined #ruby
hasrb joined #ruby
Draco_ joined #ruby
fatguylaughing joined #ruby
artOfWar_ joined #ruby
nyrb joined #ruby
nerded joined #ruby
albemuth joined #ruby
deryl left #ruby
deryl joined #ruby
hasrb joined #ruby
Draco_ joined #ruby
jfredett joined #ruby
otakutomo joined #ruby
<SolarisBoy> oh thats what was... meh
moshee joined #ruby
moshee joined #ruby
__class__ joined #ruby
pen_isident joined #ruby
lobo_d_b joined #ruby
lobo_d_b joined #ruby
pencilcheck joined #ruby
banisterfiend joined #ruby
vitoravelino joined #ruby
vitoravelino joined #ruby
tomzx joined #ruby
libertyprime joined #ruby
sdwrage joined #ruby
jay_zawrotny joined #ruby
minijupe joined #ruby
adeponte joined #ruby
epitron_ joined #ruby
epitron_ joined #ruby
otakutomo joined #ruby
notjohn joined #ruby
tshauck joined #ruby
iamjarvo joined #ruby
mxweas_ joined #ruby
satyavvd joined #ruby
BrokenCog joined #ruby
aef joined #ruby
mgualt joined #ruby
otakutomo joined #ruby
hasrb joined #ruby
Draco_ joined #ruby
fixl joined #ruby
rboyd joined #ruby
pen joined #ruby
nari_ joined #ruby
Evixion joined #ruby
p0y joined #ruby
jwill joined #ruby
jfredett joined #ruby
dankest joined #ruby
dotnull joined #ruby
nari_ joined #ruby
austinbv joined #ruby
albemuth joined #ruby
ryanf joined #ruby
<mitchty> Ok dumb challenge to see what everyone else comes up with for a one liner https://gist.github.com/1384831
adamkittelson joined #ruby
<mitchty> I threw in what I came up with, its... hacky
Hachima joined #ruby
mindCrime_ joined #ruby
Draco_ joined #ruby
richo joined #ruby
<richo> Is there a cleaner way to do arrayInstance.map!{ |v| v.nil? ? [] : v } # I'm replacing nil's with []
gregorz joined #ruby
gregorz left #ruby
<mitchty> richo: array.map/collect! {|x| Array(x)} would be my solution
<mitchty> then again i don't know what v is so its an assumption
<richo> mitchty: is there overhead with Creating a stack of new arrays though? Some of them are potentially really big
<richo> Oh sorry, arrayInstances is an array of potentially huge arrays
<mitchty> richo: never tried it on huge arrays, profile it
<richo> Will do. Thanks :)
<mitchty> richo: but, and I can't entirely recall for 100% certainty, but I thought Array() just leaves its input as an array, otherwise it creates a new array with that as first element
<mitchty> richo: and if input is nil empty array, https://gist.github.com/1384856 my pry session seems to confirm
<richo> perfect, thanks very much :)
<mitchty> i'd test it in either case, but the core Kernel methods use Array() lots
<richo> I just profiled it for my usecase * 10
<richo> no appreciable difference
x0F__ joined #ruby
<mitchty> i'd stick with Array(), its cleaner, also avoids nil entirely
<richo> yeah, I just updated my implementation
<mitchty> even if it manages to get inside, its gets arrayed
monkey13_ joined #ruby
<richo> more importantly, if some fool breaks the other endpoint and it starts returning Fixnums instead of arrays or whatever
<richo> it'll do it's best to make sane data
<mitchty> well its as sane as what you send to it
<richo> it pulls from an API developed in house but not by my team
<mitchty> so spooky action at a distance, got it
Y_Ichiro joined #ruby
airhorns joined #ruby
notjohn joined #ruby
Nisstyre joined #ruby
flip_digits joined #ruby
pen joined #ruby
Indian joined #ruby
acts_as_david joined #ruby
dot_null joined #ruby
mikeric joined #ruby
parus joined #ruby
adurity joined #ruby
sdavis1 joined #ruby
otakutomo joined #ruby
syamajala joined #ruby
ryanf joined #ruby
macmartine joined #ruby
maggie_n joined #ruby
savage- joined #ruby
Draco_ joined #ruby
Banistertab joined #ruby
manizzle joined #ruby
vitoravelino joined #ruby
Banistertab` joined #ruby
banisterfiend joined #ruby
<austinbv> say you have a dir structure like this https://gist.github.com/1384931 what require do you put in your spec_helper to test first_class.rb
<austinbv> and does first class need to be in a module?
<austinbv> oh it has to be in a dir called lib
<austinbv> why's that?
radic joined #ruby
zodiak joined #ruby
randym_ joined #ruby
mrevil joined #ruby
rsampaio joined #ruby
krz joined #ruby
<mrevil> is it possible to do ML or python style unwrapping with block parameters? EX: [[1,2]].map { | [a, b] | a+b } in this example each element of the list is an array with two elements, I want to ?unwrap? the array passed to the block without having to explicitly: [[1,2]].map { | x | x.first + x.last }
<mrevil> you see this in ML pattern matching, and you can do it in python parameters
brownies joined #ruby
<brownies> hmmmm
<brownies> how do you guys keep the asset pipeline straight between staging and production? (on rails)
<brownies> i have a pretty reasonable git branching model otherwise, but that damn asset pipeline...
<mrevil> i .gitignore public/assets then when I commit to my production branch I regenerate the assets with RAILS_ENV=production and force commit, but I have no idea whether or not it's correct. it's sorta a PITA
<banisterfiend> mrevil: yeah
<banisterfiend> mrevil: [[1,2]].map { |a, b| a + b }
<brownies> yea it is a pita
<mrevil> oh, lemme try that brb....
<brownies> the thing is that the staging environment is set up the same as production (obviously), which means it looks for precompiled assets as well
<brownies> so if i recompile... push to staging... then checkout master and try to merge... terrible things happen.
<brownies> s/master/production/
<banisterfiend> brownies: maybe you'd get more help on #rubyonrails
<brownies> i
<brownies> i'll give it a shot, but in my experience #ror is all assholes.
<banisterfiend> brownies: i think there's a few chans, maybe #railsbridge too
<banisterfiend> not sure
steph021 joined #ruby
wyhaines joined #ruby
GreaseMonkey joined #ruby
<banisterfiend> mrevil: it's actually even more advanced that that, check this out: a, (b, c), d = [1, [2, 3], 4]
<banisterfiend> a -> 1, b -> 2, c -> 3, d -> 4
austinbv joined #ruby
<banisterfiend> mrevil: you can nest () to destructure deeply nested data structures
ryanf joined #ruby
<mrevil> sweet. got it, just restricted it and all my tests pass
<shevy> hey
<mrevil> thanks
<shevy> can I also nest () or nest ()
<mrevil> i'll check out nest too
<shevy> Enter the Lisp!
<mrevil> i love list and ML
<mrevil> lisp
<shevy> eww!
<shevy> (why(do(you(love(lisp(man
<richo> seriously?
<richo> How do you /not/ love lisp
<shevy> <It<is<like<XML<but<uses<something<different
<mrevil> i love functional programming�. not starting a flame war or anything i just do
<richo> actually it's nothing like xml :/
<mrevil> you just get used to it, and you learn to think in that style
<shevy> (so(is(it(more(like(LSD?
<mitchty> the thing i find most amusing is people complaining about the parens, because foo() is worse than (foo )
<shevy> yeah, every programming language wants you to think within its pattern and style
<mitchty> err other way around, screw it i'm going to bed
<richo> shevy: it's trivial to do lisp using indenting instead of parens with a preprocessor
<shevy> cool
<shevy> (
<shevy> (hello
<shevy> (from
<shevy> (lisp
<mrevil> brownies: I always recompile assets in master first, then merge to staging. if staging is ok then I'll merge master or staging into production
mxweas_ joined #ruby
<brownies> yea but that would mean merging the latest version of my code into production *before* staging... which seems a bit backwards.
<brownies> i get that you're still deploying to staging first, but still.
<mrevil> you can merge from staging to production and everything will work cleanly
<mrevil> you just don't want to regenerate assets in multiple branches and try to merge, you just need to pick one way and stick to it
otakutomo joined #ruby
<mitchty> so i'm a rails nub (read don't use it), but couldn't you make an assets branch that you update and then merge that to staging/prod/master as needed?
dhruvasagar joined #ruby
Banistertab joined #ruby
AllStruck joined #ruby
banister_ joined #ruby
alanp joined #ruby
Mchl joined #ruby
ryanf joined #ruby
dhruvasagar joined #ruby
apeiros_ joined #ruby
ryanf joined #ruby
ksinkar joined #ruby
Banistertab` joined #ruby
Indian joined #ruby
artOfWar joined #ruby
austinbv joined #ruby
jhunter joined #ruby
davidedwardclark joined #ruby
dhruvasagar joined #ruby
amvishnu joined #ruby
davidedwardclark left #ruby
tomzx joined #ruby
<amvishnu> bundler problem
hasrb joined #ruby
jhunter joined #ruby
cosmikduster joined #ruby
<cosmikduster> Rubyspec is failing spectacularly for me using ruby-1.8.7-p352: http://pastie.org/2901852 . Can anyone tell why?
<ryanf> are you sure it's supposed to pass?
<ryanf> it's normal behavior in 1.8 for UnboundMethod#name to return a string instead of a symbol
<cosmikduster> I'm not sure. I doubt Rubyspec would fail with 37 failures, 194 errors on 1.8.7.
yxhuvud joined #ruby
<cosmikduster> What am I doing wrong?
<ryanf> maybe you are accidentally invoking the 1.9 version of the spec somehow
vitoravelino joined #ruby
vitoravelino joined #ruby
pen joined #ruby
gayasentinel joined #ruby
bluOxigen joined #ruby
sdwrage joined #ruby
pencilcheck joined #ruby
mrpanda joined #ruby
StitchedKite joined #ruby
banisterfiend joined #ruby
jwang joined #ruby
p1d joined #ruby
kawa_xxx joined #ruby
kawa_xxx joined #ruby
crescendo joined #ruby
EddieBluh joined #ruby
djdb joined #ruby
smgt joined #ruby
kawa_xxx joined #ruby
banisterfiend joined #ruby
ChampS_ joined #ruby
kawa_xxx joined #ruby
apeiros_ joined #ruby
workmad3 joined #ruby
stoffus joined #ruby
onisen_ joined #ruby
Backsorry joined #ruby
AllStruck joined #ruby
mafolz joined #ruby
nanoyak joined #ruby
Backsorry joined #ruby
beseku joined #ruby
Maya-PSK joined #ruby
Ilithya joined #ruby
ckrailo joined #ruby
pen joined #ruby
Morkel joined #ruby
batlock666 joined #ruby
zommi joined #ruby
krz joined #ruby
sayem joined #ruby
furrykef joined #ruby
workmad3_ joined #ruby
pi3r joined #ruby
<furrykef> If I do "module Foo def bar ... end end" (as opposed to "def self.bar"), what happens to bar? It doesn't seem to be usable either inside or outside the module.
<ryanf> furrykef: you need to include the module in something
vitoravelino joined #ruby
jwmann joined #ruby
<mrpanda> furrykef: include your module in class, and object of that class will inherit method bar
<furrykef> Ah. I'm just using a module as a namespace.
<furrykef> Not very successfully, it seems. If I define a class, I can't seem to use the methods at the top level of the namespace without specifying the namespace's name.
<furrykef> From within that class's methods, I mean.
thecreators joined #ruby
Spockz_ joined #ruby
Helius joined #ruby
Ch4rAzZz joined #ruby
frerich joined #ruby
frerich joined #ruby
Seisatsu joined #ruby
cosmikduster left #ruby
sooli joined #ruby
petschbot joined #ruby
statarb3 joined #ruby
statarb3 joined #ruby
flippingbits joined #ruby
vitoravelino joined #ruby
vitoravelino joined #ruby
trivol joined #ruby
gayasentinel joined #ruby
alup joined #ruby
sdwrage left #ruby
moshee joined #ruby
moshee joined #ruby
cyri_ joined #ruby
james_cotterill joined #ruby
steakknife joined #ruby
BiHi joined #ruby
<steakknife> I'm evaluating Ruby code obsfucators. Are there any obvious limitations such as code regeneration from in-memory objects?
mxweas_ joined #ruby
LittleBill902 joined #ruby
<steakknife> Interesting comments on ruby forum on this topic btw.
nicoulaj joined #ruby
minijupe joined #ruby
thecreators joined #ruby
fermo joined #ruby
xpot joined #ruby
kawa_xxx joined #ruby
r0bby joined #ruby
ephemerian joined #ruby
thecreators joined #ruby
steakknife left #ruby
ammar01 joined #ruby
NuclearLucifer joined #ruby
<NuclearLucifer> 'lo
timonv joined #ruby
hemanth joined #ruby
jbpros joined #ruby
Backsorry joined #ruby
robyurkowski joined #ruby
pabloh joined #ruby
roaminghorse joined #ruby
<kke> hmm, highline prints #<HighLine::Question 0x43987342798234> before each question
kassien joined #ruby
Pip joined #ruby
Pip joined #ruby
omry joined #ruby
kassien joined #ruby
drPoggs joined #ruby
danielpunt joined #ruby
petschbot_ joined #ruby
kassien joined #ruby
kassien joined #ruby
banisterfiend joined #ruby
kawa_xxx_ joined #ruby
mindCrime_ joined #ruby
randym joined #ruby
robyurkowski joined #ruby
EddieS joined #ruby
tatsuya_o joined #ruby
ultraviolet joined #ruby
hurikhan|Work joined #ruby
davids joined #ruby
mengu joined #ruby
<furrykef> http://pastebin.ca/2094231 -- so I wrote this module to parse a mini-language to transform strings. It works on strings like "I want to [foo] a [bar] with a {baz|quux}", where [foo] means "replace this with a randomly chosen string found under the rule named 'foo'", and {baz|quux} means "randomly return one of baz or quux". Basically it's a text generation system.
<furrykef> Though the code seems to work well, I don't like it very much. The code for the Processor class seems awkward.
a_a_g joined #ruby
<furrykef> The Processor class was originally a single function, but I wanted to keep state like string position so I don't have to bend over too much when I delegate things to other functions.
jensn joined #ruby
<furrykef> But I kinda don't like keeping track of the string position this way. If I forget a @pos += 1 somewhere, for instance, my code will get stuck in an infinite loop.
<furrykef> Is there a better way to write this kind of system?
RomD joined #ruby
heftig joined #ruby
szallol_ joined #ruby
szallol joined #ruby
szallol__ joined #ruby
robyurkowski joined #ruby
ChampS_ joined #ruby
sandstrom joined #ruby
banisterfiend joined #ruby
ramusara joined #ruby
pen joined #ruby
Seisatsu joined #ruby
jensn_ joined #ruby
justinmcp joined #ruby
Cluster444 joined #ruby
vitoravelino joined #ruby
randym joined #ruby
Guedes joined #ruby
kawa_xxx joined #ruby
LouisJB joined #ruby
clockwize joined #ruby
Cluster2 joined #ruby
ksinkar joined #ruby
Cluster left #ruby
wang joined #ruby
iocor joined #ruby
mxweas_ joined #ruby
mxweas_ joined #ruby
vitoravelino joined #ruby
vitoravelino joined #ruby
emocakes joined #ruby
Paladin joined #ruby
maasha joined #ruby
nanoyak joined #ruby
__Genji_Richmond joined #ruby
fermion joined #ruby
dfamorato_ joined #ruby
workmad3 joined #ruby
justinmcp joined #ruby
vitoravelino joined #ruby
vitoravelino joined #ruby
Spockz joined #ruby
alup joined #ruby
bier joined #ruby
p0y joined #ruby
xec joined #ruby
Pip joined #ruby
Morkel joined #ruby
M- joined #ruby
M- joined #ruby
burgestrand joined #ruby
beilabs joined #ruby
apeiros joined #ruby
nerded joined #ruby
_2easy joined #ruby
jay_zawrotny joined #ruby
envygeeks joined #ruby
<envygeeks> is there a way to force printf to no class kind of like Python
Shrink joined #ruby
trivol joined #ruby
bwlang joined #ruby
<apeiros> envygeeks: what?
<envygeeks> right now I have to printf %d and %s as two different strings, I want to printf without it caring about the object type
<envygeeks> Idon't know if that's possible though, Google is telling me no
<apeiros> depends on what you want it to do
<apeiros> %s will invoke to_s on any non-string object
<apeiros> so if that behaviour is fine, just use %s.
sven_ joined #ruby
<envygeeks> oh, I did not know that that is perfect, thanks
<apeiros> the same applies for other formats too, %d iirc invokes to_i, %f to_f etc.
tk_ joined #ruby
<apeiros> ah, %d uses Integer(), not to_i
<apeiros> so %f probably uses Float(), not to_f
<apeiros> yupp
beiter joined #ruby
pen joined #ruby
dzhulk joined #ruby
jensn joined #ruby
dzhulk1 joined #ruby
danielpunt joined #ruby
Cervajz_ joined #ruby
<StitchedKite> envygeeks printf is short for printformatted so use puts or object.to_s if applicable ;p
replore joined #ruby
terraUNDverra joined #ruby
S1kx joined #ruby
S1kx joined #ruby
iocor joined #ruby
paraglade joined #ruby
rickmasta joined #ruby
kf8a joined #ruby
oponder joined #ruby
ChampS_ joined #ruby
furrykef left #ruby
Morkel joined #ruby
samxor_ joined #ruby
iocor joined #ruby
emptyflask joined #ruby
luckyrub_ joined #ruby
dhodgkin joined #ruby
dhodgkin joined #ruby
yfeldblum joined #ruby
Cervajz joined #ruby
Shrink joined #ruby
victork joined #ruby
ultraviolet joined #ruby
shevy joined #ruby
Manhose joined #ruby
crankycoder joined #ruby
sbanwart joined #ruby
pen joined #ruby
randym joined #ruby
justinmcp joined #ruby
petschbot joined #ruby
BiHi joined #ruby
wereHamster joined #ruby
Manhose_ joined #ruby
mensch joined #ruby
cdepue joined #ruby
suung joined #ruby
darksk1ez joined #ruby
fermo joined #ruby
igorbozato joined #ruby
yalue joined #ruby
Dangr_ joined #ruby
jrbing joined #ruby
dhodgkin joined #ruby
bwlang joined #ruby
Monit0r joined #ruby
pen joined #ruby
paraglade joined #ruby
jensn_ joined #ruby
bwlang joined #ruby
tommyvyo joined #ruby
adambeynon joined #ruby
wyhaines joined #ruby
sepp2k joined #ruby
Knodi joined #ruby
akem joined #ruby
macabre joined #ruby
igorbozato left #ruby
davids joined #ruby
maxok joined #ruby
pHcF joined #ruby
beakerman joined #ruby
ph^_ joined #ruby
yekta joined #ruby
yfeldblum joined #ruby
michael_imac joined #ruby
moshee joined #ruby
moshee joined #ruby
iocor joined #ruby
jtrudeau joined #ruby
nerded joined #ruby
ohergal joined #ruby
evantravers joined #ruby
mocker joined #ruby
jfredett joined #ruby
cdepue_ joined #ruby
apow joined #ruby
robyurkowski joined #ruby
bwlang joined #ruby
adamjleonard joined #ruby
malkomalko joined #ruby
jensn joined #ruby
flip_digits joined #ruby
nanderoo joined #ruby
xpot joined #ruby
Draco_ joined #ruby
raluxgaza joined #ruby
sean_m joined #ruby
xpot joined #ruby
dv310p3r joined #ruby
grekko joined #ruby
Indian joined #ruby
lord12341 joined #ruby
<lord12341> is it bad form to use "load" instead of require?
<burgestrand> There’s often no reason to.
JohnBat26 joined #ruby
<burgestrand> load will load a file more than once if asked to, it does not append the correct file ending to files (which could be problematic with loading C extensions) and is uglier than require. :p
vtr joined #ruby
<lord12341> also: lets say I am in a array.each that contains a array of filenames, which loads each file. Is there a way to exit the "load" without exiting the entire run? (so, I found an error in filename1, but want to continue to filename2,3,4,...etc)
tvw joined #ruby
bluOxigen joined #ruby
albemuth joined #ruby
<terraUNDverra> lord12341: rescue and next
bwlang joined #ruby
bwlang left #ruby
<terraUNDverra> lord12341: [f1,f2,f3,f4].each { |v| begin; load v ; rescue ; next; end }
<lord12341> ok
savage- joined #ruby
kawa_xxx joined #ruby
<burgestrand> rescue does not catch LoadError
Jackneill joined #ruby
Jackneill joined #ruby
<burgestrand> You’d have to “rescue LoadError” specifically
austinbv joined #ruby
KermitTheFragger joined #ruby
<KermitTheFragger> hi all
<KermitTheFragger> quick question of a ruby noob
chiel left #ruby
<burgestrand> slow question, rather!
<burgestrand> :d
<KermitTheFragger> is it possible to have bundler install all the gems (dependencies) in to the local directory instead of globally ?
<KermitTheFragger> yeah, im kinda slow ;-)
<terraUNDverra> burgestrand: he said found an error *in* one of the files he's loading
<KermitTheFragger> creating a sort of statically linked solution...
<burgestrand> Yes it is
<terraUNDverra> burgestrand: a load error will happen if the file doesn't exist
<austinbv> so I have decided that I need to learn ruby instead of just being a rails programmer and I am confused when using attr_accessor why can you not access those methods from inside the class definition
<terraUNDverra> i assumed he meant there was bad code in one of the files ;)
<burgestrand> terraUNDverra: or if a file the file requires does not exist
<burgestrand> :)
<KermitTheFragger> burgestrand: how would i do such a thing ?
<burgestrand> KermitTheFragger: bundle --help have a lot of information
xissburg^mba joined #ruby
<burgestrand> I don*t know by heart ^^
bbttxu joined #ruby
<burgestrand> KermitTheFragger: this contains the information: http://gembundler.com/man/bundle-install.1.html
<burgestrand> KermitTheFragger: --path might help you
<KermitTheFragger> burgestrand: i already found the path thing, but the app is not smart enough to find the gems :(
<burgestrand> KermitTheFragger: you*d have to require 'bundler/setup' in your app before you require the gems
bier|tp joined #ruby
bier joined #ruby
kennethreitz joined #ruby
raluxgaza joined #ruby
<austinbv> or can you not access methods created with attr_accessor
<KermitTheFragger> burgestrand: ok, thx ill go dig some more, atleast now i know it should be possible and im not perusing something that impossible :)
iamjarvo joined #ruby
ultraviolet joined #ruby
<KermitTheFragger> burgestrand: i got something; RUBYLIB environmental variable should be helpful
<burgestrand> austinbv: what’s your question?
tatsuya_o joined #ruby
<austinbv> burgestrand: when you use attr_accessor to create getters and setters why can you not use those getters and setters in other methods
<austinbv> like in this Screenie http://cl.ly/150w3818462s0t002K1c I have to use instance vars in the constructor
<austinbv> and if I use what I would think would be method calls
<austinbv> the variables set are scoped to the method not to the instance
<burgestrand> austinbv: you can, but if you just write “position = 0” it’ll assign the local variable “position” to 0, and it won’t use the accessor
* xissburg^mba ouches
<burgestrand> austinbv: for that reason, you’ll have to use “self.position = 0”
<xissburg^mba> rvm install 1.9.3-p0 fails .. . .
<austinbv> I thought that ruby was intelligent about self declaration
<xissburg^mba> "ERROR: Error running ' ./configure --prefix="/Users/xissburg/.rvm/usr" --build=x86_64-apple-darwin11.2.0 --host=x86_64-apple-darwin11.2.0 ', please read /Users/xissburg/.rvm/log/ruby-1.9.3-p0/yaml/configure.log"
<austinbv> meaning if you used a method name inside the same class you didnt need self
theRoUS joined #ruby
<burgestrand> It’s not about intelligence, it’s about ambiguity
<envygeeks> xissburg^mba: just a random thought but did you look at the configure.log?
<xissburg^mba> yea, there I found "configure:3314: error: C compiler cannot create executables"
<xissburg^mba> also "configure:3243: checking whether the C compiler works . . no"
<envygeeks> paste the entire log to gist.github.com
Know1edge joined #ruby
<xissburg^mba> it is looking for gcc at /usr/bin/gcc-4.2 or something but it doesn't exist.
akem joined #ruby
akem joined #ruby
dotnull joined #ruby
<burgestrand> austinbv: in essence, since you can declare a local variable pretty much anywhere with anything, there is no way for ruby to know if you meant a local variable or a method call to the setter
mcginleyr1 joined #ruby
<burgestrand> it’s a little annoying, I agree
<xissburg^mba> envygeeks: https://gist.github.com/1385876
<austinbv> thats odd because in rails you can refer to other methods without self decleration
<burgestrand> Rails is written in Ruby, it’s in ruby you can do that
<burgestrand> But specifically for setters, this does not hold true
mcginleyr1 joined #ruby
<envygeeks> Setters are scoped to the context austinbv
tomzx joined #ruby
<austinbv> How do they do that?
nerded joined #ruby
<burgestrand> What do you mean?
<austinbv> scope the getters and setters to the context of each instance method
<xissburg^mba> ?
Morkel joined #ruby
manizzle_ joined #ruby
<austinbv> nevermind
<envygeeks> xissburg^mba: try --with-gcc=clang on the end of your rvm install, apparently there was a change in Ruby 1.9.3 (I don't know if it will work but apparently a lot of the failed compiles tend to be fixed by tht)
<burgestrand> You’ll have to provide an example, because… they don*t
<Tasser> is there kind of a result benchmark framework?
<envygeeks> Tasser: benchmark :P
<Tasser> aka how well different algorithms work
<Tasser> (not in speed, but in precision/recall)
<xissburg^mba> envygeeks: samething
<xissburg^mba> I am in Lion btw
moshee joined #ruby
moshee joined #ruby
p0y joined #ruby
<austinbv> I am grabbing one
Skaag joined #ruby
sdavis1 left #ruby
cpruitt joined #ruby
adrake_ joined #ruby
fatguylaughing joined #ruby
bluOxigen joined #ruby
axisys joined #ruby
<austinbv> burgestrand: I have this in my rails code https://gist.github.com/1385925
<austinbv> i know bastardized
<austinbv> but I had to.. :(
<austinbv> those are two model methods
<burgestrand> austinbv: yes, but that is okay, because that method is not a setter
<austinbv> ah
<burgestrand> austinbv: it works fine in ruby too :)
<burgestrand> …
<burgestrand> You infected me
<burgestrand> :p
luoluoluo joined #ruby
<burgestrand> It works fine in ruby, period.
robyurkowski joined #ruby
<austinbv> I don't know why that didn't click
<burgestrand> Rather. ^^
<burgestrand> It works for all methods… except setters ^^
<austinbv> ok
<austinbv> that makes sense
<austinbv> yeah I don't know why that didn't click for me
<burgestrand> Sometimes you need to look at things upside down to understand
<austinbv> then what is the difference between using @ and self
<austinbv> then
<austinbv> both are instance vars
<deryl> @ is an instance variable self refers to the specific objet calling self
ckrailo joined #ruby
rippa joined #ruby
<deryl> aka self can change. a var can not
<burgestrand> Yeah, self is not an instance variable
<deryl> its *value* can, but not tiself
<austinbv> oh ok
<austinbv> so is it better to use attr_accessor and self or instance vars
<austinbv> self refers to the instance right?
<austinbv> or the class?
<burgestrand> self is always self, hehe
<burgestrand> So in an instance method, “self” refers to the instance
<deryl> no self refers the one doing the calling
<austinbv> right
<burgestrand> in a class method, “self” refers to the class
<austinbv> so def self.method refers to the class
<austinbv> self in an instance method refers to the instance
<burgestrand> Yeah; try this: “class Moo; print self; end”
<burgestrand> (and I think it’s better to use attr_accessor and self than instance vars, because attr_accessor just creates methods, and methods you can change without necessarily changing how you call them)
<burgestrand> Using @var is like taking candy, while using just “var” is like asking for candy
<deryl> errr?
<deryl> thats all a matter of scoping
<austinbv> I see
<deryl> you're confusing everything every book is teaching me
lord1234 left #ruby
bbttxu joined #ruby
<burgestrand> I'll illustrate what I mean
<deryl> @var makes it accessible anywhere in the instance. var does not
<austinbv> @var refers to the instance variable
<deryl> please do. maybe i internalized what is being taught, wrong
<apeiros> deryl: var being a method, I think
<apeiros> (attr_*)
<austinbv> its like in java being putting the method at the top of the class
<austinbv> right?
<deryl> i don't know enough java to say, personally.
<burgestrand> You see line #9 and line #10
<burgestrand> I mean it’s better to use line #10 over line #9 if possible
<deryl> 10 you would have to use :var i thought
<deryl> you're declaring a symbol
<deryl> well it defines a vaariable but usig a symbol to access it
<burgestrand> deryl: you mean “our_var = :var” ?
<deryl> yeah
<burgestrand> deryl: because that’s different
<burgestrand> deryl: it’s like saying “our_var = 5” or whatever, :var is just a value
<austinbv> isn't that just assigning the symbol :var to our_var
<deryl> how so? (not being argumentative, asking for edification :) )
<burgestrand> austinbv: yeah it is
pootpoot joined #ruby
<deryl> ahh so the symbol becomes a pass-through
<burgestrand> deryl: symbols are just another kind of data in ruby, there’s not much special about them, they’re like strings
<austinbv> indexed strings iirc
<burgestrand> our_var = "var" and our_var = :var are very similar
<deryl> right but they refer to a specific memory location that contains a value, one that never changes (the mem loc)
<burgestrand> (except that the first assigns our_var to "var" and the second one assigns it to :var, but it's still just simple local variable assignment)
<deryl> correct?
<burgestrand> I guess you could say that, yeah. I think of them like numbers.
norex joined #ruby
<deryl> burgestrand: right but you're 'passing through' the symbol to get to the value stored at that location, correct?
<burgestrand> Say, you have the number 5, it’s always 5. It never changes, it never moves, you cannot update it and you cannot change 5 to be 4.
<austinbv> deryl: attr_accessor just used the method defination to set the getters and setters
<austinbv> same as a named scope in ruby using :joins => :table_name
<deryl> austinbv: right that i knew. i'm referring specifically to the symbol
<burgestrand> deryl: no, no passing nothing special with “our_var = :var”, it just assigns “our_var” to the value :var
<austinbv> ah
<deryl> i think this is an aerea i'm lacking udnerstanding
JonnieCache joined #ruby
<deryl> sorry typed so fast i'm typoing like mand :)
<deryl> mad
<burgestrand> If you think symbols are just strings that start with a colon instead of using apostrophes, you’re more than half right :)
vitoravelino__ joined #ruby
<austinbv> like a man*
<deryl> lol, well i am that :)
<deryl> burgestrand: ok. i'll have to read more on the guts of symbols then.
<deryl> seems to trip a lot of us new guys up
<austinbv> burgestrand: aren't symbols indexed strings
beakerma_ joined #ruby
<samuelkadolph> Symbols are interned immutable strings
<burgestrand> deryl: yeah, most people don’t get why we have both symbols and strings
<xissburg^mba> halp halp
<burgestrand> deryl: this is the same code as before, without the “:var” symbol: http://pastie.org/private/9npoxxvrlzczocgbswpx3a
<austinbv> symbols are slower to write faster to read hence the immutable interned
<xissburg^mba> rvm install 1.9.3 fails, but rvm install 1.9.2 doesn't...
<samuelkadolph> Uhh no
<burgestrand> Symbols are speedy, but the memory they use is never released
<samuelkadolph> symbols are just like strings is almost every aspect except they are immutable and equality comparison is O(1) instead of O(N)
<deryl> i've been thinking of symbols as: the machine selects a memory location, assigns ':var' as a handle for referencing that specific location (for humans), and then when you reference it you're storing whatever value you give it in that specific location, or readds from taht specific location.
<samuelkadolph> deryl: Yeah they don't work like that
<burgestrand> Oh, no, the value of a symbol is itself
<deryl> ahhhh
<deryl> clarification noted :)
<burgestrand> :var.object_id == :var.object_id
<burgestrand> 5.object_id == 5.object_id
sepp2k joined #ruby
<burgestrand> "hello".object_id != "hello".object_id
<deryl> that i understood
austinbv_ joined #ruby
<austinbv_> vs direct comparison
<samuelkadolph> The only reason they are used over strings is you don't have to allocate a new object for each literal (which could happen very often) and comparison is super fast
<samuelkadolph> So they make really good hash keys
paraglade left #ruby
<burgestrand> In reality, you very seldom need to use symbols, if you always use strings you should get along fine
<deryl> i think it is the fact the id never changes is what confuses me.
<samuelkadolph> deryl: Because they are all the same object
<samuelkadolph> Just like 5 is 5 is 5, :abc is :abc is :abc
<austinbv_> so is a symbol a refrence
<deryl> right. vs. var or @var which could have different ids
<austinbv_> oh wait I just got it
<samuelkadolph> deryl: Those are variables, not literals
<deryl> which part is the literal with symbols?
<samuelkadolph> :abc is a symbol literal
<samuelkadolph> "abc" is a string literal
<deryl> becaue the value stored in the jobect referenced by the :symbol can change
* xissburg^mba sighs
<samuelkadolph> deryl: No, symbols are immutable
<deryl> i know, but i'm not trying to change the symbol
cpruitt joined #ruby
<deryl> i'm trying to change the value it references
<samuelkadolph> Symbols aren't references to anything
<deryl> hehe i think the understanding i thought i had is rapidly slipping away
Draco_ joined #ruby
<burgestrand> :p
<burgestrand> 5 does not reference anything
<burgestrand> :symbol does not reference anything
<burgestrand> Hm, actually, this needs a new approach
<deryl> please?
<samuelkadolph> They are just immutable interned strings. Nothing less, nothing more
<burgestrand> This is not the first time this discussion comes up :d
<samuelkadolph> They don't point to anything
<deryl> hehe. sorry if i'm making you rehash previous territory
yaasii_ joined #ruby
Paladin joined #ruby
<burgestrand> deryl: do you know C?
paraglade joined #ruby
<deryl> i was thinking that symbols were created objects where the id never changed so you always referred to *that* object (and it couldn't change because the assignment was immutable)
<austinbv> it's like this
kawa_xxx joined #ruby
<austinbv> ruby-1.9.2-p180 :023 > :hello.object_id === :hello.object_id
<austinbv> => true
<austinbv> ruby-1.9.2-p180 :024 > "hello".object_id === "hello".object_id
<austinbv> => false
<austinbv> ruby-1.9.2-p180 :025 >
<deryl> burgestrand: yes. not super great at it but i do know it
<burgestrand> deryl: you know the #define macro?
<samuelkadolph> deryl: The assignment isn't immutable, the string itself is.
<austinbv> sorry for the spam I think it just clicked
<deryl> burgestrand: yeah
<samuelkadolph> Reading http://en.wikipedia.org/wiki/String_interning will make you see why an interned string needs to be immutable
<burgestrand> deryl: symbols are kind of similar to that; #define is very useful when you want a magical number of some sort, but don’t wish to use that number in your code because it’d be very confusing
eugynon joined #ruby
<deryl> ah hah! now that clicked!
<burgestrand> deryl: you could think of a symbol as a magical number, or rather a magical constant, that never changes
<samuelkadolph> I rather dislike that explanation but it makes most people understand
<burgestrand> It’s a process ;)
<deryl> thank you for taking the time to explain that. i think i have it now
kawa_xxx joined #ruby
<deryl> brb phone
SegFaultAX joined #ruby
<austinbv> so I think I am off
<austinbv> err wrong
<austinbv> so why not only use immutable strings
<samuelkadolph> For what?
<envygeeks> for everything!
<austinbv> oh wikipedia answered it
<samuelkadolph> I love not needing a StringBuilder class in ruby.
<samuelkadolph> One thing I always disliked about C#.
<austinbv> why does ruby not work like java and make all strings immutable?
dv310p3r joined #ruby
<samuelkadolph> Because it's a choice
<samuelkadolph> And having immutable strings doesn't get you much in the end while preventing you from having efficient string manipulation.
<austinbv> I need to take compliers 304
<austinbv> instead of the 200level
<austinbv> I think we would get to this stuff
<samuelkadolph> Compiler != language
<envygeeks> I was thinking that too, making everything immutable in a single threaded environment would probably add extra overhead you just don't want
Dreamer3 joined #ruby
<samuelkadolph> There wouldn't be any overhead
<samuelkadolph> austinbv: Some reasons for immutable strings: http://stackoverflow.com/questions/93091/why-cant-strings-be-mutable-in-java-and-net
austinbv_ joined #ruby
* xissburg^mba got it
<xissburg^mba> rvm install 1.9.3 --with-gcc=clang
<xissburg^mba> f t w
austinbv_ joined #ruby
<austinbv_> damn college wifi
<austinbv_> sucks
<austinbv> much better
<austinbv> connect to my phone instead of my schools network
<xissburg^mba> heeh
<envygeeks> There has to be a much better way to get the class name of a method since self.name can be modified
<samuelkadolph> Class name of a method?
<austinbv> samuelkadolph: from that SO post The only real disadvantage of immutable classes is that they require a separate object for each distinct value.
<austinbv> so for speed and security we should use symbols as often as possible
<samuelkadolph> austinbv: That makes no sense
<samuelkadolph> No
<austinbv> I know there isn't a "right answer"
<austinbv> I am just trying to figure it out :P
<samuelkadolph> Immutable interned strings (or other things) leads to less instances
<samuelkadolph> Because you can pool them
<samuelkadolph> But that wasn't in the SO, so I'm not sure why you said that
<austinbv> which is why :x.object_id === :x.object_id
<samuelkadolph> There were some good points in those answers which you seemed to have not read
josemota_ joined #ruby
ph^ joined #ruby
<austinbv> they use the same instance
<austinbv> I am still reading
dcarper joined #ruby
airhorns joined #ruby
gearaholic joined #ruby
revans joined #ruby
<austinbv> I still don't see why to use mutable objects from those answers
<samuelkadolph> Those are points for immutable
pen_isident joined #ruby
ultraviolet joined #ruby
<austinbv> right so why not always do puts :"hello world"
dch4pm4n joined #ruby
<austinbv> or x = :"some sort of symbol"
<samuelkadolph> Because in ruby symbols are memory leaks. They never get garbage collected
<austinbv> ah that's what I was looking for
<samuelkadolph> And they aren't mutable, so you cannot mutate them
<samuelkadolph> Which is very convenient for building strings
<austinbv> my computer is dying
<austinbv> :(
kevinbond joined #ruby
omry joined #ruby
VJTachyon joined #ruby
<VJTachyon> Anybody looking for some work in NYC?
oponder joined #ruby
<raluxgaza> Hey guys how can I return a date in format "1st Nov"?
steph021 joined #ruby
metrix joined #ruby
steph021 joined #ruby
<samuelkadolph> raluxgaza: I think you'd have to handle the ordinal yourself
S2kx joined #ruby
<VJTachyon> We are looking for some good Ruby coders: http://jobvite.com/m?3bgjcfwG
hjdivad joined #ruby
<metrix> I want to import a ruby file but I want the files scope to be visible within the object instance so that I can import the same file name/methods with different code in other object instances... Is there a way to do this?
macmartine joined #ruby
raluxgaz_ joined #ruby
omry joined #ruby
LiquidInsect joined #ruby
ghanima joined #ruby
omry joined #ruby
cjs226 joined #ruby
VJTachyon joined #ruby
ephesius joined #ruby
omry joined #ruby
vitoravelino__ joined #ruby
cdepue joined #ruby
omry joined #ruby
philcrissman joined #ruby
<aces1up> when doing included(base) how can i get the name of the class its included into? base.class just returns class
SolarisBoy1 joined #ruby
abstrakt joined #ruby
<abstrakt> is .each_slice deprecated in 1.9.2?
<samuelkadolph> aces1up: base.name?
<abstrakt> I've got require 'enumerator' as the first line
<samuelkadolph> abstrakt: Why would it be?
<abstrakt> but I'm getting an error about undefined method
<abstrakt> I know this script has worked in the past and no changes have happened
<samuelkadolph> That seems unlikely
S1kx joined #ruby
<abstrakt> samuelkadolph, because I'm getting an error
<VJTachyon> Roundarch is looking for some good Ruby coders in NYC (Contract or Perm): http://jobvite.com/m?3bgjcfwG
<samuelkadolph> abstrakt: Why would deprecation give you an error?
nerded joined #ruby
<samuelkadolph> abstrakt: You should gist or pastie your code and the full error
<abstrakt> well, it seems this is the case, because I just installed 1.8.7 and ran the script and now it works
<abstrakt> config/recipes/tag_deploy.rb:106:in `tags': undefined method `each_slice' for #<String:0x8fff160> (NoMethodError)
<abstrakt> it's not the full stack, but that's the basic error
<samuelkadolph> String is no longer enumerable in 1.9
<samuelkadolph> Use String#chars or #bytes or #codepoints
<abstrakt> ahh, ok
<aces1up> samuelkadolph thanks
Guest78465 joined #ruby
rushed joined #ruby
kawa_xxx joined #ruby
ephesius joined #ruby
ank joined #ruby
emocakes joined #ruby
lirakis joined #ruby
<lirakis> i am trying to access a variable from an object .. but i think the variable is a symbol.....
<lirakis> when i do obj.instance_variables
<lirakis> i get
<lirakis> [:@logger, :@events, :@config]
<lirakis> if i do obj.events
<lirakis> i get an error
Mahoek joined #ruby
<deryl> and if you do obj[:events]
abstrakt left #ruby
<lirakis> havent tried .. been trying to figure out syntax for accessing
<lirakis> you probably answered my question :D
catphish joined #ruby
<deryl> i'm still in the learning process myself, so if that doesn't work, my apologies
<catphish> what is a Syck::PrivateType?
<lirakis> deryl:hmm .no that doesnt work
<lirakis> undefined method `[]' for #<Cinch::Bot:0x00000001fce620> (NoMethodError)
<Mon_Ouie> PrivateType is probably the name of a class you're not supposed to deal with
<deryl> its a default type, but not sure of ytype WHAT
Telling joined #ruby
<deryl> lirakis: ahh. my bad
<catphish> i think it might be an incarnation of nil actually
smgt joined #ruby
<catphish> after a yaml decode
<lirakis> hmm ... so any one have any idea how i can get to the instance vars that are symbols within an object?
<Mon_Ouie> lirakis: An object doesn't have to provide a reader for its instance variables
<dominikh> lirakis: just because an object has an instance variable doesn't mean there's an attribute reader for it.
<deryl> err? didn;'t know there was more than one nil representation. thought that was ONLy NilClass
<lirakis> right
<dominikh> lirakis: furthermore, why do you want access to those variables? they're not exported for a reason
<catphish> deryl: technically yes
<catphish> but other code could put something in its place
<catphish> instead of extending it
<deryl> overriding?
<lirakis> dominikh: yeah .. im using cinch which is an IRC framework. and i have written a bunch of plugins ... but i want to create a "list" command that will list the registered plugins
<lirakis> dominikh: you are the cinch maintainer right?
<dominikh> correct.
<lirakis> so .. yeah .. im trying to basically get a list of registered event handlers
<lirakis> from within my main bot
<dominikh> you're using version 1.1.3 I assume?
Vendethiel joined #ruby
ahknight joined #ruby
ephesius joined #ruby
burgestrand joined #ruby
<lirakis> hmm ... im not 100% sure id have to check
<lirakis> cinch-1.1.3
<lirakis> yeah
<dominikh> well, you certainly don't need access to @events
enviable joined #ruby
<lirakis> sure .. i was just .. trying to hack my way though to figure out where i could get the registered pattern matches
<lirakis> i did an inspect on the whole bot object and i saw @events and the patterns within
<dominikh> lirakis: why access the patterns and not the plugin instances?
<dominikh> which would be Bot#plugins
<lirakis> dominikh: so i tried looking at plugins too
<ahknight> Quick newbie question, if you'll humor me: I'm trying to fix some Chef code and can't figure out what's going on somewhere (I'm a Py guy being drafted for the day.) What's this syntax for object creation called so I can Google it? group "some_group" do \n gid 600 \n end
<lirakis> dominikh: i dont really know how the framework works all that much ... beyond using it to write simple irc bot plugins
<lirakis> dominikh: so i wasnt sure where to look
<lirakis> so i could do bot.plugins[:matchers]
<Mon_Ouie> ahknight: That's just the syntax to call a method with a block
<lirakis> ?
paraglade joined #ruby
<lirakis> hrm ..
<ahknight> @Mon_Ouie Who receives gid? The group() I'm making, as in group.gid?
windowsrefund joined #ruby
<dominikh> lirakis: version 1.1.3 doesn't provide attribute readers for most of the plugin attributes, so something like this will be needed: https://gist.github.com/2b9430d865d65b178310
<windowsrefund> hi dominikh
<dominikh> windowsrefund: hi.
<windowsrefund> :)
bartavelle joined #ruby
<bartavelle> is there a way to list all variables in scope ?
<Mon_Ouie> ahknight: Most likely, they are using instance_eval, so it can be whatever object the library wants
<windowsrefund> I"m getting #Net::HTTPOK strings in my http output when I use Net::HTTP. Can someone point me in the right direction for ensuring those are ommitted?
<lirakis> dominikh: ok .. so i could use that block to collect the plugin help commands
rsampaio joined #ruby
<dominikh> lirakis: yes
<ahknight> @Mon_Ouie So, like keyword arguments? I don't see this syntax in any of the tutorials. :\
<lirakis> dominikh: ok - that should work well enought
<lirakis> dominikh: thanks for the help
<dominikh> welcome
kenichi joined #ruby
cbuxton joined #ruby
Targen joined #ruby
kevinbond joined #ruby
cdepue_ joined #ruby
<ahknight> Aha, found it. It is indeed instance_eval. Thanks Mon_Ouie. (http://www.trottercashion.com/2011/02/08/rubys-define_method-method_missing-and-instance_eval.html)
lkba joined #ruby
babinho joined #ruby
omry joined #ruby
bartavelle left #ruby
theRoUS joined #ruby
manizzle joined #ruby
Araxia_ joined #ruby
Dreamer3 joined #ruby
ksinkar joined #ruby
Beoran__ joined #ruby
Helius1 joined #ruby
terraUNDverra joined #ruby
crankycoder left #ruby
havenn joined #ruby
sullx joined #ruby
Paladin joined #ruby
robyurkowski joined #ruby
cbuxton joined #ruby
windowsrefund left #ruby
raluxgaza joined #ruby
SegFaultAX|work joined #ruby
apeiros_ joined #ruby
ank joined #ruby
ianbrandt joined #ruby
g0bl1n joined #ruby
g0bl1n joined #ruby
headius joined #ruby
omry joined #ruby
nerded joined #ruby
cyri_ joined #ruby
lobo_d_b joined #ruby
<sullx> hello all
poeks_ joined #ruby
apok joined #ruby
jds joined #ruby
Beoran__ joined #ruby
<VJTachyon> Roundarch is looking for some good Ruby coders in NYC (Contract or Perm): http://jobvite.com/m?3bgjcfwG
udoprog joined #ruby
d3c joined #ruby
<d3c> how can I get the actual path of a symlink?
zanaga left #ruby
rclark joined #ruby
ultraviolet joined #ruby
<Afal> ls
<d3c> Afal: via system?
nerded joined #ruby
tayy joined #ruby
omry joined #ruby
nerded_ joined #ruby
eignerchris joined #ruby
ilyam joined #ruby
artOfWar joined #ruby
tehdekan joined #ruby
josh_ joined #ruby
adamkittelson joined #ruby
babinho joined #ruby
Rango joined #ruby
h4mz1d joined #ruby
iocor joined #ruby
terraUNDverra joined #ruby
heftig joined #ruby
adambeynon joined #ruby
artOfWar joined #ruby
lord1234 joined #ruby
<lord1234> whats wrong with this statement: http://pastie.org/2904602 given that len = 45
<lord1234> why do i never get inside the if statement
raluxgaza joined #ruby
<apeiros_> lord1234: nothing. goes - as expected - into the if twice for me. once for 1, and once for 11
<rippa> works here
<apeiros_> so either len isn't what you think it is, or your stdout goes elsewhere
raluxgaza joined #ruby
dcarper joined #ruby
rboyd joined #ruby
eywu joined #ruby
timonv joined #ruby
austinbv joined #ruby
raluxgaza joined #ruby
stkowski joined #ruby
<shevy> my stdout usually gets into my pants
hooper joined #ruby
<austinbv> i heard you had an STDin your pants
bbttxu joined #ruby
yfeldblum joined #ruby
EddieBluh joined #ruby
ghanima joined #ruby
Morkel joined #ruby
Russell^^ joined #ruby
apok joined #ruby
macmartine joined #ruby
petschbot joined #ruby
alex__c2022 joined #ruby
emocakes joined #ruby
conntrack joined #ruby
wmoxam joined #ruby
omry joined #ruby
LouisJB joined #ruby
emmanuelux joined #ruby
minijupe joined #ruby
heftig joined #ruby
macmartine_ joined #ruby
paraglade joined #ruby
omry joined #ruby
p0y joined #ruby
maggie_n joined #ruby
thecreators joined #ruby
<VJTachyon> Roundarch is looking for some good Ruby coders in NYC (Contract or Perm): http://jobvite.com/m?3bgjcfwG
voodoofish430 joined #ruby
p0y joined #ruby
ziggles joined #ruby
nerded joined #ruby
kirun joined #ruby
macabre joined #ruby
nerded joined #ruby
Hellojere joined #ruby
omry joined #ruby
jbw joined #ruby
nanoyak joined #ruby
ephemerian joined #ruby
cdepue joined #ruby
jensn_ joined #ruby
Skaag joined #ruby
iocor joined #ruby
nerded_ joined #ruby
shadoi joined #ruby
otakutomo joined #ruby
pantsman joined #ruby
pantsman joined #ruby
ahknight left #ruby
minijupe joined #ruby
josephwilk joined #ruby
dnyy joined #ruby
manizzle joined #ruby
poppiez joined #ruby
<poppiez> I have ruby running optipng on a bunch of images but it's only using around 13 % CPU even though it takes forever. why isn't it more aggressive in CPU usage?
dcarper joined #ruby
nerded joined #ruby
paraglade joined #ruby
quest88 joined #ruby
omry joined #ruby
<burgestrand> poppiez: essentially, I have no idea why your code is what it is, but you can use that to help figure it out
<Mon_Ouie> Is it on a multicore CPU?
<Mon_Ouie> If you have 8 cores, Ruby will only use one
Bardell joined #ruby
Bardell left #ruby
king313 joined #ruby
king313 joined #ruby
dasfugufish joined #ruby
senj joined #ruby
raluxgaza joined #ruby
Helius joined #ruby
<poppiez> burgestrand: nice tool!
<poppiez> Mon_Ouie: yeah, multicore
<poppiez> Mon_Ouie: ... so that's why ;)
<burgestrand> Ah, might be useful to check out Rubinius or JRuby if they’re an alternative then
<headius> yay multicore
<burgestrand> but…
<burgestrand> Naw, never mind, ignore me.
<yxhuvud> or you could start a process for each core and run them in parallell
<jensn> fork is super, as long as you are on *nix.
steph021 joined #ruby
steph021 joined #ruby
perturbedpanda joined #ruby
Pip joined #ruby
DeeJayTwo joined #ruby
nerded_ joined #ruby
<DeeJayTwo> Could someone tell me what's wrong my the way I call store on a hash?
<burgestrand> initialize @aCtrl in the initialize method
<burgestrand> That instance variable will be an instance variable on the class, and not on the instance you create by doing RAIDController.new
d3vic3 joined #ruby
<DeeJayTwo> what's the purpose to have an instance variable on a class?
daniel_hinojosa1 joined #ruby
<DeeJayTwo> by the way, thank you ;)
<burgestrand> :)
<burgestrand> It’s useful at times; you can create accessors/modifiers for it as well. You could use it as a counter, implement the Singleton pattern, and a bunch of other things I cannot think of right now.
fantazo joined #ruby
<DeeJayTwo> ok, thank you!
<DeeJayTwo> how do I refer to an instance class?
<burgestrand> Other languages tend to have a similar thing named “static variables”; not exactly the same thing, but similar indeed
<DeeJayTwo> from a method..
<burgestrand> To an instance class?
Jake232 joined #ruby
steph021 joined #ruby
steph021 joined #ruby
<DeeJayTwo> yeah... because obviously, I couldn't access it the way I did...
<burgestrand> I mean I don’t understand you, please show what you want to do :)
<DeeJayTwo> In my pastebin...
<DeeJayTwo> suppose I kept in in the class
<DeeJayTwo> but not in initialize...
<burgestrand> Ah
<burgestrand> You could do “def self.aCtrl; @aCtrl; end”
<burgestrand> That would define aCtrl method on the RAIDController class
<burgestrand> You could then access it with “self.class.aCtrl” or “RAIDController.aCtrl”
mengu joined #ruby
<burgestrand> You could also define it as “def << self; attr_reader :aCtrl; end” (pretty much the same thing)
<burgestrand> (semicolons in my code can be replaced with newlines, I just do it on one line because this… is… IRC!)
<DeeJayTwo> good
<DeeJayTwo> so I cannot set it after it is defined...
<DeeJayTwo> right?
Guedes joined #ruby
Guedes joined #ruby
<burgestrand> Sure you can, you just need to decide how!
tshauck joined #ruby
<burgestrand> You could change the “attr_reader :aCtrl” to “attr_accessor :aCtrl” in my previous code sample; which I just noticed I had a syntax error in. It should read like this now, anyway: “class << self; attr_accessor :aCtrl; end”
LouisJB joined #ruby
<burgestrand> Now you can set it with RAIDController.aCtrl = anything
<VJTachyon> Roundarch is looking for some good Ruby coders in NYC (Contract or Perm): http://jobvite.com/m?3bgjcfwG
<DeeJayTwo> burgestrand : Ok nice, now I see why you compared it to static...
<DeeJayTwo> thank you again!
<burgestrand> You’re welcome :)
nerded joined #ruby
<poppiez> is it okay to define a method inside a rake task or should it be outside of it?
<burgestrand> It’s kind of funny if you invoke the task several times, I’d put it outside, poppiez
<burgestrand> (not that it breaks… it’s just funny)
<poppiez> burgestrand: it's just that the method needs a variable defined inside the task
Morkel joined #ruby
<burgestrand> poppiez: if you define the method with “def” it can’t access that variable directly anyway
<burgestrand> … unless it’s a global variable, I guess
<poppiez> hmm
<poppiez> burgestrand: ok thx. will think it through
fridim_ joined #ruby
<d3c> if I store a module called foo in /usr/lib/ruby/1.8, can I just require 'foo' in scripts then?
<burgestrand> d3c: ruby -e 'puts $LOAD_PATH.join("\n")'
wyhaines joined #ruby
<burgestrand> d3c: put a ruby script in any of them and you can
<burgestrand> Although… there’s probably a better way to do what you want to do
Draco_ joined #ruby
<LiquidInsect> like, make it a gem, include it in your own project instead of mixing your own code into Ruby's standard library...
nerded_ joined #ruby
workmad3 joined #ruby
<d3c> LiquidInsect: I see. will look into making a gem.
<d3c> burgestrand: was that 'the better way' you also meant? :)
<d3c> burgestrand: anyway, this is for use with puppet and mcollective. trying to share some logic between an mcollective agent and a cli script.
cjs226 joined #ruby
<burgestrand> d3c: I just said there is one, I have no idea what it’d be :D
techhelp joined #ruby
<burgestrand> actually I said there *probably* is one
libertyprime joined #ruby
nerded joined #ruby
bwlang joined #ruby
imsplitbit joined #ruby
GoldenPie joined #ruby
robyurkowski joined #ruby
tommylommykins joined #ruby
* tommylommykins waves
* tommylommykins is trying to store ruby objects on disk
<tommylommykins> I think I'm doing it wrong though
<LiquidInsect> tommylommykins: Are you using Marshal?
knix joined #ruby
knix joined #ruby
<tommylommykins> oh
<tommylommykins> I think I'm forgetting to read the data off disk
musl joined #ruby
phrame joined #ruby
<tommylommykins> Marshal.load(filename) == fail?
<tommylommykins> :P
jtrudeau joined #ruby
thone joined #ruby
<LiquidInsect> yeah, source for Marchal.load should be an IO object
<LiquidInsect> so Marshal.load(File.open(filename)) or something similar
<LiquidInsect> would probably work
<LiquidInsect> haven't done marshaling myself so... yeah.
<tommylommykins> :)
<tommylommykins> That seems to have solved it
<tommylommykins> Thanks for the help
Hellojere joined #ruby
<tommylommykins> hmm
sandstrom joined #ruby
sandstrom joined #ruby
atmosx joined #ruby
ylluminate joined #ruby
<DeeJayTwo> How do I get line #X in a string with multiple lines..?
<burgestrand> You could split the string into an array of lines and then grab it
<shevy> DeeJayTwo string.split("\n")[44,1]
<shevy> oops
esparkman joined #ruby
<shevy> ignore the ,1
<burgestrand> Just use split without a parameter
swi7ch joined #ruby
ph^ joined #ruby
ilyam_ joined #ruby
petschbot joined #ruby
jim_ec2 left #ruby
emmanuelux joined #ruby
<burgestrand> Actually, no
Draco_ joined #ruby
<burgestrand> I think I thought of another method, I tend to just use String#lines when splitting into lines
<xissburg^mba> why does Limechat shows a ruby at the bottom right corner in this channel?
<shevy> who knows! use xchat :D
emocakes joined #ruby
loood_ joined #ruby
ryanf joined #ruby
<loood_> I'm setting up a local mirror of rubygems. Is generate_index suppose to take forever to finish?
sandstrom joined #ruby
sandstrom joined #ruby
<emocakes> well you are generating an _index loood_
Cervajz joined #ruby
Cervajz joined #ruby
grekko joined #ruby
<loood_> I canceled it over 6hrs of it running
apok joined #ruby
Mon_Ouie joined #ruby
ank joined #ruby
omry joined #ruby
paraglade left #ruby
orangejuice joined #ruby
lobo_d_b joined #ruby
lobo_d_b joined #ruby
paraglade joined #ruby
VJTachyon left #ruby
enikar joined #ruby
tomku joined #ruby
zastaph joined #ruby
ceej joined #ruby
<ceej> I'm using ruby 1.9.2 I'm trying to do "some string".encode :xml http://www.ruby-doc.org/core-1.9.2/String.html#method-i-encode but I get can't convert Symbol into String
<burgestrand> ceej: you have to supply destination encoding as well
shadoi joined #ruby
nerded_ joined #ruby
<burgestrand> "some string".encode('UTF-8', :xml => :text)
aglenday joined #ruby
<ceej> burgestrand: ah… thank you
jensn joined #ruby
<burgestrand> ceej: looks like I was wrong
<burgestrand> ceej: "some string".encode(:xml => :text) might be enough
Manhose joined #ruby
<ceej> burgestrand: both work :) including encoded_xml = xml.encode 'UTF-8', :xml => :text
<burgestrand> :)
<burgestrand> probably better with my latter suggestion, unless you really *want* to convert the data to UTF-8
iocor joined #ruby
mickn joined #ruby
dcarper joined #ruby
IrishGringo joined #ruby
robyurkowski joined #ruby
Rango joined #ruby
Mon_Ouie joined #ruby
<rtyler> howdy chaps, I'm using capybara and was hoping somebody else had figured out how to add post-command hooks
<rtyler> :)
paraglade left #ruby
Jake232 joined #ruby
Morkel joined #ruby
p1d joined #ruby
enroxorz joined #ruby
enroxorz joined #ruby
pHcF joined #ruby
apok joined #ruby
paraglade joined #ruby
workmad3 joined #ruby
ilyam joined #ruby
justinmcp joined #ruby
vitoravelino joined #ruby
felipe_Brz joined #ruby
felipe_Brz left #ruby
king313 joined #ruby
king313 joined #ruby
Manhose_ joined #ruby
kzar` joined #ruby
quest88_ joined #ruby
gbgallardo joined #ruby
<kzar`> What's the ruby equivalent of (apply + [1 2 3])? (I would expect that to be 1 + 2 + 3 = 6.)
Azure joined #ruby
<gbgallardo> Is this the appropriate place to ask rvm questions?
<LiquidInsect> kzar`: [1,2,3].reduce(:+) is what I think you want
<kzar`> LiquidInsect: Thanks
emocakes joined #ruby
dcarper joined #ruby
Guedes joined #ruby
evantravers joined #ruby
Guedes joined #ruby
h4mz1d joined #ruby
workmad3 joined #ruby
dzhulk joined #ruby
ixti joined #ruby
Targen joined #ruby
ixti joined #ruby
iocor joined #ruby
mib_mib joined #ruby
<ceej> if I make a method that has a block and pass it a few things like yield(body, head, xml) how do I pass it by reference?
quest88 joined #ruby
<mib_mib> hi - resque has been working fine for me, i use it with rails 3.0.4 - when i use QUEUE=blah rake environment resque:work RAILS_ENV=production - it works fine. recently I wanted to run multiple workers, so when i use COUNT=5 QUEUE=blah rake environment resque:workers RAILS_ENV=production it throws this required_dependency error - how do i fix it to run multiple workers? http://pastebin.com/vaLHH7jN
Russell^^ joined #ruby
senj joined #ruby
cooper joined #ruby
n8ji joined #ruby
dhodgkin joined #ruby
jbpros joined #ruby
sdavis joined #ruby
iocor joined #ruby
<ceej> is there a way to get yield to send things by reference http://pastie.org/2905891 body still ends up blank…..
dhodgkin joined #ruby
<shadoi> mib_mib: that's a rails internal require thing, is it loading rails before your worker code?
flock_ joined #ruby
<envygeeks> is there a way to easily find out if a method is a singleton or an instance?
<shadoi> ceej: your variables are local to the update method scope, you can use class methods or something…
<shadoi> envygeeks: Object.singleton_methods.include? 'method'
<ceej> shadoi: would you be able to give me an example?
robotmay joined #ruby
<shadoi> That sort of is an example… :)
<shadoi> call singleton_methods on your object, if it has any defined it will return them
<shadoi> in an array
adamjleonard joined #ruby
lobo_d_b joined #ruby
lobo_d_b joined #ruby
<workmad3> ceej: yield does send by reference, however reassigning the reference only changes the block parameter
yekta joined #ruby
<envygeeks> Shadoi: perfect, thanks man
<workmad3> ceej: however, if you did body[:test] = :testing in your block, you'd see the changes ;)
<shadoi> ceej: oops, I mixed up you and envygeeks.
<envygeeks> That was perfect shadoi, I just wanted to get the method type so when I printed out pry headers it could properly chose between # or . :P
<ceej> workmad3: is there no way to override the whole obj?
<workmad3> ceej: no... they are more like 'pass by pointer value' if you're thinking in C++ terms
<shadoi> ceej: I'd use a real class and instance_eval &block if block_given?
<shadoi> makes more sense to me anyway.
emmanuelux joined #ruby
<workmad3> ceej: C++ is the only language I've used where reassigning a 'reference' changes it in the scope the reference was passed from btw
<shevy> C++ is the most complex programming language known to mankind
sullx joined #ruby
<ceej> thank you both :)
<sullx> what is the regex for �
<ceej> as they do what I want to do in my function http://savonrb.com/#executing_soap_requests
<workmad3> shevy: hardly... you should try intercal or java2k at some point ;)
<sullx> im trying to add � to an attribute in irb and it just prints as a whitespace
<workmad3> shevy: they'll make you *wish* you were on c++ :P
<shevy> Perhaps if I would have used it for 20 years. There are always worse languages out there than the one you currently use!
<sullx> anyone know how I can include � in my string? Via regex or otherwise?
hornairs joined #ruby
atmosx left #ruby
Mon_Ouie joined #ruby
<sullx> irb prints it as whitespace.. it may be a windows cmd issue, not sure tho
<shevy> what do you mean
<shevy> what is that '�'
<shevy> x = "foo"; x << '�' # => "foo\273"
<burgestrand> Was wondering that though, but perhaps the character doesn’t show up properly in my UTF-8 only IRC client
<burgestrand> s/though/too/
<shevy> yay burgestrand :)
<shevy> long live ISO*!!!
<sullx> shevy I don't know what you mean in your second comment
<sullx> or the third
<shevy> sullx you want to include some odd character in a string right?
<burgestrand> Is it a » character perhaps?
<burgestrand> ^^
<shevy> x = "foo" # we have a string
<sullx> yes
<shevy> x << # we append to it
<shevy> and the character code for that key you pasted here seems to be "\273" ... no idea where to find the table for that
<heftig> man iso-8859-1
<heftig> 273 187 BB » RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
gbgallardo left #ruby
<sullx> heftig, source?
<heftig> man-pages
<shevy> heftig whoa cool
<envygeeks> Random question: Do you think I should still escape nested quotes or do you think most people will realise Ruby doesn't care about them?
sdwrage joined #ruby
<heftig> envygeeks: example?
<envygeeks> heftig: "My name is "EnvyGeeks""
<sullx> \xBB is what i needed, thanks for the resources
Rango joined #ruby
<heftig> envygeeks: that's a syntax error.
<Mon_Ouie> envygeeks: That's a syntax error
<Mon_Ouie> Heh
wereHamster joined #ruby
<envygeeks> hmmm perhaps I had it wrong, I know there was a situation where I oculd nest quotes
<envygeeks> let me find the example again >.>
<Mon_Ouie> Yes, there's one
<Mon_Ouie> %(foo (bar) baz)
<shevy> don't think he meant that
<Mon_Ouie> If you reach that case, I'd rather chose another delimiter than relying on that feature
<envygeeks> Mon_Ouie, shevy, heftig: Here is the example binding.eval("#{Kernel.const_get("klass[:name]")}")
<shevy> ewwww
<Mon_Ouie> Ah, with string interpolation
M- joined #ruby
<Mon_Ouie> I somehow avoid to have to interpolate complex expressions
<shevy> thank god that I will never use something like that in my code
<Mon_Ouie> Plus in that exact case you can just use to_s
<envygeeks> I wanted to get the actual constant :P
fantazo joined #ruby
Code-Zombie joined #ruby
<Code-Zombie> meow
<Code-Zombie> setting up SFML with ruby under windows is a reaaaaaaal pain
Skaag joined #ruby
ikaros joined #ruby
skrewler joined #ruby
Axsuul joined #ruby
cjs226 joined #ruby
albemuth joined #ruby
cdepue joined #ruby
apok_ joined #ruby
wuntee joined #ruby
iocor joined #ruby
<wuntee> how do i print the binary (NOT as in 1 and 0) representation of an unprintable character, for example puts("\231") will simply print "?" …. i want it to print whatever that would be if it existed in a file and i cat'ed the file
jbpros_ joined #ruby
<Mon_Ouie> puts "\231" writes 0231 (i.e. byte 153) to stdout, followed by a new-line
techhelp joined #ruby
artOfWar_ joined #ruby
<wuntee> Mon_Ouie: hmm - maybe its just rib thats sanitizing… thanks
<wuntee> wuntee:~$ cat x
<wuntee> puts("\213")
<wuntee> wuntee:~$ ruby x
<wuntee> ?
macabre joined #ruby
<Mon_Ouie> ruby -e 'puts "\213"' # I don't see anything in the output, wc tells me there's one byte
Clooth joined #ruby
Manhose__ joined #ruby
Banistergalaxy joined #ruby
<wuntee> Mon_Ouie: what ruby version are you running?
cdepue joined #ruby
<Mon_Ouie> 1.9.3
pootpoot left #ruby
<wuntee> hmm, 1.9.2 and 1.8.7 both show '?' when i run that command
<Mon_Ouie> But I am pretty sure no Ruby version would replace non-printable chaaracters with question-marks
<Mon_Ouie> Of course your teminal can do that
<Mon_Ouie> terminal*
Cervajz joined #ruby
developish joined #ruby
<wuntee> ahh - you are correct… it was the terminal...
<wuntee> Mon_Ouie: thanks!
<sdwrage> what is the difference between using @ and self?
<Mon_Ouie> @ is the sigil for instance variable
<Mon_Ouie> self is the current object (i.e. the object the current method was called on)
dankest joined #ruby
<sdwrage> confused as I thought @age called that objects age var
<Mon_Ouie> @age access the age instance variable of self
<Mon_Ouie> accesses*
<sdwrage> so self references the main object that my current object instances from?
<sdwrage> basically the same thing as static calls in other langs
<Mon_Ouie> No. self is like this in C++ or self in Obj-C
artOfWar joined #ruby
<sdwrage> hold on… so I have User and then I have jason = User.new
<sdwrage> which does self reference if I am using it in jason?
<sdwrage> jason.methodwithselfcallinside
<jrist-out> j...son
<jrist-out> not jason
nari_ joined #ruby
<sdwrage> jrist-out: I am not talking about json
<Mon_Ouie> Jason. You called a method on jason, self is therefore jason in that method.
<jrist-out> lol
<jrist-out> k
savage- joined #ruby
<sdwrage> Mon_Ouie: and if I did the same thing with @?
<sdwrage> jason.methodwithatsymbolinside
<sdwrage> what would that reference?
<ceej> why does encoded_xml = xml.encode :xml => :attr wrap the string in quotes?
<Mon_Ouie> Instances variables of self, i.e. jason
bigkm joined #ruby
<Mon_Ouie> ceej: because attributes in XML are wrapped in quotes
Banistergalaxy joined #ruby
<Mon_Ouie> <a href=…> => that … is the attr
<envygeeks> is there a way to tell YAML to load the key's as symbols for easy deep_merging or should I just do it myself?
<sdwrage> Mon_Ouie: so… essentially they both work the same? 0_o
<ceej> Mon_Ouie: is there a string function that encode html? turning < into &amp; ? or do I have to use CGI?
<sdwrage> @var would give the same as self.var ?
<Mon_Ouie> No
<sdwrage> :S
<Mon_Ouie> self.var calls a method, @var retrieves an instance variable
<sdwrage> ohhh
<sdwrage> calling the attr_accessor methods
randym joined #ruby
<sdwrage> self.var would call the var and var= methods
<sdwrage> depending on context
<Mon_Ouie> ceej: Maybe you just want :xml => :text?
<ceej> Mon_Ouie: then it doesn't encode the quotes
<sdwrage> where as @var calls var directly without calling their methods
stumpydwarf joined #ruby
<apeiros_> Mon_Ouie is on a helping-spree…
<ceej> Mon_Ouie: I guess I'll just have to use CGI.escapeHTML(xml) :/
j3r0m3 joined #ruby
mikepack joined #ruby
tomzx joined #ruby
austinbv joined #ruby
conor_ireland joined #ruby
conor_ireland joined #ruby
younerd joined #ruby
r0bby_ joined #ruby