apeiros_ changed the topic of #ruby to: programming language || ruby-lang.org || Paste >3 lines of text in http://pastie.org || Rails is in #rubyonrails
randym has joined #ruby
BryanWB has joined #ruby
mikeycgto_ has joined #ruby
rhce7320 has joined #ruby
CombatWombat has joined #ruby
kalv has joined #ruby
two- has joined #ruby
JC_SoCal has joined #ruby
artOfWar_ has joined #ruby
quest88 has joined #ruby
noyb has joined #ruby
tomzx has joined #ruby
tdelam_ has joined #ruby
tdelam_ has quit [#ruby]
jhowarth has joined #ruby
artOfWar has joined #ruby
dbgster has joined #ruby
sarmiena_ has joined #ruby
noyb has joined #ruby
shevy has joined #ruby
goodieboy has joined #ruby
affix has joined #ruby
Matt_S_G has joined #ruby
<jsonperl>
in a c extension i've created, ruby is calling the free function the first time the garbage collector runs
chrislgibson has joined #ruby
<jsonperl>
im unclear on how to mark the object appropriately so that the GC leaves it alone, anywhere anyone can point me?
frishi has joined #ruby
frishi has joined #ruby
davidboy has joined #ruby
John_____ has joined #ruby
eko has joined #ruby
eko has joined #ruby
wallerdev has joined #ruby
chrislgibson has joined #ruby
<jrhorn424>
what's the short, idiomatic way to pull items from one array into a new array conditionally?
<fowl>
Chemistry::Units::Molecules is a bit much to type out imo
<swarley>
you can just include Chemistry :p
<swarley>
and it assumes Units::Grams anyway
<fowl>
a more ruby way would be like 3.moles_of(:Hydrogen).to_grams
<swarley>
yeah i know
liluo has joined #ruby
<fowl>
i never include things
<fowl>
i leave all of the modules feeling left out
<swarley>
but 1 mole of Hydrogen is 1
<swarley>
lol
<fowl>
there's only room on my super nintendo for 1 player, and thats me
<fowl>
i went too far :/
<fowl>
killed the joke
sam113101 has joined #ruby
<swarley>
lol
sam113101 has quit [#ruby]
sam113101 has joined #ruby
nikhil_ has joined #ruby
joukokar has joined #ruby
tomzx has joined #ruby
nari has joined #ruby
banisterfiend has joined #ruby
savage- has joined #ruby
porto00 has joined #ruby
porto00 has quit [#ruby]
jcrossley3 has quit ["ERC Version 5.3 (IRC client for Emacs)"]
fbernier has joined #ruby
shtirlic_ has joined #ruby
MopMopperton14 has joined #ruby
gtuckerkellogg has joined #ruby
t0mmyvyo has joined #ruby
Tearan has joined #ruby
wroathe has joined #ruby
superguenter has joined #ruby
<wroathe>
It's been a long time since I've turned off my laptop and for some reason I have like 30 ruby processes listed in Activity Monitor. Does anyone know why ruby seems incapable of closing it's own processes?
<wroathe>
Or is it something I'm doing wrong?
<banisterfiend>
wroathe: becuase you forgot to close them ;)
<banisterfiend>
applications dont close by themselves, they need to be told ;)
lewix has joined #ruby
lewix has joined #ruby
<wroathe>
So if I execute a file with ruby filename.rb I'm also responsible for force quitting that process if it doesn't shut down :P
<Veejay>
banisterfiend: Now that you mention it, I have to say that I don't have the background to verify that what he's saying is true
<Veejay>
But nothing looks too far fetched
<banisterfiend>
wroathe: the program only shuts down when it's finished running or it's told to close; are you saying you tried to exit it but it didnt, and you had to resort to force quit?
<Veejay>
banisterfiend: Do YOU think it's bullshit?
<banisterfiend>
Veejay: i didnt read it ;)
<Veejay>
OK
<Veejay>
It's a nice video I think
<banisterfiend>
Veejay: cool
andrewhl has joined #ruby
wyhaines has joined #ruby
bryricker has joined #ruby
ZachBeta has joined #ruby
lukevisinoni has joined #ruby
banisterfiend has joined #ruby
jbhewitt has joined #ruby
t0mmyvyo has joined #ruby
lewix has joined #ruby
lewix has joined #ruby
lewix_ has joined #ruby
jmfcool has joined #ruby
groovehunter has joined #ruby
wicchan has joined #ruby
maletor has joined #ruby
wicchan has quit [#ruby]
ZachBeta has joined #ruby
w_chan has joined #ruby
lordzero has joined #ruby
fayimora_ has joined #ruby
w_chan has quit [#ruby]
ZachBeta has joined #ruby
John has joined #ruby
sam113101 has joined #ruby
krz has joined #ruby
paradisaeidae has joined #ruby
acekiller has joined #ruby
<Quadlex>
I'm creating wrapper objects for an XML web service response
<Quadlex>
Is there a cleaner way then just creatting an attr_accessor for each bit of the response?
<Quadlex>
I'm trying to come up with something less manual but not having any success
<lordzero>
Wish I knew Quad, but then again I'm about as fresh with Ruby as one can be
radic_ has joined #ruby
blueadept` has quit ["Leaving"]
<paradisaeidae>
Quadlex: How about a hash or array?
<paradisaeidae>
What needs to be done with the response fragments?
adeponte has joined #ruby
ZachBeta has joined #ruby
tolland has joined #ruby
c0rn has joined #ruby
<tolland>
is there a windows idiom or feature that could be used similarly to the inode number, as a check as to whether some file has been deleted and recreated?
ZachBeta has joined #ruby
pygmael has joined #ruby
<Quadlex>
paradisaeidae: various things, depending on what they're for
<Quadlex>
Basically, the web service bundles lots of info together
<Quadlex>
a status retrieval call, for instance, returns 2 times, an enum, several bits of locational information, some information about the entire job, some address information
<Quadlex>
At the low level I'm writing a method to take a job_id and return a wrapper object with all the information
<Quadlex>
which can then be passed to business logic methods
<paradisaeidae>
Hokay. So you expect a xml-valid response?
<tolland>
i mean as a ruby call
<paradisaeidae>
The righ bat to hit this with is Nokogiri.
superguenter has joined #ruby
<paradisaeidae>
It could be used to accept buffer string until the xml is valid.
<paradisaeidae>
Concat response until xmlDoc.errors == nil.
<Quadlex>
Oh, the actual XML handling is not a problem
<Quadlex>
I'm at the level just above that. I'm getting back hashes and trying to decide whether or not to wrap them into a data object
<otters>
I need an SSH client that doesn't create a new session for every command
<Quadlex>
I'm from Java/C# Land so I'm trying to make sure I'm not holding onto insufficent tropes
<lordzero>
otters: awha?
<otters>
sorry, wrong channel
<lordzero>
rgr
wyhaines has joined #ruby
ZachBeta has joined #ruby
nfluxx has joined #ruby
zandt has joined #ruby
swarley has joined #ruby
looopy has joined #ruby
CheeToS has joined #ruby
zandt has joined #ruby
artOfWar_ has joined #ruby
eisenhowerz has joined #ruby
<eisenhowerz>
how come i can't do puts "current Time: " + Time.now but instead i have to pass it to a var time2 = Time.now and then do puts time2 ?
<eisenhowerz>
nvm. puts Time.now.inspect does it. erg
<pzol>
fivetwentysix: look at the gemspec definition: s.executables = ['bundle']
<fivetwentysix>
pool, sweet that did it
<fivetwentysix>
pzol: *
LMolr has joined #ruby
_jak has joined #ruby
<fivetwentysix>
pzol: am i suppose to ignore the .gem file?
shyam has joined #ruby
artm has joined #ruby
<pzol>
fivetwentysix: em… no why would you do that? the gem file is the output of your gem
arturaz has joined #ruby
heftig has joined #ruby
KL-7 has joined #ruby
<fivetwentysix>
pzol: yeah but do i commit that to github?
<fivetwentysix>
or what do i do with it
<fivetwentysix>
I'm not ready to release my gem yet
<fivetwentysix>
cuz it doesn't really do anything lol
<pzol>
fivetwentysix: use github as source repo… don't publish the .gem there…
<fivetwentysix>
pzol: and publish the gem to rubygems
<fivetwentysix>
pzol: right?
<shyam>
im getting this error undefined method `pdf_from_string' for #<WickedPdf:0x7f7513c55d70>
francisfish has joined #ruby
jgrevich has joined #ruby
<shyam>
any on one used WickedPdf
<pzol>
fivetwentysix: true… if you'd use `bundle gem` it would pregenerate a rake task to build a gem, install it locally and publish to rubygems… might be a good starting point
<fivetwentysix>
pool thats awesome
_null has joined #ruby
_null has joined #ruby
_null has joined #ruby
<thomasfedb>
Hey, is there any equivalent of [1,2,3].map {|el| el * 2} #=> [2,4,6] in Java?
_null has joined #ruby
_null has joined #ruby
<swarley>
thomasfedb, you'd fare better asking in #java or something
BiHi has joined #ruby
_null has joined #ruby
ephemerian has joined #ruby
hzlocky has joined #ruby
<hzlocky>
Guys I got problem with http://pastebin.com/XDUWrXD9 . I understand that class variable is beeing setted into module, but how I can set class variables of extended classes instead?
<arturaz>
thomasfedb, there was some functional library for java :)
_null has joined #ruby
KL-7_ has joined #ruby
mxweas has joined #ruby
timonv has joined #ruby
deadly_hcs has joined #ruby
_null has joined #ruby
bluenemo has joined #ruby
_null has joined #ruby
stefanp has joined #ruby
stefanp has joined #ruby
_null has joined #ruby
bier has joined #ruby
<thomasfedb>
arturaz, I've asked there also. Though I know at least here people will know what I'm looking for.
<jonteru>
hi, does anyone know how to properly deploy app to heroku, because i'm having problems with my clock events not firing.
Dreamer3 has joined #ruby
ziyadh has joined #ruby
<TTilus>
jonteru: heroku support/faq?
a_a_g has joined #ruby
shruggar has joined #ruby
<jonteru>
TTilus: Didn't seem find anything related to my problem
deadly_hcs has joined #ruby
d3vic3 has joined #ruby
sdeobald has joined #ruby
KL-7 has joined #ruby
xrfang has joined #ruby
KL-7_ has joined #ruby
Banistergalaxy has joined #ruby
Liothen has joined #ruby
Guest_ has joined #ruby
<xrfang>
I encountered strange problem with ActiveRecord::Base.send(). it seems is a rails problem, but I would like to confirm if send() method is really rails defined, or a basic ruby method?
KL-7 has joined #ruby
mdw has joined #ruby
francisfish has joined #ruby
Shrink has joined #ruby
<arturaz>
xrfang, basic ruby method, but it can be redefined
polysics has joined #ruby
<pooffck12342>
arturaz do u know anything about whenever by javan?
<leekspin>
Hey, how does one work with binary data in ruby ? Should I hold them as strings ? Because I need to unpack this data after reading, for example with string#unpack
pkondzior has joined #ruby
ZachBeta has joined #ruby
<scalebyte>
shevy: why do you hate java so much ?
baroquebobcat has joined #ruby
nikhil_ has joined #ruby
<shevy>
scalebyte it is a language that sells itself by the amount of lines a java programmer can create. the more lines, the better, the more worth things are that were created
PsiliPharm has joined #ruby
ZachBeta has joined #ruby
jmfcool has joined #ruby
nanderoo has joined #ruby
deadly_hcs has joined #ruby
deadly_hcs has joined #ruby
deadly_hcs has joined #ruby
deadly_hcs has joined #ruby
boram has joined #ruby
pawdro has joined #ruby
deadly_hcs has joined #ruby
deadly_hcs has joined #ruby
<pawdro>
hello, can anyone point me direction how to start writing parser of logical expressions in ruby?
<matti>
pawdro: Define "logical expressions"
<pawdro>
matti: i want to build the tree of expression like: (a&b) | (~b&c)
<Sp4rKy>
.W 1
deadly_hcs has joined #ruby
zetm has joined #ruby
<RubyPanther>
emacs is written mostly in C, it should be easy enough to replace LISP with Ruby for scripting
arium has joined #ruby
davidpk has joined #ruby
<arium>
Hey guys. Are there some tools to profile ruby scripts to see execution time for each method and see call graphs? I would like to see general image how Sinatra framework works
<geekbri>
Anybody have any clue why File.executable? would return false on a file that is clearly exectuable.
Synthead has joined #ruby
<geekbri>
ugh nevermind.
robkinyon has joined #ruby
<cpasmoi>
hum, i don't understand why require 'getoptlong' creates an error 'no such file to load' where I have the getoplong.rb in my laptop....
llaskin has joined #ruby
<llaskin>
is there a way to require a file that is "one up" in the directory tree"?
<cpasmoi>
and when i create a GetoptLong.new I have an error 'uninitialized constant Object::GetoptLong (NameError)'
Morkel has joined #ruby
bbttxu has joined #ruby
<cpasmoi>
llaskin: require_relative
<cpasmoi>
i guess
phantasm66 has joined #ruby
qwerxy has joined #ruby
Sailias has joined #ruby
sbanwart has joined #ruby
kevinbond has joined #ruby
<llaskin>
cpasmoi: yea but ruby 1.8.7 so no require relative, so another question why can't i do something like "require 'dir/dir2/dir3/file.rb'" ?
<llaskin>
it seems it won't let me go down multiple folders...
polysics has joined #ruby
<cpasmoi>
mhe
nanderoo has joined #ruby
Jackneill has joined #ruby
MetaCosm has joined #ruby
<llaskin>
mhe?
pkondzior has joined #ruby
liluo_ has joined #ruby
internet_user has joined #ruby
<shevy>
she
<shevy>
llaskin in ruby just use the absolute path. if you want the relative, use "../../bla"
<llaskin>
ok
<llaskin>
i guess is what i will have to do
araujo has joined #ruby
araujo has joined #ruby
crodas has joined #ruby
nemesit has joined #ruby
brandoncordell has joined #ruby
<cpasmoi>
I still don't understand why require 'getoptlong' creates an error 'no such file to load' where I have the getoplong.rb in my laptop....
Teomari has joined #ruby
<cpasmoi>
(i've tried a symbol link from 1.9.2 to 1.9.1 and the absolute path as well)
tatsuya_o has joined #ruby
<brandoncordell>
Sorry for the newbish question but I'm trying to write a loop that I don't exactly know how to tackle. Basically I have a list of proxies (host and port) in a hash. I want to loop through the hash, and only continue to the next key-value pair if an exception is not raised. What's the best way to approach that?
<cpasmoi>
.each , rescue, break ?
ryannielson has joined #ruby
pyreal has joined #ruby
<shevy>
set a flag variable, then use .each_pair, and dont continue if the flag variable has the wrong value
rbanffy has joined #ruby
<brandoncordell>
cpasmoi: do I need to use a begin block?
<brandoncordell>
or can I just use recuse
<brandoncordell>
rescue*
senthil has joined #ruby
moeSeth has joined #ruby
EvanR has joined #ruby
<senthil>
is it code smell to use Module for singleton pattern?
<shevy>
brandoncordell you use rescue when you want to rescue an exception that occurs
waxjar has joined #ruby
<shevy>
begin; faulty_code_that_can_break_goes_here; rescue; end
<zaargy>
not sure why you wouldn't just use a regexp there
<zaargy>
put the uri parse bit in a begin rescue block and add to errors when it's invalid
snip_it has joined #ruby
<matti>
zaargy: +1
davidcelis has joined #ruby
troessner has joined #ruby
froy has joined #ruby
stringoO has joined #ruby
Richmond has joined #ruby
kpshek has joined #ruby
Tomasso has joined #ruby
Jake232 has joined #ruby
jangell has joined #ruby
<zaargy>
matti: you're everywhere ;)
<matti>
zaargy: :)
llaskin has quit [#ruby]
<matti>
zaargy: Don't look under your bed then ;p
carlyle has joined #ruby
artOfWar has joined #ruby
gianlucadv has joined #ruby
chimkan_ has joined #ruby
cbuxton has joined #ruby
<LMolr>
is it possible to hijack a gem requirement? I am trying to install gem metric_fu on MRI 1.9.3 , which requires 'rcov', which doesn't compile on 1.9.3
SegFaultAX|work has joined #ruby
<LMolr>
rcov suggests "Please switch to simplecov", so i assume i can use that as dependency
nari has joined #ruby
artm has joined #ruby
srid has joined #ruby
<zaargy>
matti: ek scary
eka has joined #ruby
artOfWar has joined #ruby
savage- has joined #ruby
eywu has joined #ruby
pawdro_ has joined #ruby
Eiam has joined #ruby
fbernier has joined #ruby
<shevy>
penis
cha1tanya has joined #ruby
cloke has joined #ruby
superguenter has joined #ruby
ipoval has joined #ruby
superguenter1 has joined #ruby
jbw has joined #ruby
<matti>
zaargy: :)
mxweas_ has joined #ruby
<matti>
shevy: Oh noess!
<matti>
shevy: s/penis/pants/
<matti>
shevy: There might be women with small children here!
<matti>
;p
<shevy>
that should have scared them away
<shevy>
now we can talk about the real things again
<RubyPanther>
[[thufir]]: it is very strange to use the else to assign the result of puts to the var. Maybe it is intended but it looks like a bug.
<davidcelis>
LMolr: But it looks like metric_fu hasn't been touched for seven months.
eldariof has joined #ruby
<davidcelis>
LMolr: Hell, looks like the gem author hasn't even touched GitHub for ten months
zakwilson_ has joined #ruby
deryl has joined #ruby
fbernier has joined #ruby
robkinyon1 has joined #ruby
bluenemo has joined #ruby
bluenemo has joined #ruby
kaichanvong has joined #ruby
<[[thufir]]>
RubyPanther: oh, I'm probably using case wrong.
<[[thufir]]>
ok, so it's not the regex. in the first pass, no match, second pass, same file, same regex, it matches. so the case is wrong/buggy? https://gist.github.com/2205083
<LMolr>
davidcelis: thank you, i take a try :)
jrgifford has joined #ruby
jrgifford has joined #ruby
<RubyPanther>
[[thufir]]: think about what case does. What is the when shorthand for?
<[[thufir]]>
when is for if.
<RubyPanther>
yes but what sort of if? case foo ; when bar that is like saying if bar === foo
<RubyPanther>
so you have if (line =~ /^\s*Message-ID:/) === line
<RubyPanther>
that is unlikely to become true
<RubyPanther>
shorter: don't use case, use if/elsif
<RubyPanther>
unless you really do have some reason to prefer === over == _and_ you have a lot of whens that need to have repetition removed
<[[thufir]]>
oh, == versus = . doh. ok, plus, well, what I want to do isn't what I coded.
sandGorgon has joined #ruby
<RubyPanther>
Mostly when case is useful is when you say case foo ; when String ...
sandGorgon_ has joined #ruby
<RubyPanther>
But that only works for base classes in the rare case where you're totally sure that it wouldn't be a duck
yoklov has joined #ruby
<shevy>
I like ducks
<[[thufir]]>
right, the line. case (message id) then h.id = something, case (content) hten content = something else is what I want. kinda sorta getting syntax.
<[[thufir]]>
line is a string here.
<RubyPanther>
yeah, ducks are awesome, and they hate case
* [[thufir]]
goes off to futz with case
<RubyPanther>
use backspace
kreantos has joined #ruby
<kreantos>
hi
<kreantos>
did anyone of you ever tried to query dbpedia with ruby?
<RubyPanther>
[[thufir]]: Consider, if it isn't already clear: puts case Object.new ; when true ; "true" else "false" end
<shevy>
my code is duck approved and the longest case when menu I have is about 2000 lines of proud code
<RubyPanther>
true === Object.new will always be false.
mcwise has joined #ruby
pastjean has joined #ruby
pastjean has joined #ruby
pooffck12342 has joined #ruby
jmfcool has joined #ruby
sonkei has joined #ruby
ringotwo has joined #ruby
nfluxx has joined #ruby
<RubyPanther>
[[thufir]]: if you do use case with regexes, this is how: case "zomg" ; when /(omg)/ ; "O M G" else "fail" end => "O M G"
<RubyPanther>
because it will do /(omg)/ === "zomg" which is another way to match
apok has joined #ruby
<[[thufir]]>
the "if" for cats works, but the case doesn't. https://gist.github.com/2206528 ok, let me read all your helpful posts, pardon I was googling stuff. thanks for the help.
<RubyPanther>
It ___literally___ converts that to (s =~ /Cats(.*)/ ) === s before it runs it
Jake232 has joined #ruby
<[[thufir]]>
I don't know ===. I know == and = . need to google that.
<RubyPanther>
Just don't use case and you won't have to worry what it does. ;)
<[[thufir]]>
lol. I want === because that's used for case. so, what's wrong with === operator. that's specific for testing within case
Maxou56800 has joined #ruby
<RubyPanther>
You're trying to put a whole condition into the when, you already are trying to do an if elsif you just think it is called case
<[[thufir]]>
can I use begin/end or something?
bragh has joined #ruby
<RubyPanther>
*boggle*
sacarlson has joined #ruby
<[[thufir]]>
ok. maybe I'm going at this the wrong way. the e-mail/usenet post/whatever has values like "message-id" on each line. case:messageid, then h.id= something. case:from, then h.from = whatever. like that, does that make sense for the desired result?
ringotwo has joined #ruby
ringotwo has joined #ruby
<RubyPanther>
[[thufir]]: if you just listen and stop using case and use the normal Ruby idiom which is if, then it will be _easy_
<RubyPanther>
Maybe in some other language case does something different than what it does in Ruby, and is useful for general cases. In Ruby it is useful for only specific cases, and even then, it does nothing extra. It is not faster than the if/elsif would be. It saves a small amount of typing when all you want, for every condition, is to call the === method on the new object with the old object as the argument
<Notimik>
hi, is it possible to list or set breakpoint in sub modules with the ruby debugger?
greenarrow has joined #ruby
adamkittelson has joined #ruby
<[[thufir]]>
it's not the typing. I'm just not using it right. no worries, thank you all for the patience.
froy has joined #ruby
<Notimik>
or do have to use require 'ruby-debug' ?
Oog_ has joined #ruby
<Oog_>
in a my class' initialize i call a function with a block and in the block i access an instance variable @properties. there is no accessor for @properties. is it thus accessible in the block?
<RubyPanther>
if it wasn't about typing you would have switched to if/elsif as soon as you found out it is the appropriate idiom
stkowski has joined #ruby
shadoi has joined #ruby
<RubyPanther>
Oog_: yes, accessors are only accessors because you're going to use them that way, they have no special magic and instance variables are never protected or hidden
bbttxu has joined #ruby
<Oog_>
it seems like it isnt though...
<Oog_>
if i add attr_accessor :properties then my code works...
<Oog_>
let me paste
<RubyPanther>
attr_accessor it just metaprogramming that creates a getter and setter
<shevy>
duck punching is even worse. I dont think I know anyone using that term
swarley has joined #ruby
<[[thufir]]>
rippa: thx
<shevy>
why would you want to punch ducks anyway?
<swarley>
because
<swarley>
damn ducks and their smug faces
<csavola>
shevy: cause they are scarey and always watching?
<swarley>
thinking theyre better than me
<shevy>
swarley, I'd take a duck into bath, not sure I'd take you :)
<RubyPanther>
[[thufir]]: honestly that is awful code, there is _no_reason_ not to just use an if there, and lots of reasons not to... for example, the giant pit you already fell into trying to use case for an if
<Oog_>
makes it equal itself if it is non nil else {}
<davidcelis>
right
<Oog_>
properties = properties || {} right?
<davidcelis>
it also returns @properties
releod has joined #ruby
<Oog_>
yes
releod has quit [#ruby]
<Oog_>
ruby is quite different from all the languages im used to so this should be intersting...
<davidcelis>
that's way better, by the way
<swarley>
yes much
<davidcelis>
your second pastie
<davidcelis>
one nitpick though, i don't think people tend to reduce the indentation of `protected` or `private` like that
<davidcelis>
or at least, i don't. i don't actually know what the convention on that is.
<Oog_>
everything should be indented one more level?
<Oog_>
or i guess just protected and down
shruggar has joined #ruby
<swarley>
i've never used protected
<swarley>
or public, or private
<davidcelis>
Oog_: No I mean, it should be at the same indentation level as your method definitions
<Oog_>
oh
<Oog_>
ok i can do that thanks
<davidcelis>
Oog_: It's doesn't start a block itself, so it would just sit at the same indentation level
<davidcelis>
It doesn't*
<rippa>
public, private and protected are just methods
<davidcelis>
yep
<swarley>
lolwut
<swarley>
there is an emoji file in the ruby source?!
<Oog_>
can you have one line method efs?
<Oog_>
defs ?
<swarley>
yes
<swarley>
you use ; to denote where the newline would be
<Oog_>
def params; @params ||= {}; end
<Oog_>
good or bad?
<swarley>
uh
<swarley>
tough call
<csavola>
Oog_: ugly
<Oog_>
ok ill avoid that
ycy has joined #ruby
<ycy>
hi there
<davidcelis>
Oog_: If it's just a one-liner that returns a boolean, it's perfectly fine
<davidcelis>
though something like this is better
<ycy>
I have a class (FooClass) with two class variable (@@A, @@B): is there a way to declare a public access to these class variables? Something like attr_reader :A, :B
<shevy>
no
<ycy>
so i have to manually declare a def function that returns the values?
<davidcelis>
Oog_: You can avoid the semicolons if you stick parens on the method def
<ycy>
(sorry for the italian, i was just saving you some other dumb questions from him)
<Oog_>
ok last question for now - when should you use self and when not? it is optional like 'this' in c++ right unless you need to differentiate between shadowing right?
<gysi>
ma che dici ho scaricato una versione di mirk dove non sono abituato rippa
<Oog_>
ie if i have a private method config should i self.config or config in init
<shevy>
ycy you can return those class variables via a method, but a more important question is why you really need class vars and not instance vars
twinturbo has joined #ruby
<swarley>
Oog_, self isnt needed unless you're doing something like
<swarley>
self[]
<swarley>
if you have the [] method define
<swarley>
or
<shevy>
I think active record has cattr_reader specifically for class variables, but it is such an ugly hack
<rippa>
or self.class
<RubyPanther>
shevy: You don't have to be gay to be a Madonna fan, haven't you seen the Human Nature video?
<swarley>
if you are doing an operation on the instance
<davidcelis>
Oog_: yep, most of the time self is explicit if you've defined a method that you're calling
<ycy>
shevy: they are constant but must be accessed from another class
<csavola>
Oog_: Correct you only "need" it for shadowing or the bracket methods... you may want it for clarity though
<davidcelis>
er, implicit*
gysi has quit [#ruby]
<RubyPanther>
And for the record, we don't know this duck's gender, we only know it looks and quacks like a duck
<shevy>
RubyPanther I dont think I have seen that video. and madonna today is a shadow of her former self
<RubyPanther>
even Goddesses age
eric_crane has joined #ruby
<ycy>
given the question by swarley , I can change my point of view: is there a way that a class access the class variable from another class (without specifying getters/setters)?
schovi has joined #ruby
<Oog_>
wait one more question... i want my object to respond to foo.X where x is anything... is there like a wildcard method
<csavola>
Oog_: method_missing
<davidcelis>
^
<RubyPanther>
ycy: not without asking the class that owns it, so yes or no depending on what you meant
<davidcelis>
Oog_: that sounds like a bad idea though
<davidcelis>
Oog_: you cannot possibly define infinite methods
<ycy>
RubyPanther: what do you mean by "asking the class" ?
<rippa>
you don't need to
<davidcelis>
Oog_: why would you want to do that?
<rippa>
with method_missing
<davidcelis>
rippa: correct, but WHY would he want to do this?
<Oog_>
so there is a Hash @properties but i dont want to make @properties public
<Oog_>
but i dont want to define all the getters for the properties that are valid
<Oog_>
so i just want to do foo.a or foo.b and if a exists then i return self.properties["a"]
banisterfiend has joined #ruby
<Oog_>
if not itll just return nil or ""
<rippa>
davidcelis: at Aperture Science we don't ask "why?", we ask "why not?"
<davidcelis>
Oog_: sounds like you're trying to turn Ruby into JavaScript ;)
<csavola>
rippa: 'cause I do not want rocket fuel blood?
<rippa>
Oog_: I'd rather define #[]
<ycy>
thank
<ycy>
you
<RubyPanther>
(usually not advised)
<Oog_>
[] sounds like a good idea
Faris1 has joined #ruby
sarmiena_ has joined #ruby
IrishGringo has joined #ruby
RORgasm has joined #ruby
brianpWins has joined #ruby
asuka has joined #ruby
sepp2k has joined #ruby
Prezioso has joined #ruby
statix has joined #ruby
superguenter1 has joined #ruby
<Oog_>
so if i have attr_accessor :location and in an instance method i do location = "blah" that is using the accessor right? it wont create a "local" variable ala string local; in c++ and shadow the accessor?
<Oog_>
is there anyway to explicitly define a local var?
<baroquebobcat>
Oog_: location = "blah" will create a local var location, to use the accessor you need self.location = "blah"
<Oog_>
ah...
<Oog_>
i thought since the accessor was in scope it would use it. so for accessors you ahve to always use self?
<shadoi>
no, don't use self.location, use @location
<shadoi>
@location is an instance variable.
<csavola>
shadoi: he's using lazy instatiation and would like everything to be pushed through accessors
<Oog_>
yes
qwerxy has joined #ruby
ghvandoorn has joined #ruby
sacarlson has joined #ruby
wmoxam has joined #ruby
TNTechnoHermet has joined #ruby
hadees has joined #ruby
<shadoi>
Sounds more like you want OpenStruct
Tomasso has joined #ruby
ben225 has joined #ruby
<shadoi>
Yeah… from reading back, you definitely want to use OpenStruct
gvd has joined #ruby
gianlucadv has joined #ruby
LMolr has joined #ruby
ReachingFarr has quit [#ruby]
<Oog_>
shadoi: interesting... well it is working with a hash.. this will do for now but that is good to know of
<Oog_>
with open struct though can i use [] ?
<Oog_>
because when i set i will have the key value in a variable
<Oog_>
and i cant do mystruct.variable = value
<Oog_>
mystruct[variable] = value
<shadoi>
yeah it'd work fine
JohnBat26 has joined #ruby
<shadoi>
you'd just call the accessors with the [] key
<Oog_>
hmm
cmarques has joined #ruby
<chovy>
how do i test if a string contains 2 or more vowels?
straind has joined #ruby
interne__ has joined #ruby
<Oog_>
shadoi: im trying OpenStruct TypeError: superclass mismatch for class XMLBase
<Oog_>
class XMLBase < OpenStruct
<Oog_>
hmm i guess it doesnt like reloading files when the superclass changes
Squarepy has joined #ruby
Squarepy has joined #ruby
akemrir has joined #ruby
Aaton has joined #ruby
LowKey has joined #ruby
TTilus has joined #ruby
timonv has joined #ruby
hooper has joined #ruby
ycy has quit [#ruby]
yoklov has joined #ruby
<shadoi>
Oog_: odd, I do the same thing
shruggar has joined #ruby
<shadoi>
Oog_: unless XMLBase is a subclass, that's probably the difference
<Oog_>
yep
theRoUS has joined #ruby
theRoUS has joined #ruby
cha1tanya has joined #ruby
<Oog_>
how odd... with private accessors you cant call self.X
<shadoi>
because .X are always public instance methods
<shadoi>
that's… sort of the definition of public.
Nisstyre has joined #ruby
<shadoi>
You can go in the backdoor with .send()
<shadoi>
bad habit though
<Oog_>
but someone else told me doing location="" with a location accessor would make a local location variable... now this doesnt seem to be true
foo-bar-_ has joined #ruby
<shadoi>
it makes a local
<shadoi>
but that's just a normal local
<shadoi>
same with or without an accessor
<csavola>
Oog_: you called the meta method after declaring private methods... which mean that you cannot have an explicit receiver
x1337807x has joined #ruby
<Oog_>
shadoi: i swithed to OpenStruct but using [] gives an error NoMethodError: undefined method `[]=' for #<NRD::Job>
<shadoi>
you need to define []=
<shadoi>
it's not a normal accessor
ilyam has joined #ruby
nemesit has joined #ruby
<x1337807x>
I think it would make sense for my program to have class methods on a module that I mixin to add search functionality. Is it possible to do that without some horrific code?
<Oog_>
shadoi: ok once i define it how do i actually do the set value on OpenStruct
artm has joined #ruby
<shadoi>
Oog_: def []=(key,value); self.send("#{key}=", value); end
emmanuelux has joined #ruby
<Oog_>
it works! thanks everyone hoepfully now ill be a little faster at things...
<shadoi>
x1337807x: yes.
<x1337807x>
shadoi: thank you
<shadoi>
I used to recommend people look at ActiveRecord::Base#find but …. not so much anymore.
wallerdev has joined #ruby
kirun has joined #ruby
internet_user has joined #ruby
williamcotton has joined #ruby
williamcotton_ has joined #ruby
baroquebobcat has joined #ruby
havenn has joined #ruby
mcwise has joined #ruby
williamcotton has joined #ruby
Tearan has joined #ruby
<RubyPanther>
Oog_: because location = "" doesn't call the accessor, it sets a local, you'd need self.location = "" to hit the accessor
<Oog_>
RubyPanther: but the accessor is private
jrist has joined #ruby
<Oog_>
or do accessors when you use attr_* have no visiblity? maybe my problem is i self defined the "accessor" ?
<RubyPanther>
Oog_: normally nothing should ever be "private" in Ruby, you should be using protected in 99%+ cases
davidpk has joined #ruby
rbrooks_ has joined #ruby
pgpkeys has joined #ruby
<Oog_>
RubyPanther: ah :) ok... let me read up on this.
ScottNYC has joined #ruby
csprite has joined #ruby
<shadoi>
ugh… -w is super anal about initialization.
<shadoi>
should I really initialize everything to nil before doing defaults and such?
dylukes has joined #ruby
<dylukes>
Am I the only one unable to get the nowrap option to pygments.rb working?
looopy_ has joined #ruby
<Tasser>
dylukes, depends
<dylukes>
It just seems it's ignoring options other than :lexer
<Oog_>
RubyPanther: yeah private does not seem like what i need it just seems problematic...
<chico>
if you clone an openstruct, why it doesn't carry its methods to the cloned object?
wyhaine__ has joined #ruby
<Oog_>
when would you use it?
<Oog_>
create singleton?
francisfish has joined #ruby
justinmcp has joined #ruby
<RubyPanther>
Oog_: it is useful in the core Ruby classes for implementation-specific details that aren't part of the API and shouldn't be relied on/documented
twinturbo has joined #ruby
<shadoi>
chico: you're duplicating the whole object, which includes all the data (which in this case creates dynamic methods, etc)
Sly__ has joined #ruby
<RubyPanther>
or if you're creating a large library that already has a lot of "protected" stuff and then you really do need to hide something further... like in Rails for example you might have a private method in application_controller.rb that is only used for the (protected) methods there and isn't available to real controllers
<RubyPanther>
in 7+ years with rails I think I've needed to do that... zero times.
<chico>
shadoi: i'm not sure i understand
dknight has joined #ruby
<shadoi>
chico: if you read the docs on the clone method it tells you it copies the instance variables
<chico>
shadoi: shouldn't the 'triggers' for dynamic methods be duplicated too?
<dknight>
if I have a gem installed at /usr/lib/ruby i.e. installed by root, is it not available to other users in liux?
<shadoi>
chico: not sure what you mean by triggers
Sly__ has quit ["Leaving"]
<dknight>
]/j #archlinux
<chico>
shadoi: ah, i see, thank you
fukushima has joined #ruby
JNZ` has joined #ruby
<shadoi>
chico: you can override the initialize_copy to change the behavior
<dknight>
I have installed some gems as root but my normal user is unable to access it
<dknight>
please help me understand how my normal user can access them?
Evixion has joined #ruby
CombatWombat has joined #ruby
virunga has joined #ruby
parus has joined #ruby
superguenter has joined #ruby
Jackneill has joined #ruby
waxjar has joined #ruby
KL-7 has joined #ruby
pygmael has joined #ruby
dylukes has quit ["Pipes are broken. Sending packets via Fedex."]
albemuth has joined #ruby
foo-bar- has joined #ruby
apeiros_ has joined #ruby
virunga_ has joined #ruby
hukl has joined #ruby
ipoval has joined #ruby
dzhulk has joined #ruby
alex__c2022 has joined #ruby
h4mz1d has joined #ruby
RORgasm has joined #ruby
senthil has joined #ruby
iocor has joined #ruby
hidensoft has joined #ruby
RORgasm_ has joined #ruby
lopex has joined #ruby
multibot_ has joined #ruby
Squarepy has joined #ruby
<davidcelis>
stop installing gems as root
<apeiros_>
why? it's not my fault my parents named me root!
<davidcelis>
damn hippie parents
<apeiros_>
sudo mv davidcelis root
<davidcelis>
:(
artOfWar has joined #ruby
sdeobald has joined #ruby
Squarepy has joined #ruby
Dr4g has joined #ruby
Oddnoun has joined #ruby
QKO_ has joined #ruby
parus has joined #ruby
symb0l has joined #ruby
choffstein has joined #ruby
x1337807x has joined #ruby
gianlucadv has joined #ruby
symb0l has joined #ruby
AxonetBE has joined #ruby
iocor has joined #ruby
kesor has joined #ruby
<kesor>
is there any use for object identity in ruby? for example with string objects that have the same value?
<heftig>
chovy: list.repeated_permutation(count).each do |word|
<heftig>
well, not strictly
<heftig>
it'd be an array of chars and not a word
<heftig>
but correcting that should be trivial.
sekretskwerl has joined #ruby
<sekretskwerl>
is there a socket.io library for Ruby?
<sekretskwerl>
gem, rather
<heftig>
what's socket.io?
<sekretskwerl>
its a socket io library that has several types of sockets that it abstracts
<heftig>
ruby has 'socket'
<sekretskwerl>
yes.
symb0l has joined #ruby
<sekretskwerl>
i want to use socket.io with EventMachine. I found a socket.io library on github, cloned it and did 'rake gem' but, it had abunch of bugs and wouldn't compile.
timonv has joined #ruby
<sekretskwerl>
I need a working socket.io implementation (perhaps in Cramp? The documentation for Cramp is really lacking)
<sekretskwerl>
although, the git repo was supposed to be a Cramp plugin
<sekretskwerl>
otherwise, I will get stuck with NodeJS for my project.
<heftig>
didn't eventmachine already have its own evented socket implementations?
<sekretskwerl>
socket.io is not just a socket
sam113101 has joined #ruby
mcwise has joined #ruby
tatsuya_o has joined #ruby
maahes has joined #ruby
<sekretskwerl>
no one know of a gem?
<sekretskwerl>
perhaps I can use Juggernaut-ruby
<heftig>
em-websockets?
<sekretskwerl>
no
<sekretskwerl>
em-websockets is only websockets, it doesn't abstract other types of sockets with it.
* apeiros_
soon got a buzzword bingo
jbw has joined #ruby
ed_hz_ has joined #ruby
<sekretskwerl>
apeiros_: abstract and socket are buzzwords?
_bart has joined #ruby
<arturaz>
sekretskwerl, I highly recomment celluloid-io
<arturaz>
recommend :)
<arturaz>
threaded+evented io, mix as you like
S1kx has joined #ruby
S1kx has joined #ruby
davidpk has joined #ruby
<arturaz>
i've recently switched to it from EM
<arturaz>
and it's a breeze.
<arturaz>
i'm loving it
<sekretskwerl>
arturaz: does it do web and flash sockets?
thone has joined #ruby
oposomme has joined #ruby
<arturaz>
sekretskwerl, we're using it for flash sockets
<arturaz>
flash sockets are just regular tcp sockets
<arturaz>
as probably websockets are
<arturaz>
haven't used it for those though
<sekretskwerl>
my project is taking an application that used to be a telnet application, and turning it more modern with a jquery client and using web/flash sockets.
<sekretskwerl>
arturaz: websockets do inherit from tcp sockets, but there's an extra layer to them. i'm not sure on the details of implementing them from a tcp socket.
<sekretskwerl>
i'm mostly trying to avoid having to do the project in nodejs
<sekretskwerl>
the server, at least.
<sekretskwerl>
with Juggernaut-ruby gem I could use Rails to talk to NodeJS server
Faris has joined #ruby
* apeiros_
gets the impression people think that the 'web' part of 'websocket' is layer 4…
<arturaz>
sekretskwerl, well, one thing that you can avoid with celluloid is unholy mess of the callbacks :)
<shadoi>
sekretskwerl: is there a problem with using it?
<sekretskwerl>
shadoi: Cramp?
<shadoi>
yes
<sekretskwerl>
no, I was reading over Cramp docs quite a bit, trying to figure out if it would work.
<sekretskwerl>
my attraction to socket.io over WebSocket is that not everything supports WebSocket
<sekretskwerl>
and socket.io takes care of being like "oh, lets use a flash socket" or one of the other types for you
nerdy has joined #ruby
<sekretskwerl>
so i'm basically just trying to find a method of attack that requires the least bit of setup/prep/reinvention
yawniek_ has joined #ruby
<shadoi>
sekretskwerl: it's just syntactic sugar to make them behave the same. You would need to add support for different socket types to something like Celluloid::IO to get equivalent abstractions in Ruby.
<shadoi>
sekretskwerl: but seriously, fuck Flash. :)
<sekretskwerl>
shadoi: i'm just not familiar enough with their implementations to do that.
<sekretskwerl>
lol
<sekretskwerl>
well, Flash is supported by like...everything.
<sekretskwerl>
WebSocket isn't
<shadoi>
Node has done more work to make this simpler (sometimes with devastating side-effects).
sam113101 has joined #ruby
<shadoi>
But if you want easy, Node.js is probably easier for a websocket/flash socket abstraction.
<arturaz>
sekretskwerl, i can give you the code for flash server on celluloid :)
<sekretskwerl>
shadoi: did you look at the git code I linked? that is called 'socketio', but I'm not sure what its doing precisely.
<shadoi>
it probably uses that plugin
maahes has joined #ruby
<shadoi>
looks like a compat layer for socket.io on the client
<sekretskwerl>
im thinking of just creating a fibered, evented WebSocket server
<sekretskwerl>
and saying "use a modern browser"
<sekretskwerl>
which IE9 apparently isn't :P
<shadoi>
sekretskwerl: Cramp is a evented websocket server that uses fibers.
<shadoi>
don't reinvent it :)
<shadoi>
If anything, add features to celluloid.
<sekretskwerl>
shadoi: yeah, so, I guess if I just bite the bullet and use WebSocket-only, I'll just run with Cramp.
<sekretskwerl>
shadoi: WebSockets are the future anyway, wouldn't you say
<sekretskwerl>
for things that need a full socket, anyhow
<shadoi>
yeah, now that they actually finished the protocol
<sekretskwerl>
oh they did?
<sekretskwerl>
sweet, i thought it was still in flux and that was another thing that was bothering me.
Zolrath has joined #ruby
jrist has joined #ruby
<shadoi>
ok, "finished" being a very flexible term in the case of the w3c :)
<sekretskwerl>
lol
srnty has joined #ruby
<sekretskwerl>
"finished" like wireless N was for 10000 years?
<shadoi>
yeah
<shadoi>
there are at least revisioned documents for the protocol now.
<sekretskwerl>
"You can very easily fallback to flash sockets if the browser doesn’t have WebSockets support. Check out the web-socket-js library by Hiroshi Ichikawa, which does exactly that. Cramp will “just work” with the web-socket-js library."
ctwiz has joined #ruby
<sekretskwerl>
so all I have to do is throw the files in the server's directory and Cramp will use it if needed?
mxweas_ has joined #ruby
Eiam has joined #ruby
froy has joined #ruby
<shadoi>
try it and see
trivol has joined #ruby
<Tomasso>
how do you change the key from a key,value pair from a Hash?
gogiel has joined #ruby
superguenter1 has joined #ruby
<shadoi>
Tomasso: you create a new one and delete the old one.
nfluxx has joined #ruby
JwbF75ug has joined #ruby
<Tomasso>
mm shadoi , by iterating on each pair?
<shadoi>
if that's what you need to do…
<shadoi>
hash[:new_key] = hash.delete(old_key)
<shadoi>
if you just need a one-off
<shadoi>
(delete returns the value)
mmokrysz has joined #ruby
<Tomasso>
got it, thanks xD
_2easy has joined #ruby
mmokrysz has quit [#ruby]
<arturaz>
% a = {:foo => :bar}; a[:baz] = a.delete(:foo)
<multibot_>
bar
<arturaz>
% a = {:foo => :bar}; a[:baz] = a.delete(:foo); a
<multibot_>
{:baz=>:bar}
<arturaz>
i <3 multi_io
<arturaz>
i <3 multibot_
<arturaz>
err
<arturaz>
;D
<methoddk>
anyone good with CSS animations? I tried asking in #css and #jquery (related to both) but no one would answer
flakrat has joined #ruby
sbanwart has joined #ruby
simpleharmonicmo has joined #ruby
markb has joined #ruby
Faris has joined #ruby
maahes has joined #ruby
n1x has joined #ruby
ephemerian has joined #ruby
<robacarp>
methoddk: what sort of animation are you trying to accoumplish?
<pgpkeys>
just asking if someone is good with something would probably be why. ask specific, informative, concise, and on-topic would probably help :)
<methoddk>
a simple fade out
<methoddk>
I fade an element in after an AJAX request for it
<methoddk>
and then fade it out on a click
<methoddk>
the fade outs don't work in chrome or ff
snip_it has joined #ruby
<methoddk>
but are flawless in Safari
<shadoi>
methoddk: use a library that hides cross-browser bullshit.
<methoddk>
like what?
zakwilson has joined #ruby
<robacarp>
well, you can post the code if you want, but if you're doing the animation with javascript I don't really want to look at it.
Guest__ has joined #ruby
<methoddk>
robacarp the animations are done in CSS, I use JS to change the classes of the element
<methoddk>
to trigger the animation
adeponte has joined #ruby
<shadoi>
methoddk: there are thousands, this isn't really a #ruby question though :)
<shadoi>
artm: I reinitialize logger everytime in that example, you'd probably want to pass that around as a constant or something.
<artm>
i'm still to stuck to how I imagined it should have looked, trying to imagine it your way
<shadoi>
artm: that way you can set it to log extra info when $DEBUG is set and none of your usage changes
<shadoi>
input_image.lighter.theshold(…)
<shadoi>
should never change based on what logging info you want to see
skrewler has joined #ruby
<artm>
only problem is how to come up with filenames then
<artm>
because I save images you see
i8igmac has joined #ruby
<shadoi>
that should be a separate method
<shadoi>
save_file or something
<artm>
yeah, i have save file
<shadoi>
yeah, just don't do that as part of logging, that's weird.
<artm>
why?
<shadoi>
logging may need to report errors in the save method.
<artm>
no, my logging is to see what is happening to image as it is processed
<artm>
I log an html and images
<artm>
html refers to those images
<shadoi>
Sure, but I'm saying you should make logging a generic thing, and use it to report not only information about the task your doing, but also about the state of your program.
<artm>
I don't need that
<shadoi>
yet.
<shadoi>
you will.
superguenter has joined #ruby
gmarcilhacy has joined #ruby
ipoval has joined #ruby
<gmarcilhacy>
Hi!
<artm>
yeah, but then I'll use some existing logging library for that sort of logging
<shadoi>
you can always make a "save_and_log" method that does both things, I'm just saying build it so that you don't reinvent the wheel just to add sparkling rims.
<shadoi>
that sort of usage change will be a big pain in the ass down the road.
<gmarcilhacy>
I am running tests through a rake tasks, and I want to stop the task if one test fails.
Faris has joined #ruby
<gmarcilhacy>
Should I override "puts" and see if it contains the work "error"?
looopy has joined #ruby
liluo has joined #ruby
<robacarp>
gmarcilhacy: this sounds like a bad idea.
nobitanobi has joined #ruby
oposomme has joined #ruby
<gmarcilhacy>
What can I do then?
oposomme has joined #ruby
<robacarp>
why do you want to prevent the rest of the tests from running?
<artm>
shadoi: if I save_and_log() inside the individual operations I'm still left with the problem that I don't know what to call the image. hmm... may be I should just name them with timestamps or something like that...
<gmarcilhacy>
I first want to run my tests, and if everything passes, deploy to production (heroku)
<robacarp>
oh I see.
thoradam has joined #ruby
Aaton has joined #ruby
<gmarcilhacy>
any idea? :D
<robacarp>
well, I would probably try and check the exit status of the test suite
<artm>
robacarp: if it fails rake won't continue, no?
<robacarp>
hopefully they're returning some nonzero value when tests fail, but idk.
<robacarp>
artm: yea, I'd hope so.
<gmarcilhacy>
if the rake task fails yes, but not if the test fails
<artm>
gmarcilhacy: which testing framework you use?
<gmarcilhacy>
test unit
Aaton has joined #ruby
<artm>
and if test fails it doesn't return error code?
tomku has joined #ruby
Faris has joined #ruby
<gmarcilhacy>
no
<shadoi>
artm: you can use the object hash as a filename, or generate random filenames with timestamps… lots of solutions to that.
Mcilvena has joined #ruby
<artm>
shadoi: problem is the image library is not mine, but the image algorithms (the "something_complicated" methods from my paste) are. so it's still easier for me to insert logging there.
madhatter has joined #ruby
<shadoi>
artm: override the method, use your own that does your logging.
<shadoi>
call super to execute the original method.
<artm>
right.
hadees has joined #ruby
havenn has joined #ruby
danielvdotcom has joined #ruby
albemuth has joined #ruby
<artm>
and to make all images use the same logger i need to make it global or something
<artm>
pff... what is "aspect oriented programming" then?
<artm>
oh what, google
<shadoi>
aka Mind-fuck programming.
<klip>
it's hardcore if you do it yourself :) but there are some libs for that :)
<klip>
not sure how uptodate they are
<artm>
no, I think I'm already overcomplicating this project
<klip>
:)
artOfWar has joined #ruby
<shadoi>
It'd be fine if it were builtin and idiomatic, as it is, it's extremely confusing to look at code like that when you're trying to figure out what a program does.
<artm>
all I want is to see what's going on as image gets processed
MasterIdler has joined #ruby
<shadoi>
artm: the mixin I sent you is mostly a standard ruby way of doing this.
<artm>
except for save image part and there we go again :)
<shadoi>
no it's still the same
bwlang has joined #ruby
<shadoi>
like I said, split logging from file saving and you're good to go.
<artm>
may be I should just take existing logging library and mix "save image" into it :)
noname has joined #ruby
<shadoi>
artm: the end result is almost identical to what I gave you, just add another method called "save_and_log", etc.
<artm>
but I don't want to split. I want to see images in context. what were operations and their paramters. what were analysis results
<artm>
hmm
<artm>
the save_image() should log what it saved
<shadoi>
yes
<shadoi>
exacrtly
<artm>
then the image name will appear in context
<artm>
yeah!
<artm>
thanks
<artm>
you see, I was just still inside my box
<shadoi>
yeah it's hard to step back
<artm>
thank you for getting me out
<shadoi>
I usually just think "If I wanted to use this in more than 1 place, how would I do it?"
<shadoi>
forces you to not tightly-couple behaviors
<artm>
I'm afraid to think that too early, we have tiny budgets :)
<shadoi>
It saves you a TON of time later on.
<shadoi>
trust me.
<shadoi>
That's money.
<artm>
ok, now that i'm convinced i can do with a normal logging library, any suggestions? personal favorites? :)
greywolf` has joined #ruby
<shadoi>
I just use logger
<shadoi>
(like I did in that mixin)
artOfWar has joined #ruby
<artm>
ah, 'logger' is in standard library?
<shadoi>
yes
* artm
smacks himself on a head with a thick manual
sbanwart has joined #ruby
trkemist has joined #ruby
<trkemist>
I have a question
<trkemist>
what is the best way to learn ruby and rails for someone who has been on the technology side of it for most of his career?
<shadoi>
artm: now you can add as much debugging as you like using: log.debug, and you will only see it if you set the logger.level to 0
<shadoi>
trkemist: technology side of it?
Mcilvena has quit [#ruby]
<shadoi>
trkemist: you mean non-technical? or what
Mcilvena has joined #ruby
<trkemist>
No i mean systems admin/networking engineering/network architecture
<trkemist>
not a developer
<artm>
it like IT
<trkemist>
Oh yeah IT
<trkemist>
sorry.. I didn't realize i put it in lowercase
<artm>
my method (for ruby) is each time I think perl or awk or bash, I figure out how they do it in ruby.
SolarisBoy has joined #ruby
<shadoi>
trkemist: personally I'd recommend learning ruby first, and then moving on to rails.