<realDAB>
gogiel: i'm stumped. if you use define_method it works as you'd expect, but i don't know why the nested def's don't work and why that weird result happens.
piotr_ has quit [Ping timeout: 245 seconds]
<shevy>
Hanmac lol
realDAB has quit [Read error: Operation timed out]
tcstar has quit [Quit: Leaving]
anonymuse has quit [Quit: Leaving...]
daniel_- has quit [Quit: WeeChat 0.3.9.2]
<lewix>
realDAB: ok. I think i need to find myself a proper definition of protected methods.
dmiller1 has joined #ruby
Dreamer3 has quit [Quit: Leaving...]
arya__ has quit [Ping timeout: 255 seconds]
predator217 has joined #ruby
tjbiddle has joined #ruby
<banister`sleep>
lewix: no they cant
MehLaptop has quit [Remote host closed the connection]
Pandaen has joined #ruby
<lewix>
banister`sleep: oh wait a minute I think I know where my issue lie
<banister`sleep>
lewix: and if you think so, you hva to provide example code illustrating why you think so
<banister`sleep>
:)
<lewix>
banister`sleep: when you say "objects of the same class" you don't mean instances but objects used in the same class?
enebo has quit [Quit: enebo]
dmiller has quit [Ping timeout: 276 seconds]
<banister`sleep>
lewix: no...i mean instances of the same class
<lewix>
lol
aedornm has joined #ruby
tjbiddle has quit [Client Quit]
mercwithamouth has joined #ruby
predator117 has quit [Ping timeout: 260 seconds]
poikon has joined #ruby
arya__ has joined #ruby
_nitti has joined #ruby
gabrielrotbart has quit [Read error: Connection reset by peer]
Rioji has quit [Remote host closed the connection]
gabrielrotbart has joined #ruby
<banister`sleep>
lewix: are you experienced in any other programming language?
gtuckerkellogg has quit [Quit: ["Textual IRC Client: www.textualapp.com"]]
Dreamer3 has joined #ruby
NiteRain has quit [Ping timeout: 246 seconds]
<lewix>
banister`sleep: yes and no. c,c++,java but it's been years. and I wouldn't say experience
bradleyprice has quit [Remote host closed the connection]
<banister`sleep>
lewix: ok, basically you need to re-learn OOP i think
<lewix>
banister`sleep: ok within the class
<banister`sleep>
lewix: and learning OOP is a hard slog, and quite different to just 'learning ruby' :)
<banister`sleep>
you need to read books, etc
<lewix>
banister`sleep: i mean you meant the method call within the class*
wyhaines has quit [Remote host closed the connection]
<lewix>
banister`sleep: im reading d.black book. so far so good until i reach protected method, it's been confusing me a lil bit
<lewix>
reached*
slyv has quit [Quit: Computer has gone to sleep.]
hashmal_ has joined #ruby
Dreamer3 has quit [Client Quit]
poikon has quit [Remote host closed the connection]
v0n has joined #ruby
justinmcp has quit [Ping timeout: 245 seconds]
kpshek has quit []
Dreamer3 has joined #ruby
poikon has joined #ruby
Dreamer3 has quit [Remote host closed the connection]
<lewix>
banister`sleep: you can't have C= example_protected_methods.new ; c.protected_methods. however if it's made within the class C it's ok. correct?
<lewix>
class example...*
hashmal has quit [Ping timeout: 256 seconds]
<lewix>
lol my brain is burning
<aedornm>
boats!
dEPy has quit []
<banister`sleep>
lewix: not sure what you're asking me sory
<banister`sleep>
lewix: in ruby there is't that much differnce between private/protected
<banister`sleep>
you're reading too much into it ;) in other languages, like c++ there is way more of a difference
<lewix>
banister`sleep: class Person; attr_accessor :age; protected :age; def older_than(other); self.age <=> other.age; end; end
krz has quit [Quit: krz]
<lewix>
banister`sleep: how come we can use other.age here? is it because it's within the class
j^2 has joined #ruby
banjara has joined #ruby
poikon has quit [Ping timeout: 240 seconds]
<yebyen>
in c++ protected means you can access as long as you are the class or a subclass
<yebyen>
or have i got the java semantics?
<lewix>
banister`sleep: ok I'll take a break. I haven't left my computer the whole day. will be back later. thanks It doesn't sound complicated I'll put it together later I guess
adkron has joined #ruby
Vert has quit [Read error: Connection reset by peer]
<banister`sleep>
lewix: it's because it's protected
yshh has quit [Remote host closed the connection]
Dreamer3 has joined #ruby
<lewix>
banister`sleep: right. but you can't do other = Person.new ; other.age. I understand that protected works like private but instances of the class have access to it. I was asking if they mean access to it within the class
_nitti_ has joined #ruby
<banister`sleep>
lewix: yes, just within the class
<banister`sleep>
well within the 'scope' of the instance :)
<banister`sleep>
whever 'self' is an instance of the class, u should be able to access protected methods on other objects of the same class
<banister`sleep>
lewix: but in practice not many people use protected methods afaict so you're perhaps wasting time trying to grok them :)
ner0x has joined #ruby
<lewix>
banister`sleep: ok perfect it makes more sense now. I was starting to believe that when you said the objects of the same class have access to it. you meant indirectly, and this is why i persisted on saying that the same goes for private methods
_nitti has quit [Ping timeout: 248 seconds]
huoxito has joined #ruby
mlr has joined #ruby
<lewix>
banister`sleep: this is why i asked you to give me an example of an instance of a class that call a private method
arya__ has quit [Ping timeout: 255 seconds]
Ontolog_ has quit [Remote host closed the connection]
karupanerura has quit [Excess Flood]
idkazuma has quit [Remote host closed the connection]
Ontolog has joined #ruby
<lewix>
banister`sleep: thanks.
karupanerura has joined #ruby
alanp_ has joined #ruby
<yebyen>
ooh that makes sense
alanp has quit [Disconnected by services]
alanp_ is now known as alanp
<yebyen>
so you trust members of your same class, but not subclasses, to do the right thing with your protected instance variables
markalanevans has quit [Ping timeout: 252 seconds]
<yebyen>
but they can touch their 'friends' protected parts in the exact same class
dougireton has left #ruby [#ruby]
<lewix>
yebyen: I believe same class and subclasses since they inherit
nari has quit [Ping timeout: 252 seconds]
<yebyen>
lewix: i haven't tested this (is this a new feature in 2.0.0?) but what I got out of what they just exchanged was that no, subclasses can't, but they get their own protected variables (inherited into their own class)
<yebyen>
lewix: i agree that what you said would make more sense to me
justsee has joined #ruby
justsee has joined #ruby
joshman_ has quit [Ping timeout: 252 seconds]
<yebyen>
and i guess its possible they weren't even talking about subclasses
<yebyen>
lewix: stackoverflow agrees with you
<banister`sleep>
yebyen: instance variables are not inherited in ruby
<yebyen>
but methods are (?)
<banister`sleep>
yeah
<yebyen>
so if you decorate with attr_accessor, those are not inherited either...
<havenn>
yebyen: attrs are methods
chrishough has quit [Quit: chrishough]
<yebyen>
ok
<lewix>
instances variables are made on the fly , they come into existence when they're called. magic
<yebyen>
d'oh
<yebyen>
@local variables
<yebyen>
is what i've meant to say all along
maletor has joined #ruby
tomzx_mac has joined #ruby
scruple has joined #ruby
<yebyen>
fields... what are they called in ruby?
luckyruby has joined #ruby
<yebyen>
same thing?
* lewix
is convinced that english is the hardest barrier to comprehension
Domon has joined #ruby
angusiguess has joined #ruby
<yebyen>
yeah
<yebyen>
so @at vars are inherited
MrZYX is now known as MrZYX|off
<yebyen>
and they're called something else
<yebyen>
i would like to believe i'll know better and more permanently if I just test it
<yebyen>
but so lazy
_nitti_ has quit [Remote host closed the connection]
<yebyen>
i am usually programming in go, which has no inheritance
_nitti has joined #ruby
cyong has joined #ruby
cyong has quit [Client Quit]
ferdev has quit [Read error: Connection reset by peer]
Dreamer3 has quit [Quit: Leaving...]
Stilo has joined #ruby
poikon has joined #ruby
krawchyk has joined #ruby
Xeago has quit [Remote host closed the connection]
goldenwest has joined #ruby
<goldenwest>
is there a way to create a custom infix function
Ontolog_ has joined #ruby
arya_ has joined #ruby
Dreamer3 has joined #ruby
_nitti has quit [Read error: Operation timed out]
drale2k has quit [Quit: Leaving...]
drale2k has joined #ruby
jdunck has quit [Quit: Computer has gone to sleep.]
Davey has quit [Quit: Computer has gone to sleep.]
Ontolog_ has quit [Remote host closed the connection]
Ontolog has quit [Ping timeout: 255 seconds]
Ontolog_ has joined #ruby
TheFuzzball has quit [Quit: Computer has gone to sleep.]
yshh has joined #ruby
sailias has joined #ruby
eindoofus has joined #ruby
justinmcp has joined #ruby
newUser1234 has joined #ruby
baroquebobcat has quit [Ping timeout: 252 seconds]
freeayu has joined #ruby
pdamer has joined #ruby
moos3 has quit [Quit: Computer has gone to sleep.]
poikon has quit [Ping timeout: 276 seconds]
moos3 has joined #ruby
<eindoofus>
hi, this line from the ruby book I'm reading is confusing me: "Methods usually return the value of the last expression evaluated during execution. But = method calls behave like assignments: the value of the express ticket.price = 63.00 is 63.00, even if the ticket= method returns the string "Ha ha!" So that does that mean a ticket= method returns 63.00, and if so why, how would it know? I would think on
<eindoofus>
the instance variable that is being set, but what about if you set two different instance variables?
pen has quit [Remote host closed the connection]
<eindoofus>
So does* that mean
horofox_ has quit [Quit: horofox_]
cephalopod has quit [Ping timeout: 255 seconds]
SCommette has joined #ruby
<lewix>
banister`sleep: how long have you been programming in ruby
chipotle_ has quit [Quit: cya]
<banister`sleep>
lewix: a bit less than 4 years ;)
<banister`sleep>
lewix: the part that confused me the most was modules and singleton classes
<banister`sleep>
parts*
<banister`sleep>
were*
<lewix>
eindoofus: the well grounded rubyist
s__dana has quit [Quit: s__dana]
lethjakman_lapto has quit [Ping timeout: 248 seconds]
<eindoofus>
lewix: yup :)
jtharris has quit [Quit: WeeChat 0.4.0]
Banistergalaxy has quit [Ping timeout: 245 seconds]
<lewix>
banister`sleep: haha people are so different. but I'm glad you're here to help. you're useful
<banister`sleep>
lewix: well, modules are actually quite fucked up when u learn a bit more about them
<banister`sleep>
they're not as simple as they appear at first
Banistergalaxy has joined #ruby
<eindoofus>
So does a method_name= basically return whatever is assigned to it? For example does method_name = "a string" 'return
hashmal_ has quit [Quit: Computer has gone to sleep.]
<havenn>
eindoofus: Setter returns argument, not the instance variable value that was set.
<lewix>
eindoofus: I think in the example you just gave it's talking about syntactic sugar, and just stating that if in the definition of your = method call you don't actually have an assignment ruby does not care about the semantics, it will still return the last expression evaluated
Domon has quit [Remote host closed the connection]
<lewix>
banister`sleep: for example =)?
<eindoofus>
cool, I understand now. thanks :)
philcrissman has joined #ruby
<lewix>
banister`sleep: what did you do before Ruby
<banister`sleep>
lewix: 1. they have no superclass (they dont even inherit from Object) 2. the 'module itself' is never mixed into a chain, but an exotic 'proxy' object 3. the 'double include problem' (i.e subsequent module includes to M aren't reflected in classes that already included M) 4. module singleton classes are not added to the class method lookup chain, unlike with inheritance
taoru has joined #ruby
taoru has quit [Read error: Connection reset by peer]
taoru has joined #ruby
marr has quit [Ping timeout: 248 seconds]
taoru has quit [Remote host closed the connection]
thinkclay has quit [Quit: Leaving.]
<banister`sleep>
module singleton methods*
bubblehead has quit [Remote host closed the connection]
bubblehead has joined #ruby
<banister`sleep>
lewix: any questions? (re modules)
thone has quit [Ping timeout: 252 seconds]
moos3 has quit [Quit: Computer has gone to sleep.]
havenn has quit [Remote host closed the connection]
thone has joined #ruby
woolite64 has quit [Read error: Connection reset by peer]
<banister`sleep>
lewix: oh, also the strangest of all, top-level constnats can be looked up in modules
<banister`sleep>
this breaks all rules of constant lookup :)
araujo has joined #ruby
woolite64 has joined #ruby
<banister`sleep>
an "exception" is made for modules, cos otherwise it would be too weird
Radnor has quit [Quit: leaving]
mrsolo has quit [Quit: Leaving]
<lewix>
banister`sleep: 1.2. A class can only have one superclass, and it made sense to me that module are an exotic proxy,3. i didn't know that 4.it makes sense to me
ephemerian has quit [Quit: Leaving.]
<lewix>
4.I take back what I said
<lewix>
what do you mean by unlike inheritance
<banister`sleep>
lewix: modules are not an exotic proxy, the 'mixed in' module is :) And i dont think it's obvious at all, there's no analog to it in the ruby OO system, or any OO system that i know of. Cos it's like a proxy, but not a proxy at the same time, i.e some properties it has in common such as method tables, but other things it does not, such as superclass pointers..
<banister`sleep>
but whatevs
nari has joined #ruby
<banister`sleep>
lewix: when you inherit from a superclass you also inherit class methods, but when you include a module you don't get class methods defined on the module
mneorr has joined #ruby
ckrailo has quit [Quit: Computer has gone to sleep.]
<lewix>
banister`sleep: I didn't know that
<lewix>
things you learn
pen has joined #ruby
<banister`sleep>
lewix: class A; def self.hi; "hi" ;end; end class B < A; end; B.hi #=> "hi"
<banister`sleep>
lewix: module M; def self.hi; "hi"; end; end; class B; include M; end; B.hi #=> error
mibitzi has joined #ruby
Domon has joined #ruby
joshman_ has joined #ruby
Spooner_ has quit [Remote host closed the connection]
t-mart has joined #ruby
t-mart has quit [Changing host]
t-mart has joined #ruby
<lewix>
banister`sleep: good to know. I'll keep it in mind. ruby does not have multiple inheritance, this is why it makes sense to have a mixed in module that act like an exotic proxy
Domon has quit [Remote host closed the connection]
<banister`sleep>
lewix: the strangest of all though, is this: A = 10; module M; A; end #=> 10 <--- this shouldn't work
<banister`sleep>
(but it does)
Domon has joined #ruby
chrisja has quit [Quit: leaving]
jetblack has quit [Quit: leaving]
pac1 has quit [Ping timeout: 248 seconds]
NiteRain has joined #ruby
<lewix>
banister`sleep: singleton methods lie in a special class this is why they're not on the lookup path
sailias has quit [Quit: Leaving.]
<banister`sleep>
lewix: then why are they in the lookup path when using inheritance? :) i can't really see any convincing reason for the distinction
<lewix>
banister`sleep: A = 10; module M; A; end #=> 10. what!
<banister`sleep>
i explain the rationale in that readme
_nitti has joined #ruby
<banister`sleep>
lewix: well it makes sense for classes: A = 10; class C; A; end #=> 10
nga4 has quit [Ping timeout: 252 seconds]
<banister`sleep>
but not for modules since they dont subclass Object
_nitti has quit [Remote host closed the connection]
hbpoison has quit [Ping timeout: 245 seconds]
<lewix>
they do
<banister`sleep>
no..they dont :)
_nitti has joined #ruby
mockra has quit [Remote host closed the connection]
mikurubeam has joined #ruby
hogeo has joined #ruby
jetblack has joined #ruby
<lewix>
banister`sleep: Object mix in Kernel I read and module Kernel has most fundamental methods
<aedornm>
So many passwords.
pdamer has quit [Quit: pdamer]
brianpWins has quit [Quit: brianpWins]
<banister`sleep>
lewix: but that's not relevant to modules subclassing Object, which is what we were talking about ;)
tjbiddle has joined #ruby
sirish has joined #ruby
<lewix>
banister`sleep: what do you mean by modules subclassing Object
<banister`sleep>
lewix: i mean, Object is not in the ancestor chain for modules
<banister`sleep>
module M; end; M.ancestors.include?(Object) #=> false
_nitti has quit [Ping timeout: 264 seconds]
<lewix>
banister`sleep: ok. I see but don't all modules have module Kernel associated to it
angusiguess has quit [Ping timeout: 276 seconds]
philcrissman has quit [Remote host closed the connection]
Ontolog has joined #ruby
mikurubeam has quit [Ping timeout: 260 seconds]
mneorr has quit [Read error: Operation timed out]
Domon has quit [Remote host closed the connection]
Ontolog has quit [Remote host closed the connection]
cheese1756 has quit [Changing host]
cheese1756 has joined #ruby
<banister`sleep>
lewix: 'associated' is a vague word. "Yes" in the sense of modules being an *instance of* Module which subclasses Object which mixes in Kernel. But "no" in the sense of Kernel is not in the ancestor chain of modules as modules do not subclass from Object, which is where Kernel is mixed in
Honeycomb has joined #ruby
Ontolog has joined #ruby
frem has joined #ruby
krz has joined #ruby
<banister`sleep>
lewix: the important point is that constants are looked up lexically and via the inheritance chain, and in the case of: module M; A; end; the constnat 'A' is neither lexical nor in the inheritance chain of M, so it shouldn't be looked up (but it is)
frem has quit [Client Quit]
Ontolog_ has quit [Ping timeout: 245 seconds]
<banister`sleep>
lewix: same as constants cannot be looked up in BasicObject, and for the same reason
mikurubeam has joined #ruby
<banister`sleep>
top-level constants
the_jeebster has quit [Quit: Leaving.]
<lewix>
banister`sleep: fuuu how do you know so much
lethjakman_lapto has joined #ruby
bonhoeffer has joined #ruby
<banister`sleep>
lewix: i mess with the C internals a lot
<banister`sleep>
that's how i got to know about modules, etc
<lewix>
banister`sleep: how does it all work that classes are objects and objects are classes. it's very circula
frem has joined #ruby
<lewix>
circular*
<aedornm>
What's a good obscure language?
<banister`sleep>
lewix: there's a circle in there too :) at the top of teh chain there's a hidden object that is an instance of itself
plaintext has joined #ruby
plaintext has quit [Remote host closed the connection]
<banister`sleep>
i think it's something like: #<Class: #<Class: >> or something, the 2nd-level singleton class of Class
mneorr has joined #ruby
<lewix>
banister`sleep: i thought Class was an instance of itself
<banister`sleep>
it's not, really
mikurubeam has quit [Ping timeout: 255 seconds]
<banister`sleep>
it's not a direct instance of itself
<banister`sleep>
it has a meta class which its a direct instance of
<banister`sleep>
it's*
<banister`sleep>
it's only like the meta class of that meta class that is a direct instance of itself
samphippen has quit [Quit: Computer has gone to sleep.]
<lewix>
banister`sleep: Ok I have too many things to digest for today
<banister`sleep>
lewix: i'm talking about non-lazily created singleton classes, of course you can keep building metaclasses beyond that, but im just talking about the classes that are there at boot time
<aedornm>
aytch: nooo, been there, done that one.
<banister`sleep>
but even if you keep building metaclasses, at the top of the chain there will always be one that is an instance of itself
<banister`sleep>
lewix: here i wrote an article on it:
emmanuelux has quit [Remote host closed the connection]
Ontolog has quit [Ping timeout: 240 seconds]
mneorr has quit [Read error: Connection timed out]
Honeycomb has quit [Quit: Leaving.]
banjara has quit [Quit: Leaving.]
Dreamer3 has quit [Remote host closed the connection]
takeru has joined #ruby
Dreamer3 has joined #ruby
mneorr has joined #ruby
Dreamer3 has quit [Client Quit]
newUser1234 has quit [Remote host closed the connection]
newUser1234 has joined #ruby
pskosinski has quit [Ping timeout: 255 seconds]
takeru has quit [Ping timeout: 248 seconds]
apok has quit [Quit: apok]
Dreamer3 has joined #ruby
flyinprogramer has quit [Quit: flyinprogramer]
jamesfung14 has quit [Ping timeout: 248 seconds]
terrorpup has joined #ruby
Dreamer3 has quit [Client Quit]
newUser1234 has quit [Ping timeout: 248 seconds]
reset has quit [Quit: Leaving...]
joeycarmello has joined #ruby
mlr has quit [Quit: Lost terminal]
hbpoison has quit [Ping timeout: 276 seconds]
reset has joined #ruby
Myconix has joined #ruby
mlr has joined #ruby
yacks has joined #ruby
<lethjakman_lapto>
hey, I'm having some trouble understanding how I should deal with some json in ruby. It comes into my program looking like this. https://gist.github.com/anonymous/5087521
Dreamer3 has joined #ruby
Pandaen has quit [Ping timeout: 240 seconds]
<lethjakman_lapto>
I've found I can get my first value with tree["0"], but I would like to be able to do a tree.first
<lethjakman_lapto>
is there any way to do this?
<lethjakman_lapto>
I'm wanting to use recursion on the children within this
angusiguess has joined #ruby
etcetera has quit []
Domon has joined #ruby
<aytch>
lethjakman_lapto: someone else will probably have a better answer, but my instinct would be to put your JSON into an array
<lethjakman_lapto>
aytch: how would you go about doing that? I don't know how without parsing each possible value from it
Voodoofish430 has quit [Quit: Leaving.]
malkomal_ has quit [Read error: Connection reset by peer]
<aytch>
That's why I said someone else would probably have a better answer.
malkomalko has joined #ruby
<lethjakman_lapto>
I appreciate the help anyways :)
chrishough has joined #ruby
kofno has quit [Remote host closed the connection]
angusiguess has quit [Ping timeout: 256 seconds]
Dreamer3 has quit [Remote host closed the connection]
dhruvasagar has joined #ruby
nga4 has joined #ruby
ngoldman has joined #ruby
Dreamer3 has joined #ruby
<aytch>
do you know the values that will be returned?
lusory has quit [Quit: leaving]
<aedornm>
lethjakman_lapto: you can cheat a bit and do tree[tree.keys.first]. Or you can convert it to an Array if you want.
justinmcp has joined #ruby
ckrailo has joined #ruby
Dreamer3 has quit [Remote host closed the connection]
subbyyy has joined #ruby
Dreamer3 has joined #ruby
<lethjakman_lapto>
ooo that tree.keys.first
<lethjakman_lapto>
how does this converting it into an array work?
<lethjakman_lapto>
is there a function?
Dreamer3 has quit [Remote host closed the connection]
<havenwood>
keepguessing: No errors, just hangs with?: gem install debugger
<keepguessing>
is there a way to print a trace of the operations
<keepguessing>
-v switch kinda thing
ananthakumaran has left #ruby [#ruby]
<lewix>
hmm the Integer class does not allow the new constructor
one` has quit [Ping timeout: 264 seconds]
<havenwood>
keepguessing: gem install debugger -V
justinmcp has joined #ruby
<havenwood>
keepguessing: Prolly should update gem to 2.0.0 as well.
Myconix has quit [Quit: Server Error 482: The server has been shot by a 12-gauge, please contact an administrator]
<keepguessing>
ok the gem update is erroing out with "gem update --system --verbose --debug Exception `NameError' at /usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/command_manager.rb:177 - uninitialized constant Gem::Commands::UpdateCommand"
<Hanmac>
lewix:
<Hanmac>
>> p ObjectSpace.each_object(Class).select {|c| !c.respond_to?(:new) }
eval-in has quit [Remote host closed the connection]
eval-in has joined #ruby
adambeynon has joined #ruby
eval-in has quit [Remote host closed the connection]
imitkit has joined #ruby
kevinfagan has joined #ruby
kevinfagan has quit [Client Quit]
carraroj has quit [Quit: Konversation terminated!]
<apeiros_>
becom33: you mean autocompletion?
<apeiros_>
you can use Readline for that
eval-in has joined #ruby
noop_ has joined #ruby
becom33 has quit [Ping timeout: 256 seconds]
<ohcibi>
is there a library/gem for directly manipulating values of nodes in xml files? like for editing version information before deploying
spychalski has quit [Quit: leaving]
spychalski has joined #ruby
spychalski has quit [Changing host]
spychalski has joined #ruby
<apeiros_>
ohcibi: nokogiri
dsf has joined #ruby
<apeiros_>
there are others, but don't really know those.
keepguessing has joined #ruby
becom33 has joined #ruby
noop has quit [Ping timeout: 245 seconds]
DrShoggoth has joined #ruby
<becom33>
sorry I got disconnected did anyone replyed to my question ?
<ohcibi>
apeiros_: is there a method to directly manipulate files in nokogiri? or do you mean, i should parse the file, modify the data and then write the to_s into the file?
<becom33>
I was wondering if I can use tab to get a guess fill in a script like this http://pastebin.com/hk215MNy
noop_ has quit [Ping timeout: 264 seconds]
jacobw has joined #ruby
jimeh has joined #ruby
<marwinism>
< apeiros_> becom33: you mean autocompletion?
<marwinism>
< apeiros_> you can use Readline for that
cha1tanya has quit [Ping timeout: 248 seconds]
<becom33>
marcgg_, yes
<apeiros_>
ocnam: yes, those ~10 lines of boilerplate to read/write the file you'll have to add yourself
carraroj has joined #ruby
predator117 has joined #ruby
<becom33>
apeiros_, I'm not sure how to use readline in thor
arturaz has joined #ruby
<apeiros_>
becom33: the same way you'd use it outside of thor. but it's really not clear from your pastie, what you want to do.
yacks has quit [Quit: Leaving]
<apeiros_>
you're not accepting any user-input, except ARGV
<apeiros_>
and ARGV happens *before* ruby
<apeiros_>
i.e., you'd need bash/zsh/whatevershell completions
yacks has joined #ruby
<becom33>
apeiros_, well its just simple methods and argivement passing the problem is there will be huge list of commands
mpfundstein has joined #ruby
marr has joined #ruby
yacks has quit [Max SendQ exceeded]
yacks has joined #ruby
<becom33>
apeiros_, yes I am . well when I do script.rb name Pino . it returns the out which is in name method with the Pino Argv
blueOxigen has joined #ruby
eval-in has quit [Remote host closed the connection]
eval-in has joined #ruby
yacks has quit [Max SendQ exceeded]
<apeiros_>
becom33: as said, ARGV happens before ruby. you can't solve that in ruby.
yacks has joined #ruby
<becom33>
oh
<becom33>
true
ozgura has quit [Remote host closed the connection]
<becom33>
can u point me to a way how I can use readline with thor ?
bluOxigen has quit [Ping timeout: 255 seconds]
<apeiros_>
as said, the same way as without thor
<becom33>
or could u give me a suggestion to do this without readline ?
arietis has joined #ruby
brum has joined #ruby
nomenkun has joined #ruby
mootpointer has joined #ruby
<apeiros_>
"do this" = shell argv expansion? again, you can NOT do that in ruby.
utf1000 has quit [Ping timeout: 255 seconds]
<apeiros_>
not because ruby was incapable to, but simply because this happens before ruby even starts.
banjara has quit [Ping timeout: 276 seconds]
peteyg has quit [Ping timeout: 252 seconds]
obs has joined #ruby
brum has quit [Ping timeout: 252 seconds]
banjara has joined #ruby
tish has joined #ruby
sonda has joined #ruby
ocnam has quit [Quit: Tan Tan!]
utf1000 has joined #ruby
kristofers has quit []
hoelzro|away is now known as hoelzro
kevinfagan has joined #ruby
mneorr has joined #ruby
peteyg has joined #ruby
wreckimnaked has joined #ruby
hashmal has joined #ruby
browndawg has left #ruby [#ruby]
elaptics`away is now known as elaptics
arya has quit [Ping timeout: 260 seconds]
beiter has joined #ruby
buscon has joined #ruby
ttt has joined #ruby
Domon has quit [Remote host closed the connection]
mneorr has quit [Remote host closed the connection]
ttt_ has quit [Ping timeout: 256 seconds]
spychalski has quit [Quit: leaving]
lkba has joined #ruby
arya has joined #ruby
spychalski has joined #ruby
endzyme has quit [Remote host closed the connection]
monkegjinni has joined #ruby
babinho_ has quit [Quit: leaving]
casheew has quit [Read error: Connection reset by peer]
casheew has joined #ruby
babinho has joined #ruby
Apes has joined #ruby
yewton has quit [Ping timeout: 276 seconds]
spychalski has quit [Client Quit]
spychalski has joined #ruby
EMPZ has joined #ruby
Emplitz has quit [Read error: Connection reset by peer]
endzyme has joined #ruby
Emplitz has joined #ruby
endzyme has quit [Remote host closed the connection]
Artheist has quit [Remote host closed the connection]
EMPZ has quit [Ping timeout: 252 seconds]
dsf has quit [Quit: This computer has gone to sleep]
sonda has quit [Remote host closed the connection]
Reemo has joined #ruby
Vainoharhainen has joined #ruby
tish has quit [Quit: Leaving.]
noop has joined #ruby
<Reemo>
Hey guys, i'm having troubles ending the program flow in a 'load'-ed ruby script without quitting the main script. I want to put some specific seeds for my ror application in other files so i can swap/require them more easily.
banister`sleep has quit [Remote host closed the connection]
ttt has quit [Ping timeout: 276 seconds]
cha1tanya has joined #ruby
sonda has joined #ruby
banister`sleep has joined #ruby
jef_abraham has joined #ruby
undert has quit [Ping timeout: 264 seconds]
kaen has quit [Ping timeout: 248 seconds]
noop has quit [Read error: Connection reset by peer]
chussenot has joined #ruby
* becom33
anyone ?
undert has joined #ruby
anderse has joined #ruby
tish has joined #ruby
slainer68 has joined #ruby
mafolz has quit [Quit: mafolz]
mafolz has joined #ruby
thebastl has joined #ruby
zorbyte has joined #ruby
mneorr has joined #ruby
t-mart has quit [Remote host closed the connection]
arietis has quit [Read error: Connection reset by peer]
arietis has joined #ruby
fabrice31 has joined #ruby
amcsi_work has quit [Read error: Operation timed out]
duosrx has joined #ruby
<Reemo>
hoelzro: lets say i do. how can i exit the program in test2.rb without exiting the whole script?
mootpointer has quit [Quit: Computer has gone to sleep.]
<hoelzro>
Reemo: well, first I must ask: why do you want/need to?
<Reemo>
hoelzro: like i said, i have a huge db/seeds.rb file for my RoR project and i want to have the seeded models separated so i can swap/require them as i need to
mercwithamouth has quit [Ping timeout: 245 seconds]
carraroj has quit [Quit: Konversation terminated!]
Domon has joined #ruby
<hoelzro>
right, and that's good, but why do you need to relinquish control from within a file like that?
yacks has quit [Read error: Connection reset by peer]
idkazuma has joined #ruby
rakl has quit [Quit: sleeping]
<Reemo>
lets say a specific model A already exists, in that case i dont want to execute the rest of the script
<Reemo>
right now its a huge if block and i'm curious about how to negate the if and just break before executing the model creation
<hoelzro>
it's interesting that return doesn't work
yacks has joined #ruby
timmow has joined #ruby
<hoelzro>
but one thing you *could* do is throw a symbol, and catch it in the file require'ing the other
<Reemo>
hoelzro: i think its reasonable, given that load already has a return value.
<hoelzro>
but you may want to ask on #rubyonrails, as they may have a better way of doing this
<MrZYX>
you probably could just use require & return but I think I'd do something (never tried) main.rb: Callbacks = [], require 'foo',..., Callbacks.each {|cb| cb.call }, foo.rb: Callbacks << lambda do _code_goes_here_ end. Still a hack but at least the return makes a bit more sense inside a block
<MrZYX>
and +1 for #rubyonrails
brum has joined #ruby
mark9 has joined #ruby
noop has joined #ruby
<Reemo>
I see that it requires more effort to stick to the imperative style on top scope, but that gives me the option to just merge all seeds back into one file, because the 'way' the scripts work doesn't change
clooth has joined #ruby
ttt has quit [Ping timeout: 256 seconds]
<Reemo>
And yeah, i'll ask in #rubyonrails, but i thought this was more a language issue, though i encountered it while using RoR...
pyrac has quit [Read error: Connection reset by peer]
pyrac_ has joined #ruby
AndChat| has joined #ruby
mneorr has joined #ruby
chichou has quit [Remote host closed the connection]
banjara has quit [Remote host closed the connection]
sayan has quit [Read error: Connection reset by peer]
ExxKA has joined #ruby
unflores has joined #ruby
banjara has joined #ruby
hoelzro has quit [Ping timeout: 245 seconds]
Banistergalaxy has quit [Ping timeout: 248 seconds]
nonotza has quit [Quit: nonotza]
noop has joined #ruby
banjara has quit [Client Quit]
DrForr_ is now known as DrForr
monkegjinni has quit [Remote host closed the connection]
<Hanmac>
shevy it looks that oracle switched to "weekly" build with java :P
mneorr has quit [Ping timeout: 256 seconds]
Xeago has joined #ruby
sayan has joined #ruby
lkba has quit [Ping timeout: 248 seconds]
e-dard has left #ruby [#ruby]
banseljaj is now known as imami|afk
hoelzro has joined #ruby
arya_ has quit [Ping timeout: 250 seconds]
stonevil has quit [Quit: stonevil]
chichou has joined #ruby
lmx has joined #ruby
nomenkun_ has joined #ruby
swoosh has joined #ruby
swoosh has quit [Max SendQ exceeded]
atrocitas has quit [Remote host closed the connection]
swoosh has joined #ruby
quazimodo has quit [Ping timeout: 255 seconds]
vlad_starkov has joined #ruby
nomenkun has quit [Read error: Connection reset by peer]
Barbaren has joined #ruby
<Barbaren>
Hello, I have an algo question: I have an array of integers, "A", I need to find a combination of K elements such that each element is at least N positions away from any other chosen element, while maximizing the sum of the K elements... any idea what kind of algorithm to use for this?
crackedmind has joined #ruby
arya has joined #ruby
<hemanth>
TIL : Rescue blocks don't need to be tied to a 'begin' :\
uxp has quit [Ping timeout: 256 seconds]
quazimodo has joined #ruby
hbpoison has quit [Ping timeout: 264 seconds]
xiphiasx_ has quit [Ping timeout: 276 seconds]
musl has quit [Ping timeout: 255 seconds]
<apeiros_>
hemanth: well, they must. but `def` is an implicit begin
franks2_ is now known as franks2
franks2 has quit [Changing host]
franks2 has joined #ruby
<Hanmac>
or did he mean the rescue modifier?
<hemanth>
"no blocks" resuse apeiros_
<hemanth>
:)
<apeiros_>
that wouldn't be a block
<apeiros_>
yeah, inline rescue is heavily disadvised
JonnieCache has quit [Quit: leaving]
<hemanth>
heh heh
<apeiros_>
for the sole reason that you can't specify the exception to rescue.
matrixise has joined #ruby
<hemanth>
rescuing the rescue
vlad_starkov has quit [Remote host closed the connection]
<apeiros_>
sad, actually
bluehavana_ is now known as bluehavana
ttt has quit [Ping timeout: 276 seconds]
<hemanth>
rescue => e # still sad!
<apeiros_>
yes
nomenkun_ has quit [Read error: Connection reset by peer]
emergion has quit [Quit: Computer has gone to sleep.]
nomenkun has joined #ruby
luckyruby has quit [Remote host closed the connection]
chichou has quit [Remote host closed the connection]
realDAB has quit [Ping timeout: 256 seconds]
Rioji has joined #ruby
krz has quit [Quit: krz]
whitedawg has joined #ruby
verysoftoiletppr has joined #ruby
malkomalko has quit [Remote host closed the connection]
monkegjinni has quit [Remote host closed the connection]
robbyoconnor has quit [Ping timeout: 245 seconds]
Rioji has quit [Ping timeout: 248 seconds]
prime has quit [Changing host]
prime has joined #ruby
arya has quit [Ping timeout: 255 seconds]
monkegjinni has joined #ruby
rdark has quit [Ping timeout: 250 seconds]
theRoUS has joined #ruby
theRoUS has quit [Changing host]
theRoUS has joined #ruby
rdark has joined #ruby
hamed_r has joined #ruby
arya has joined #ruby
zos has quit [Quit: leaving]
chrisramon has joined #ruby
workmad3 has joined #ruby
ozgura has quit [Read error: Connection reset by peer]
hogeo has quit [Remote host closed the connection]
MehLaptop has joined #ruby
carloslopes has joined #ruby
atyz has quit [Quit: Leaving...]
ozgura has joined #ruby
<Hanmac>
shevy: good code does not need documentation ... hanmac code is only half that big, but does need twice that size again for documentation :P
arietis has quit [Quit: Computer has gone to sleep.]
monkegjinni has quit [Read error: Connection reset by peer]
mercwithamouth has joined #ruby
monkegjinni has joined #ruby
_bart has joined #ruby
arietis has joined #ruby
pskosinski has joined #ruby
yshh has joined #ruby
vlad_starkov has joined #ruby
samphippen has joined #ruby
soc42 has quit [Read error: Operation timed out]
Evixion has joined #ruby
Mon_Ouie has quit [Ping timeout: 276 seconds]
soc42 has joined #ruby
yshh has quit [Read error: Connection reset by peer]
NiteRain has quit [Ping timeout: 246 seconds]
yshh has joined #ruby
marius is now known as nkts
atyz has joined #ruby
nari has joined #ruby
grohne has joined #ruby
v0n has joined #ruby
pigoz has joined #ruby
<grohne>
hi. can you point me to a technique for creating "cached properties" in a class? the desired result would be that the first and only the first access actually computes the desired value.
kaichanvong has joined #ruby
Dreamer3 has quit [Remote host closed the connection]
<grohne>
my googling on that only turned up rails stuff
blueOxigen has quit [Ping timeout: 245 seconds]
slainer68 has joined #ruby
mneorr has joined #ruby
grayson has joined #ruby
becom33 has quit [Ping timeout: 255 seconds]
<dEPy>
Any1 can help me with sidekiq? I'm getting duplicated jobs for sidekiq to execute ...
MehLaptop has quit [Remote host closed the connection]
swoosh has quit [Quit: Computer has gone to sleep.]
<hoelzro>
grohne: you mean a lazy value?
<hoelzro>
def value ; unless defined? @value ; @value = calculate_value ; end ; @value ; end
anderse has quit [Ping timeout: 252 seconds]
<grohne>
hoelzro: yes. I think I meant precisely that. thanks.
adkron has joined #ruby
karnowski has joined #ruby
nomenkun has quit [Read error: Operation timed out]
dhruvasagar has quit [Ping timeout: 255 seconds]
arietis has quit [Quit: Computer has gone to sleep.]
dhruvasagar has joined #ruby
mercwithamouth has quit [Ping timeout: 256 seconds]
mneorr has quit [Ping timeout: 256 seconds]
nomenkun has joined #ruby
dustint has joined #ruby
<grohne>
hoelzro: now searching for "lazy value" gives much better results. thanks!
<grohne>
I guess "cached property" is a very pythonic term.
<Hanmac>
grohne holezro what about: def value; @value ||= calculate_value;end
<grohne>
Hanmac: yes, I just figured that on stackoverflow. :)
anderse has joined #ruby
<hoelzro>
Hanmac: nice
<Hanmac>
but it may not work on boolean values ...
<apeiros_>
Hanmac: you mean the update is a "pull java" update?
<Hanmac>
apeiros_ the last times, everytime oracle does an new java updates it shows that they "forgot" some bugs to fix that they allready know ... and one week later they does an java update again ...
girija_ has quit [Ping timeout: 248 seconds]
mneorr has quit [Ping timeout: 276 seconds]
vlad_starkov has quit [Ping timeout: 264 seconds]
lele has quit [Quit: Coyote finally caught me]
kevinfagan has quit [Quit: Leaving...]
jerius has joined #ruby
thebastl has quit [Read error: Operation timed out]
jgarvey has joined #ruby
enroxorz has joined #ruby
atyz has quit [Quit: Leaving...]
monkegjinni has joined #ruby
monkegjinni has quit [Remote host closed the connection]
horrror has joined #ruby
<horrror>
Hi, is there an option to check if Object contains a certain value without knowing the exact property? e.g. Object.include? 'blahblah'
<apeiros_>
only to a limited extent
tommyvyo has joined #ruby
<horrror>
what do u mean?
<apeiros_>
you can use Object#instance_variables and #instance_variable_get to search the ivars of an object
tommyvyo has quit [Client Quit]
<apeiros_>
but if it's a native object, that won't do (things like Array, or Hash)
johnnygoodmancpa has joined #ruby
<MrZYX>
I guess the bigger question is why you need to do that
<apeiros_>
indeed
monkegjinni has joined #ruby
rippa has quit [Ping timeout: 240 seconds]
chipotle_ has quit [Quit: cya]
<horrror>
I have a hash of Objects. Then I want to check if an Object is inside a hash but because the object is being re-created by another method I guess comparing the object (even if values are equal) will return false anyway because of the object_id
<apeiros_>
"I guess"
<apeiros_>
stop guessing.
<apeiros_>
test it.
<horrror>
lol
kofno_ has quit [Remote host closed the connection]
sailias has joined #ruby
<horrror>
I guess == I tested it and it doesn't work
<MrZYX>
also you have no control over the objects and they have mixed subtypes?
<apeiros_>
then why on earth would you say "I guess it will return false" when you *know* it does?
<apeiros_>
it's not nice to mislead…
steeve has joined #ruby
<horrror>
stop overreacting
<apeiros_>
I guess I'll just stop caring.
<dcope>
Iss there a way to negate a ruby regex? don't see it.
chrishough has joined #ruby
<horrror>
MrZYX: no i don't
justinmcp has quit [Remote host closed the connection]
<apeiros_>
dcope: Regexp#!~
johnnygoodmancpa has left #ruby [#ruby]
vlad_starkov has joined #ruby
clocKwize has quit [Quit: clocKwize]
monkegjinni has quit [Remote host closed the connection]
<MrZYX>
where do you get these objects then?
<horrror>
other app
iamjarvo has joined #ruby
lolmaus has quit []
<horrror>
*i guess* i can rewrite the hash and save a unique ID of an object and then compare it with my other Objects.
ananthakumaran has quit [Quit: Leaving.]
<MrZYX>
hm if you really care about the internal state and don't want to code a hack with instance_variables and instance_variable_get I'd ask the maintainers of "other app" to implement == to those "objects"
<MrZYX>
which would be the proper solution
hoelzro is now known as hoelzro|away
<horrror>
how would u implement that?
<MrZYX>
where you define the class, just overwrite Object#==
adkron has joined #ruby
adkron_ has joined #ruby
solidoodlesuppor has joined #ruby
<horrror>
k
<horrror>
thanks MrZYX
generalissimo has joined #ruby
<MrZYX>
just guard the method with return false unless other.is_a? self.class and then compare the state of other with the one of self
tommyvyo has joined #ruby
reset has quit [Ping timeout: 252 seconds]
atyz has joined #ruby
NiteRain has joined #ruby
<horrror>
also another question. i have hash[object] = [other_value] , is there a way to access the object that is placed in the key through the hash?
interactionjaxsn has joined #ruby
<tobiasvl>
through the hash?
uris has joined #ruby
<tobiasvl>
do you mean through the value (other_value)?
<horrror>
the object that is in the key store
Skofo has quit [Quit: Leaving]
<MrZYX>
you can get all keys with Hash#keys if that's what you want
<andynu>
hash.keys is an array of those objects. you could use hash.each_pair to iterate to find the particular key that matched a value.
<tobiasvl>
or you can use Enumerable#select to iterate and match on values/keys
whitedawg has quit [Quit: Leaving.]
<tobiasvl>
or hash.index?
<tobiasvl>
or hash.invert?
hamed_r has quit [Quit: Leaving]
quazimodo has quit [Ping timeout: 252 seconds]
<Hanmac>
tobiasvl hash.index is deprecated ... use hash.key
<horrror>
thanks hash.keys was what i was looking for
ExxKA has joined #ruby
chrishough has quit [Quit: chrishough]
idkazuma has joined #ruby
kevinfagan has joined #ruby
<Hanmac>
horrror please use each_key.select or something like that, ... it prevents you from generating a big array
tomzx_mac has joined #ruby
sukima has joined #ruby
<horrror>
k
<sukima>
I heard that when you augment an object in ruby you actually create a duplicate (internally) err. if you add a method to an object already defined internally your making a new object. is this correct?
tcstar has quit [Read error: Connection reset by peer]
Goles has joined #ruby
rdo has joined #ruby
<rdo>
hi all, is it possible to call kinit from within ruby?
quazimodo has joined #ruby
jlast has joined #ruby
jprovazn has quit [Quit: Leaving]
browndawg has left #ruby [#ruby]
Mattix has joined #ruby
ffranz has joined #ruby
<AndChat|>
Sukima no, where did you hear all that?
<Hanmac>
sukima ... i dont think its allways true ... some internal objects are maybe referred ... but its not true for all objects
mark9 has left #ruby [#ruby]
adkron__ has joined #ruby
jef_abraham has joined #ruby
quazimodo has quit [Ping timeout: 256 seconds]
<Hanmac>
for sample RArray and RString does have a "shared" attribute ... but i dont find where its used
takeru has joined #ruby
jlast has quit [Ping timeout: 252 seconds]
ttt has quit [Remote host closed the connection]
<apeiros_>
Hanmac: you mean copy-on-write?
<apeiros_>
should be used on stuff like slicing and dup
<JonnieCache>
horrror: `pry -r scriptname.rb` i think
<JonnieCache>
something like that
nomenkun has joined #ruby
mark_locklear has quit [Quit: Leaving]
nOStahl has joined #ruby
puppeh has quit [Read error: Connection reset by peer]
<Hanmac>
>> Gem::Specification::each_default
<eval-in>
Hanmac => /execpad/interpreters/ruby-2.0.0-p0/lib/ruby/2.0.0/rubygems/specification.rb:631:in `block (2 levels) in each_spec': no block given (yield) (LocalJumpError)
<dEPy>
btw what would be "Module" in this case? cant find definition anywhere
<whitequark>
this is really against the spirit of OO
<apeiros_>
whitequark: same
<Hanmac>
dEPy with enough evil energy you could change EVERYTHING in ruby :P ... even the internal C structs :P
<apeiros_>
or send & send!, which was originally discussed
<dEPy>
I always had love/hate relationship with ruby, this just confirms it :)
chichouw has joined #ruby
fire has quit [Quit: WeeChat 0.4.0]
<whitequark>
apeiros_: yeah, send! is nice
chichou has quit [Read error: Connection reset by peer]
<apeiros_>
yeah, but __send!__ or __send__! isn't :D
tdelam has joined #ruby
<whitequark>
__send__! is fine
<apeiros_>
I still want a module "Introspection"
<whitequark>
apeiros_: that's in the works AFAIK
<apeiros_>
which is immutable and provides things like ivar_get/set/send etc.
<whitequark>
FSVO "in the works"
<apeiros_>
and can also work on BasicObject
<Hanmac>
i wish there where a __class__ method too
<apeiros_>
FSVO?
<whitequark>
for some value of
<apeiros_>
ah
<apeiros_>
thx
<apeiros_>
if only I'd finally resolve my issues with the syntax of my language… then I could finally move back to implementing again :-/
interactionjaxsn has quit [Remote host closed the connection]
DasIch has joined #ruby
<dEPy>
am
mneorr has quit [Ping timeout: 276 seconds]
<dEPy>
what's the difference between simply making a class and inheriting from BasicObject?
<DasIch>
what would be the best approach to install ruby 1.9 on os x at the moment?
<Hanmac>
DasIch format and install a linux?
<DasIch>
Hanmac: not happening
<JonnieCache>
DasIch: rbenv and ruby-build imo
<dEPy>
DasIch +1
<apeiros_>
DasIch: I enjoy rvm
bubblehead has quit [Remote host closed the connection]
<apeiros_>
never tried others, though
<DasIch>
so there is no community consensus?
<dEPy>
rbenv is cool
Takehiro has joined #ruby
<dEPy>
and easy to install
<apeiros_>
DasIch: community consensus is, that those tools are all relatively good
adkron_ has quit [Ping timeout: 260 seconds]
adkron has quit [Ping timeout: 260 seconds]
quazimodo has joined #ruby
<JonnieCache>
the ruby community has a fraught relationship with the notion of consensus
v0n has joined #ruby
Spooner_ has quit [Remote host closed the connection]
<realDAB>
gogiel: that thing you pasted last night was indeed very odd. have you had any responses about it?
<wmoxam>
DasIch: RVM is basically the same as Rbenv + some plugins
tish has quit [Quit: Leaving.]
<wmoxam>
DasIch: either approach works
<wmoxam>
DasIch: basically RVM is monolithic while Rbenv is modular
jean-louis has joined #ruby
predator117 has quit [Ping timeout: 276 seconds]
predator117 has joined #ruby
pepper_chico has joined #ruby
pepper_chico has quit [Max SendQ exceeded]
<JonnieCache>
DasIch: rbenv and ruby build are part of the same thing (ruby-build is a plugin for rbenv) so its basically a choice between rvm and rbenv
Adys has quit [Ping timeout: 245 seconds]
cha1tanya has quit [Quit: Leaving]
<JonnieCache>
i advise rbenv but everyone has their own opinion
pepper_chico has joined #ruby
<apeiros_>
ze realDAB!
<dEPy>
If you define a new class doesn't that class inherit from BasicObject? If yes when this code: class Proxy < BasicObject ?
<apeiros_>
and that's why `class Proxy < BasicObject`, to explicitly inherit from BasicObject instead of the default, which is Object
NiteRain has quit [Ping timeout: 246 seconds]
<dEPy>
oh, so Proxy.new then inheritsfrom BasicObject because it's an instance
pigoz has quit [Ping timeout: 252 seconds]
<apeiros_>
o0
neurone-1337 has quit [Ping timeout: 252 seconds]
<dEPy>
but, what are the pros of this?
a_a_g has quit [Quit: Leaving.]
<dEPy>
not including kernel crap?
end_guy_ is now known as end_guy
<apeiros_>
BasicObject has less methods, making collisions less likely
<DasIch>
so from what I have read so far rvm seems to be somewhat more "invasive" than rbenv does that seem like a fair statement?
<JonnieCache>
DasIch: yeah pretty much
<dEPy>
hm, seems logical yes
hoelzro|away is now known as hoelzro
beiter has joined #ruby
<DasIch>
hm, seems like I'd prefer rbenv then
breakingthings has joined #ruby
qubit has quit [Ping timeout: 250 seconds]
op84 has joined #ruby
phantasm66 has joined #ruby
phantasm66 has joined #ruby
phantasm66 has quit [Changing host]
enroxorz is now known as enroxorz-work
pigoz has joined #ruby
vlad_starkov has joined #ruby
krawchyk has joined #ruby
tubbo has joined #ruby
<op84>
hi - how do i catch an error of an exectued shell command like `mount blabla` lets say already mounted?
stopbit has joined #ruby
stnly has quit [Ping timeout: 240 seconds]
mattbl has joined #ruby
oposomme has joined #ruby
stnly has joined #ruby
<whitequark>
op84: try $?
<whitequark>
$?.success?
dsf_ has joined #ruby
tcstar has joined #ruby
<shevy>
Hanmac well, when I look at code from other people, I often have no idea what they want to do and why
apod has quit []
<shevy>
Hanmac so helpful documentation is useful
<Hanmac>
shevy yeah sometimes the "other people" are yourselfs from the past :D
<shevy>
Hanmac about size, yeah, it makes files bigger and larger and thus comes at a cost. I think the best way to document is to be as terse and as minimal as possible, while still being as useful as possible
<shevy>
Hanmac yeah that too, years later when you wonder what you did back then
puppeh has quit [Remote host closed the connection]
<shevy>
Hanmac that's why working examples are important!
<tobiasvl>
op84: if you just need to know if it worked or not, system returns true/false. but yeah, the exact return value is found in $?
<shevy>
I could not get the shoes examples to work at all :\
<op84>
thanks whitequark tobiasvl
puppeh has joined #ruby
mikepack has joined #ruby
volume has joined #ruby
vlad_starkov has quit [Remote host closed the connection]
segv- has joined #ruby
<Hanmac>
shevy i still dont know how many different shoes gems exist and why :P
<shevy>
I dont want to abandon bluefish 1.0.7 :(
joshman_ has joined #ruby
newUser1234 has joined #ruby
nari has quit [Ping timeout: 255 seconds]
pdamer has joined #ruby
<shevy>
I guess they wanted to restructure the project Hanmac
<dEPy>
What's a good read on ruby's class/object system?
angusiguess has quit [Remote host closed the connection]
angusiguess has joined #ruby
braoru has quit [Remote host closed the connection]
mneorr has joined #ruby
ExxKA has quit [Quit: This computer has gone to sleep]
fire is now known as nerd
drumond19 has joined #ruby
Hanmac has quit [Ping timeout: 240 seconds]
<banister`sleep>
whitequark: the reason we only display one line by deafult is because in 90% of cases (in my experience anyway) most exceptions are just simple/stupid things you can identify right away, and showing additional lines just creates noise. We also make it easier enough to show more (via wtf? and cat --ex) if you need more
browndawg has joined #ruby
<banister`sleep>
but if you want to display more by default, you can change your exception handler with: Pry.config.exception_handler = proc { |ex| ... }
<Illusioneer>
I can replace any letters/numbers but anything with backslashes is ignored
<bean__>
Illusioneer: ^
<Illusioneer>
doesn't work
<bean__>
it just did though
<Illusioneer>
not on my workstation, not on my server
<Illusioneer>
just tried it
<bean__>
what version of ruby
<Illusioneer>
193 385
<Illusioneer>
I can gsub anything else
<Illusioneer>
but not slashes
<Illusioneer>
no error, it just returns nothing
<bean__>
okay, gist some code then
horrror has quit [Quit: horrror]
dhruvasagar has joined #ruby
Mon_Ouie has joined #ruby
ngoldman has quit [Remote host closed the connection]
Mattix has quit [Quit: Leaving]
fmcgeough has joined #ruby
Es0teric has joined #ruby
axl_ has joined #ruby
<Spooner_>
Illusioneer, Are you sure that the string actually has backslashes in it and it isn't just Ruby displaying backslashes before escaped characters?
<Illusioneer>
Spooner: how would I know one way or the other?
jef_abraham has joined #ruby
<Spooner_>
Well, where are the strings coming from and how are you displaying them to know they are not right?
chichouw has quit [Remote host closed the connection]
ezkl has joined #ruby
maycon__ has quit [Quit: Saindo]
<Illusioneer>
well i'm pulling the string from the DB (which is supposed to be an hstore hash)
chichou has joined #ruby
generalissimo has joined #ruby
<Spooner_>
But you should know based on the characters after the slashes.
<Illusioneer>
both rails and irb report it's a string, not a hash
chichou has quit [Read error: Connection reset by peer]
<Spooner_>
Illusioneer, Are you sure it isn't JSON then?
chichou has joined #ruby
<Spooner_>
I've never used hstore though, so I'm just guessing.
<Illusioneer>
can't be, it fails JSON.parse
arya has quit [Ping timeout: 252 seconds]
<Spooner_>
As bean__ suggests, pasting and example (of code or data) is a good idea.
chichou has quit [Remote host closed the connection]
<Illusioneer>
the hstore puts out: "\"host_name\"=>\"titlekey\", \"check_type\"=>\"0\",...
<whitequark>
Illusioneer: puts it
<Spooner_>
No backslashes in that. Those are just "
arya has joined #ruby
<Illusioneer>
ok
jasond has joined #ruby
chichou has joined #ruby
lethjakman has joined #ruby
<Illusioneer>
that would explain why gsub never converts anything
vlad_starkov has joined #ruby
monkegjinni has quit [Remote host closed the connection]
<Spooner_>
Definitely has key/value pairs in it though.
m8 has joined #ruby
<Illusioneer>
tried eval but that didn't work
<bean__>
oh god.
<bean__>
dont eval
chichou has quit [Read error: Operation timed out]
<bean__>
ever
<bean__>
strike that word from your vocabulary
<Spooner_>
Try JSON.parse("{#{data}}") instead.
<Spooner_>
bean__, eval has its uses. Just absolutely not for any external data coming into your app ;)
<Illusioneer>
it does, never in production of course
<bean__>
eh, it's "uses" can often be done other ways.
<Spooner_>
Looks like it should parse as JSON though, so easy enough.
<Spooner_>
bean__ do you use attr_reader? That is just eval.
<bean__>
no
<Illusioneer>
the part that makes no sense, the ruby that saves this does it as a hash, hstore format is a hash, so why does it come back as a mangled string?
<bean__>
well, sometimes
jaygen has quit [Read error: Connection reset by peer]
<bean__>
but rarely.
fire has joined #ruby
nerd has quit [Ping timeout: 256 seconds]
<Spooner_>
Illusioneer, Well, databases are crazy.
<Spooner_>
Does it parse now, at least?
vlad_starkov has quit [Ping timeout: 255 seconds]
<Illusioneer>
nope
pepper_chico has joined #ruby
<Illusioneer>
fails about halfway through
pepper_chico has quit [Max SendQ exceeded]
<Illusioneer>
in the middle of a key no less
jef_abraham has quit [Quit: jef_abraham]
pepper_chico has joined #ruby
pepper_chico has quit [Max SendQ exceeded]
<Spooner_>
Oh crap, silly me. If nothing else, JSON is {"key":"value"}, not {"key"=>"value"}
apok has joined #ruby
<Spooner_>
Does seem odd that it clips the {} off when it saves the Ruby data. I'd expect it to marshal it though, not just write it into a string.
<Illusioneer>
hehe yeah i was thinking that was a bit off
dhruvasagar has quit [Ping timeout: 276 seconds]
pepper_chico has joined #ruby
pepper_chico has quit [Max SendQ exceeded]
<Illusioneer>
this is what i get for playing with halfbaked plugins :)
<Spooner_>
You can gsub that easily. Still, better parsing it as JSON than evalling it as Ruby.
alfakini has joined #ruby
<grohne>
:w
pepper_chico has joined #ruby
<grohne>
(wrong window)
pepper_chico has quit [Max SendQ exceeded]
arturaz has quit [Ping timeout: 255 seconds]
dsf_ has quit [Quit: This computer has gone to sleep]
pdamer has quit [Quit: pdamer]
pepper_chico has joined #ruby
pepper_chico has quit [Max SendQ exceeded]
joofsh has quit [Remote host closed the connection]
Hanmac1 has quit [Quit: Leaving.]
monkegjinni has joined #ruby
pepper_chico has joined #ruby
pepper_chico has quit [Max SendQ exceeded]
<XVirus>
In Array#each the doc says Array#each {|item| block} while Enumerable#all? the doc says [{|obj| block}] ... What's the difference between [{}] and {} ?
Hanmac has joined #ruby
Sou|cutter has quit [Quit: bbiab]
<Spooner_>
It doesn't mean that. It means that bit is optional (in the [])
brianstorti has joined #ruby
carloslopes has joined #ruby
pepper_chico has joined #ruby
<Spooner_>
In fact, the block is optional in both cases, in which case you get an enumerator returned.
<XVirus>
Spooner_: I see
<XVirus>
so if it's optional in both cases .. why do they look different ?
<Spooner_>
Because people writing docs aren't infallible.
digifiv5e has joined #ruby
<XVirus>
Spooner_: LOL .. I'm new to Ruby and I thought this had a significant meaning or something
digifiv5e is now known as Guest76637
<bean__>
nope
<bean__>
no real meaning
jean-lou` has joined #ruby
dekroning has joined #ruby
jean-louis has quit [Read error: No route to host]
<dekroning>
is there a way outside of using Rails, to constantize a string? so I can use it in my Factory classes?
ad_AA has joined #ruby
jekotia has joined #ruby
<hoelzro>
dekroning: sorry, constantize?
wallerdev has joined #ruby
* hoelzro
thinks about constants and symbols
carloslopes has quit [Remote host closed the connection]
Stilo has joined #ruby
<dekroning>
hoelzro: ah, in Rails (or better said ActiveSupport, afaik) you can do someting like def to_class(type); type.to_s.constantize; end
<pseudonymous>
I seem to hit a nomethoderror when trying Net::SMTP.enable_starttls -- which I don't get since it's here http://ruby-doc.org/stdlib-2.0/libdoc/net/smtp/rdoc/Net/SMTP.html (I'm using ruby-2.0.0-p0 from rvm via rubymine where the project uses a 2.0 gemset)
s__dana has joined #ruby
hydrozen has joined #ruby
NiteRain has joined #ruby
j^2 has joined #ruby
<shevy>
pseudonymous perhaps it's buggy
Sou|cutter has joined #ruby
mafolz has quit [Ping timeout: 250 seconds]
<shevy>
hmm
<shevy>
but
<MrZYX>
I see #enable_starttls but ::enable_starttls
backjlack has joined #ruby
<shevy>
pseudonymous why do you use Net::SMTP.enable_starttls where is the .new ?
pskosinski has quit [Ping timeout: 256 seconds]
joofsh has joined #ruby
Bry8Star has quit [Remote host closed the connection]
pepper_chico has quit [Quit: Computer has gone to sleep.]
shiningblue has left #ruby [#ruby]
m8 has quit [Read error: Connection reset by peer]
m8 has joined #ruby
sailias has quit [Ping timeout: 255 seconds]
techhelp has joined #ruby
chichou has quit [Ping timeout: 240 seconds]
endzyme has joined #ruby
mneorr has joined #ruby
<pseudonymous>
Wow, the smtp API is really confusing - I have the option of sending straight data - and that doesn't work if I follow the example given on the API page. I can also just call send_message -- which works, but cannot accept a subject line (making it ridiculously hopeless)... Then there's the funny stuff such as Net::SMTP.start() cannot be used w starttls, no you have to v= Net::SMTP.new(addr, port) then v.start(....) (instead of supplying all
<pseudonymous>
options at once).. Man..
Guest76637 has quit [Ping timeout: 264 seconds]
agjacome has quit [Quit: leaving]
whitenoise has quit [Quit: This computer has gone to sleep]
fabrice31 has quit [Read error: Connection reset by peer]
<dekroning>
shevy: I indeed need to instantiate a object which is wrapped in namespace, I noticed i'm getting 'wrong constant name' when using Object.const_get so I should combined it with Module.const_get ?
<dekroning>
shevy: in my case I did: class_name = "Bar"; Object.const_get("Foo::" + class_name)
yekta has quit [Quit: yekta]
<apeiros_>
dekroning: "wrong constant name" means you're using a name that's not a valid constant
Jrz has quit [Ping timeout: 252 seconds]
<apeiros_>
and while Foo::Bar resolves to a valid constant, it's not a valid constant name itself.
<shevy>
beaky rails is almost its own programming language
<shevy>
just look at all the factoryfactoryfactoryworkergirls
<shevy>
beaky they will reason that using pattern x, y, z will make your life easier
asobrasil has left #ruby [#ruby]
<apeiros_>
beaky: ruby is full with the factory pattern too - Array.new # <-- there
Kudos has quit [Ping timeout: 264 seconds]
<Hanmac1>
shevy about rwx and bitmaps ... each method that uses a bitmap like for sample the StaticBitmap control you dont need to load it, nor do you need to specify the type while loading ... so WX::StaticBitmap.new(self,:bitmap => "red.xpm" ) is fine too
<beaky>
activerecord seems to make life easier... but that's rpboably ebcause I don't know anything else :(
<Hanmac1>
java is full of factory objects :P
Zolo has joined #ruby
<shevy>
Hanmac1 does your code actually work? I mean, when you use ruby, you will popup real widgets with it?
Kudos has joined #ruby
<Hanmac1>
shevy, yeah it works
<shevy>
beaky it probably makes life easier for its respective problem domain
qubit has joined #ruby
jacktrick has joined #ruby
<aedorn>
Bah... need less wx, more Qt!
<beaky>
I guess rails's domain is writing restful webapps, so activerecord is good for htat kind of thing
jacktrick has quit [Client Quit]
mattbl has joined #ruby
whitedawg has joined #ruby
<shevy>
aedorn I cant get qt to compile right now :(
banjara has quit [Quit: Leaving.]
<shevy>
beaky yeah but you are forced into the rails way of building that too
<csmrfx>
I wonder if ruby could be used to access solar insolation data someplace
wargasm has joined #ruby
Spooner_ has quit [Remote host closed the connection]
grohne has quit [Quit: leaving]
<shevy>
what is solar insolation data? does that have to do anything with solar cells?
<csmrfx>
it tells how much solar energy "falls" in given place
<aedorn>
csmrfx: Like an actual reader, or more like interpreting premade maps like from NREL?
reto__ has joined #ruby
reto__ has left #ruby [#ruby]
mneorr has quit [Read error: Operation timed out]
<csmrfx>
aedorn: for simulating energy input @ Lat, Long
<Hanmac1>
aedorn i heard that Canonial will use QT5 for there X11 replacement :P
<csmrfx>
perhaps on a given hour of an day, even
interactionjaxsn has quit [Remote host closed the connection]
<shevy>
Hanmac1 I thought they use their own stuff
<shevy>
they become like apple
<shevy>
not even using wayland anymore
<csmrfx>
aedorn: your question is a good one, but I guess real time or even historical data from all around the world isn
<csmrfx>
't realistic scenario
<beaky>
it's yet another case of NIH syndrome :D
testingb0t has joined #ruby
<csmrfx>
so, in fact it has to be a model
<shevy>
NIH?
<beaky>
not-invented-here
unflores has quit [Quit: unflores]
<aedorn>
csmrfx: models are best left to R and Julia, in my opinion. However, you could use Ruby as a driver. Like Sinatra app, load R/Julia with the data and let it calculate.
realDAB has quit [Quit: realDAB]
<csmrfx>
NArray is pretty quick
<aedorn>
I was trying to find some place to get real time data.. but I guess there really isn't one.
<aedorn>
Hanmac1: Yup, QT5 is the future! Of everything!
<shevy>
one sees a black cat, one sees a white cat, until both figure out that the cat is white on one side and black on the other side!
<makerbreakr>
ya, you are right, iw as looking at the wrong thing
pseudonymous has quit [Ping timeout: 245 seconds]
adkron__1 has quit [Ping timeout: 245 seconds]
adkron___ has quit [Ping timeout: 256 seconds]
danman has joined #ruby
nOStahl has quit [Quit: nOStahl]
workmad3 has quit [Ping timeout: 252 seconds]
jef_abraham has quit [Quit: jef_abraham]
axl_ has quit [Quit: axl_]
twoism has joined #ruby
nga4 has quit []
adkron has joined #ruby
adkron_ has joined #ruby
dhruvasagar has joined #ruby
makerbreakr has left #ruby ["Leaving"]
havenwood has joined #ruby
pdamer has joined #ruby
danman has quit [Quit: danman]
danman has joined #ruby
spider-mario has joined #ruby
girija_ has quit [Ping timeout: 252 seconds]
pdamer has quit [Client Quit]
mahmoudimus has quit [Quit: Computer has gone to sleep.]
imitkit has joined #ruby
whitenoise has quit [Ping timeout: 260 seconds]
ferdev has quit [Quit: ferdev]
jef_abraham has joined #ruby
cantonic has quit [Quit: cantonic]
c0rn has joined #ruby
thone_ has joined #ruby
Takehiro has quit [Remote host closed the connection]
ozgura has quit [Remote host closed the connection]
pothibo has left #ruby [#ruby]
Takehiro has joined #ruby
LBRapid has quit [Quit: Farewell.]
pskosinski has quit [Remote host closed the connection]
g0tcha has joined #ruby
jonahR has joined #ruby
jef_abraham has quit [Read error: Connection reset by peer]
jef_abraham has joined #ruby
mneorr has joined #ruby
takeru has joined #ruby
Takehiro has quit [Read error: No route to host]
<g0tcha>
hey guys, im not sure im asking this in the right place, but im trying to run "rake db:migrate" to install redmine and its giving me this error: http://paste.ubuntu.com/5588412/
io_syl has quit [Quit: Computer has gone to sleep.]
freakazoid0223 has quit [Read error: Connection reset by peer]
imami|afk is now known as banseljaj
<tux91>
How is Rspec able to implement stuff like 'obj.should == whatever'? 'should' is a method on object, but what is '=='? It can't be an argument
<tux91>
and its not a block
Ontolog has joined #ruby
menace has quit [Quit: Leaving.]
motto has quit [Ping timeout: 252 seconds]
zmike123 has quit [Quit: Выходжу]
<JoeHazzers>
i want to conduct http requests using cookies i receive after submitting a form, but i want to do it myself, and for it to not be *too* difficult.
<JoeHazzers>
any suggestions?
kpshek has joined #ruby
Goles has quit [Ping timeout: 252 seconds]
alvaro_o_ has joined #ruby
<tux91>
JoeHazzers: you should not set cookies after submitting a form, you should pass parameters in a post request
jamesfung14 has joined #ruby
<JoeHazzers>
no no
<tux91>
JoeHazzers: but go to #rubyonrails
Dreamer3 has joined #ruby
<JoeHazzers>
this is a *client*
mark_locklear has joined #ruby
<JoeHazzers>
i want to post a form, receive cookies, persist the cookies
kaen has quit [Quit: Leaving]
<tux91>
JoeHazzers: your app is a client?
<havenwood>
tux91: == is a method, it is just syntactic sugar for 'obj.should.==(whatever)
kevinfagan has joined #ruby
turkAlurk has joined #ruby
<JoeHazzers>
yes, i'm writing something for me to use client-side.
<tux91>
havenwood: oh yeah, totally didn't think of that, thanks
<havenwood>
JoeHazzers: I'd suggest mechanize gem or httpclient gem.
arya has quit [Ping timeout: 248 seconds]
nfk has joined #ruby
<havenwood>
JoeHazzers: Both handle cookies well.
ayyeterartik has quit [Quit: I bid you, adieu!]
<JoeHazzers>
yeah, i want to do it myself. for educational purposes, mechanize feels like cheating.
turkAlurk is now known as ayyeterartik
tcstar has quit [Read error: Connection reset by peer]
<havenwood>
JoeHazzers: Maybe take a look at how httpclient does it. Pure Ruby implementation.
mattbl has quit [Quit: This computer has gone to sleep]
<tux91>
wait, clients can read cookies that were set from other domains?
Goles has joined #ruby
Goles_ has quit [Read error: Connection reset by peer]
c0rn has quit [Ping timeout: 245 seconds]
madhatter has quit [Read error: Operation timed out]
chrishough has joined #ruby
timmow has quit [Ping timeout: 252 seconds]
lewis has joined #ruby
lewis has quit [Changing host]
lewis has joined #ruby
madhatter has joined #ruby
hbpoison has joined #ruby
arya has joined #ruby
c0rn has joined #ruby
znode has joined #ruby
<havenwood>
tux91: Yup. Third party cookies, often from advertisers.
alvaro_o_ has quit [Read error: Operation timed out]
freakazoid0223 has joined #ruby
<tux91>
havenwood: so can't your app just grab user's cookies from some other domain, say a user id cookie that that other app is is using for identification? And then you could pose as that user?
ny11 has joined #ruby
Takehiro has joined #ruby
sambio has quit [Ping timeout: 245 seconds]
<ny11>
do most ruby developers know rails?
mneorr has quit [Read error: Connection timed out]
jlast has joined #ruby
<havenwood>
ny11: Sometimes I wonder if most Rails developers know Ruby! :P
mneorr has joined #ruby
Davey has quit [Quit: Computer has gone to sleep.]
Stilo has joined #ruby
fire has joined #ruby
<havenwood>
ny11: I'd imagine pretty much every Ruby developer is at least familiar with Rails, since it is the elephant in the room. There are plenty of Ruby devs who never work in Rails though.
<havenwood>
ny11: In various ways. There are cross-platform GUI toolkits, like tk, wx, shoes, etc. Then there is Ocra for targeting Windows, and MacRuby is awesome for OS X.
chichou has joined #ruby
<havenwood>
ny11: There are also good 2D and 3D games libs.
pdamer has joined #ruby
<lethjakman>
rails is really fun btw, if you're enjoying ruby programming you should give it a shot
<lethjakman>
it has a pretty big learning curve though so be patient
<havenwood>
ny11: And for IOS, MobiRuby or RubyMotion.
<ny11>
oh nice.
mneorr has quit [Remote host closed the connection]
Goles_ has joined #ruby
<ny11>
yeah to be honeset im learning ruby to learn rails
jhowarth has joined #ruby
* Hanmac1
has an binding for GPU accellated 3d gaming too
Goles has quit [Ping timeout: 240 seconds]
_br_ has joined #ruby
chichou has quit [Remote host closed the connection]
<ny11>
for desktop im learning c# and i know bit of python and c++. but i was just curious about ruby for desktop
<havenwood>
ny11: Take a look at Sinatra as well! Really fun to work with and much, much simpler than Rails for a trivial webapp.
<ny11>
so i started learning bunch of things at once. so i know basics of few things but not well enough in one thing
Neomex has joined #ruby
<angelixd>
hey, i'm proxying class calls to a singleton instance and I'd like to DRY up that pattern into a mixin, but I'm not having any luck with using self.included and class_eval. is there something I'm missing here?
<lewis>
ny11: you can spend years mastering each topic. I think the jump to rails is the right thing to do
<Hanmac1>
look at ogre3d ... they also have some stuff for free where you need to pay for with unity3d
codelitt has quit [Remote host closed the connection]
codelitt has joined #ruby
<ny11>
yeah i feel like a loser cause i started learning programming when iwas 12.. im 26 now
<lewis>
and getting your bearings as you go
<ny11>
i am not master at anything
<lewis>
ny11: lol you sound like me
<ny11>
cause i went through maybe a dozen different languages, frameworks,etc
<lewis>
ny11: well at least it took us ten years something to decide to stick with one thing
LBRapid has quit [Client Quit]
<ny11>
i started learning c, c++, vb, php, html, css, js, ruby, c#, actionscript, python, etc.
LBRapid has joined #ruby
elaptics is now known as elaptics`away
LBRapid is now known as Guest85214
<ny11>
most advanced was probably c++ and php where i actually build something somewhat complex.
squidBits has joined #ruby
ayyeterartik is now known as ayyeterartik_
gyre007 has joined #ruby
Ontolog has quit [Remote host closed the connection]
ayyeterartik_ is now known as turkalurk_
<aedorn>
I wish I started with C... I still have nightmares of Z80 machine code.
<ny11>
oh yeah and java and objective-c
<Hanmac1>
ny11 your C & C++ skills can help you when you play with ruby because you can build external bindings
<ny11>
forgot to add those
_br_ has joined #ruby
Ontolog has joined #ruby
_br_ has quit [Excess Flood]
<Hanmac1>
java ... the language with the weekly fixes :P
khismetix has joined #ruby
<ny11>
i wanted to do mobile stuff
<ny11>
so i started learning android and ios at the same time
<ny11>
but objective-c is the worst language ive ever seen
_nitti has quit [Remote host closed the connection]
codelitt has quit [Ping timeout: 245 seconds]
turkalurk_ is now known as ayyeterartik
tvw has quit []
<khismetix>
;) I am an ObJC programmer (ex Java) learning Ruby :)
adkron has joined #ruby
Radnor has joined #ruby
<lewis>
ny11: lol wait are you like my other me
Neomex has quit [Quit: Neomex]
<ny11>
heh
codelitt has joined #ruby
<lewis>
ny11: same languages..except php i learned Java
_br_ has joined #ruby
blaxter has quit [Quit: foo]
<ny11>
so i figured im going to stick with ruby/rails for web apps for now. cause i really want to do some start up and im more business minded but hard to find partners so i figured ill build a prototype myself
pskosinski has joined #ruby
<lewis>
ny11: and the irony is because you switch so much you forget..i barely remember stuff
<ny11>
yeah exactly
Gue______ has joined #ruby
mneorr has joined #ruby
ayyeterartik is now known as turkalurk
<ny11>
im comfortable enough in php to build any kind of application though but it just takes so long and rails is the trend now
mneorr has quit [Remote host closed the connection]
anderse_ has joined #ruby
<lewis>
ny11: go for it! I started a week ago or so
husimon___ is now known as nate_h
<ny11>
how do you like it so far? i did some basic rails things but i want to learn ruby a bit better first
<jsonperl>
this is what I think may be the offending code… a call to get_chunks_wrapper which in turn loads up an array with get_chunk_wrapper
<csmrfx>
Use jruby for apps
<csmrfx>
gain all java ui/windowing libs
<csmrfx>
for the bad and the good
<jsonperl>
not an option
cousine has quit [Ping timeout: 272 seconds]
<Hanmac1>
jsonperl: for sample ary_push may be faster than ary_store inb your sample
<csmrfx>
(was referring to the desktop apps)
<jsonperl>
ah...
<jsonperl>
hanmac1: you think?
Takehiro has quit [Remote host closed the connection]
clooth has quit [Quit: clooth]
ny11 has quit [Ping timeout: 264 seconds]
himsin has quit [Ping timeout: 245 seconds]
elkclone has joined #ruby
codelitt has quit [Ping timeout: 272 seconds]
chichou has quit [Remote host closed the connection]
himsin has joined #ruby
<Hanmac1>
jsonperl ... or maybe not .. you does know how big the array will be "rb_ary_new2" so i think your sample is okay
a_a_g has quit [Quit: Leaving.]
<jsonperl>
hanmac1: seems like reallocating might suck more
chichou has joined #ruby
codelitt has joined #ruby
<jsonperl>
but im def not malloc ing anything
chussenot has joined #ruby
<jsonperl>
so unless theres a problem with cores libs...
pdamer has joined #ruby
interactionjaxsn has joined #ruby
<JoeHazzers>
is there honestly nothing that will take a proper set-cookie header and turn it into something i can use? bah!
tcstar has quit [Remote host closed the connection]
farnearer has joined #ruby
digifiv5e has joined #ruby
DrShoggoth has joined #ruby
digifiv5e is now known as Guest8105
<Hanmac1>
jsonperl ... in this code sample you dont need to malloc anything ... ruby does everything for you (the ruby arrays)
<jsonperl>
right
<jsonperl>
thats my issue… because it seems that this is the culprit for a memory leak
Mo0O has joined #ruby
kpshek has joined #ruby
Nisstyre-laptop has joined #ruby
nachtwandler has quit [Quit: leaving]
adamjleonard has quit [Read error: Connection reset by peer]
adamjleonard has joined #ruby
beaky has quit [Quit: leaving]
codelitt has quit [Ping timeout: 245 seconds]
chichou has quit [Ping timeout: 260 seconds]
tenmilestereo has joined #ruby
adamjleonard has quit [Read error: Connection reset by peer]
farnearer has quit [Quit: Leaving.]
<Hanmac1>
jsonperl ... about the "NUM" ... are you sure about?
adamjleonard has joined #ruby
LBRapid_ has joined #ruby
<jsonperl>
yep its just a macro: #define NUM(num) INT2NUM((int)num)
<aedorn>
I should start blogging about things I don't know about so I can get people to read it, comment with the right information, and then I can compile that information into a knowledge base of ... things I don't know about.
<aedorn>
I imagine I'll get plenty of hate mail though.
codelitt has joined #ruby
khismetix has quit [Quit: Computer has gone to sleep.]
<lectrick>
How do I hook into whenever a new object is created?
bricker_ is now known as bricker
stkowski has joined #ruby
<Hanmac1>
jsonperl ... my i dont know why ... but your code looks okay for me ..
<jsonperl>
lectrick: not sure you can… you can monitor ObjectSpace for new objects
clooth has joined #ruby
<jsonperl>
hanmac1: k thanks for lookin… looks ok to me too :#
verysoftoiletppr is now known as prometeus
Goles_ has quit [Quit: Out.]
hbpoison_ has joined #ruby
Mo0O has quit [Quit: WeeChat 0.4.0]
Hanmac has quit [Ping timeout: 250 seconds]
khismetix has joined #ruby
ayyeterartik has quit [Quit: Leaving]
chichou has joined #ruby
lewix has quit [Remote host closed the connection]
<csmrfx>
lectrick: is there "instantiated"
fermion has quit [Ping timeout: 250 seconds]
jpcamara_ has quit [Quit: jpcamara_]
chichou has quit [Remote host closed the connection]
workmad3 has quit [Read error: Operation timed out]
e-dard has joined #ruby
duosrx has joined #ruby
spychalski has quit [Quit: leaving]
codelitt has quit [Ping timeout: 252 seconds]
spychalski has joined #ruby
cantonic has quit [Quit: cantonic]
pepper_chico has quit [Quit: Computer has gone to sleep.]
clooth has quit [Read error: Connection reset by peer]
codelitt has joined #ruby
<e-dard>
Hi, what' the right way to escape a string that contains a single quote in ActiveRecord?
bean__ is now known as bean|work
shevy has quit [Ping timeout: 248 seconds]
clooth has joined #ruby
<onewheelskyward>
Double quote it?
<e-dard>
onewheelskyward: I mean the right function. I've tried ActiveRecord::Base.connection.quote_string(input) but doesn't seem to be going job
<e-dard>
doing*
<onewheelskyward>
Ah, sorry. I'm more of a datamapper guy.
<e-dard>
(before anyone asks there is a reason why not using ORM and using native string queries, yes I'm aware of risks etc)
pepper_chico has joined #ruby
pepper_chico has quit [Max SendQ exceeded]
pepper_chico has joined #ruby
cantonic has joined #ruby
pepper_chico has quit [Max SendQ exceeded]
<MrZYX>
that's a #rubyonrails question but you want to interpolate it into the query by specifying a ? in the query where the value should be placed and then passing it as additional arguments to whatever function you're calling
pepper_chico has joined #ruby
codelitt has quit [Ping timeout: 252 seconds]
<MrZYX>
like .where("foo = ? AND bar = ?", "I'm evil", "I'm too")
<jani>
trying to learn mixins with ruby, could someone check this example and point me to right direction on how to archive this ? or even if its possible: http://pastebin.com/gM9QzQS0
jamesfung14 has quit [Quit: Leaving]
yekta has joined #ruby
Takehiro has quit [Ping timeout: 276 seconds]
codelitt has joined #ruby
<jani>
basicly, i have a module that i've extended into a class but i would like to expose String's methods so that they would be apply to internal variable - possible ?
<kondi>
apparently madeleine does the job. Anyways thanks.
kondi has left #ruby [#ruby]
<bean|work>
jani: of course it's possible, you really havent shown much code though
kpshek has quit []
<jsonperl>
jani: look into the forwardable module
kpshek has joined #ruby
motto has quit [Changing host]
motto has joined #ruby
motto is now known as m8
chussenot has joined #ruby
tcstar has joined #ruby
_nitti has joined #ruby
<jani>
jsonperl: thanks!
banjara has quit [Quit: Leaving.]
mattbl has quit [Quit: This computer has gone to sleep]
codelitt has quit [Ping timeout: 256 seconds]
banjara has joined #ruby
codelitt has joined #ruby
razibog has quit [Ping timeout: 260 seconds]
eldariof has quit []
banjara has quit [Client Quit]
banjara has joined #ruby
neku has joined #ruby
banjara has quit [Client Quit]
banjara has joined #ruby
Morkel has quit [Read error: Connection reset by peer]
banjara has quit [Client Quit]
mityaz has quit [Quit: See ya!]
Squarepy has quit [Read error: Connection reset by peer]
banjara has joined #ruby
kirun has joined #ruby
Blaze_Boy_ has joined #ruby
shevy has joined #ruby
banjara has quit [Client Quit]
ananthakumaran has quit [Quit: Leaving.]
Blaze_Boy has quit [Ping timeout: 264 seconds]
Blaze_Boy_ is now known as Blaze_Boy
banjara has joined #ruby
pepper_chico has quit [Quit: Computer has gone to sleep.]
Morkel has joined #ruby
banjara has quit [Client Quit]
khismetix has quit [Quit: Computer has gone to sleep.]
banjara has joined #ruby
banjara has quit [Client Quit]
joofsh_ has joined #ruby
codelitt has quit [Ping timeout: 272 seconds]
banjara has joined #ruby
havenwood has quit [Ping timeout: 245 seconds]
codelitt has joined #ruby
banjara has quit [Client Quit]
banjara has joined #ruby
banjara has quit [Client Quit]
banjara has joined #ruby
neurone-1337 has quit [Read error: Operation timed out]
alex__c2022 has quit [Quit: alex__c2022]
banjara has quit [Client Quit]
banjara has joined #ruby
joofsh has quit [Ping timeout: 255 seconds]
banjara has quit [Client Quit]
Goles has quit [Quit: Out.]
banjara has joined #ruby
op84 has quit [Quit: op84]
banjara has quit [Client Quit]
banjara has joined #ruby
banjara has quit [Client Quit]
codelitt has quit [Ping timeout: 245 seconds]
banjara has joined #ruby
neurone-1337 has joined #ruby
banjara has quit [Client Quit]
banjara has joined #ruby
codelitt has joined #ruby
banjara has quit [Client Quit]
banjara has joined #ruby
Proshot has quit [Read error: Connection reset by peer]
banjara has quit [Client Quit]
<aedorn>
So much quit spam
banjara has joined #ruby
<shevy>
aedorn I always toggle to not see that kind of spam
Proshot has joined #ruby
banjara has quit [Client Quit]
Blaze_Boy has quit [Ping timeout: 245 seconds]
banjara has joined #ruby
banjara has quit [Client Quit]
banjara has joined #ruby
<aedorn>
I should probably do the same at this rate
dhruvasagar has quit [Ping timeout: 276 seconds]
swex_ has quit [Read error: Operation timed out]
lushious has joined #ruby
Virunga is now known as [_nina_]
workmad3 has joined #ruby
kristofers has quit [Read error: Connection reset by peer]
codelitt has quit [Ping timeout: 260 seconds]
[_nina_] is now known as Virunga
codelitt has joined #ruby
swex has joined #ruby
kristofers has joined #ruby
carraroj has joined #ruby
<jani>
jsonperl: thanks once more ... that was alot easier than i expected..
dustint has quit [Remote host closed the connection]
Proshot is now known as statarb3
statarb3 has quit [Changing host]
statarb3 has joined #ruby
philcrissman has quit [Remote host closed the connection]
Bry8Star has quit [Remote host closed the connection]
dmerrick has joined #ruby
Takehiro has joined #ruby
codelitt has quit [Read error: Connection reset by peer]
hadees has quit [Quit: hadees]
Nisstyre-laptop has quit [Quit: Leaving]
carbncl has joined #ruby
rickmasta has joined #ruby
chussenot has quit [Quit: chussenot]
jsonperl has left #ruby [#ruby]
jean-louis has joined #ruby
philcrissman has joined #ruby
etcetera has quit []
Takehiro has quit [Ping timeout: 250 seconds]
ryanf has joined #ruby
dustint has joined #ruby
mneorr_ has joined #ruby
mneorr has quit [Read error: Connection reset by peer]
etcetera has joined #ruby
duosrx has quit [Remote host closed the connection]
mulinux has joined #ruby
rickmasta has quit [Read error: Connection reset by peer]
rickmasta has joined #ruby
jamesfung14 has joined #ruby
carbncl has quit [Quit: carbncl]
etcetera has quit [Client Quit]
pdamer has quit [Quit: pdamer]
Nisstyre-laptop has joined #ruby
hbpoison has joined #ruby
thinkclay has joined #ruby
khismetix has joined #ruby
atyz has quit [Ping timeout: 245 seconds]
mfletcher has joined #ruby
spychalski has quit [Quit: leaving]
Hanmac1 has quit [Ping timeout: 252 seconds]
dmiller has quit [Read error: Connection reset by peer]
dmiller1 has joined #ruby
SolidResolve has joined #ruby
SolidResolve has quit [Max SendQ exceeded]
reset has joined #ruby
Hanmac has joined #ruby
SolidResolve has joined #ruby
SolidResolve has quit [Max SendQ exceeded]
SolidResolve has joined #ruby
SolidResolve has quit [Max SendQ exceeded]
khismetix has quit [Ping timeout: 245 seconds]
SolidResolve has joined #ruby
SolidResolve has quit [Max SendQ exceeded]
amacleod has joined #ruby
SolidResolve has joined #ruby
SolidResolve has quit [Max SendQ exceeded]
SolidResolve has joined #ruby
SolidResolve has quit [Max SendQ exceeded]
sambio has joined #ruby
SolidResolve has joined #ruby
SolidResolve has quit [Max SendQ exceeded]
khismetix has joined #ruby
SolidResolve has joined #ruby
SolidResolve has quit [Max SendQ exceeded]
fermion has joined #ruby
moted has quit [Remote host closed the connection]
SolidResolve has joined #ruby
SolidResolve has quit [Max SendQ exceeded]
SolidResolve has joined #ruby
SolidResolve has quit [Max SendQ exceeded]
kpshek has quit []
SolidResolve has joined #ruby
SolidResolve has quit [Max SendQ exceeded]
SolidResolve has joined #ruby
SolidResolve has quit [Max SendQ exceeded]
El_loco has joined #ruby
cantonic_ has joined #ruby
znode has joined #ruby
SolidResolve has joined #ruby
SolidResolve has quit [Max SendQ exceeded]
moted has joined #ruby
SolidResolve has joined #ruby
SolidResolve has quit [Max SendQ exceeded]
joofsh_ has quit [Read error: Connection reset by peer]
ad_AA has joined #ruby
SolidResolve has joined #ruby
SolidResolve has quit [Max SendQ exceeded]
frem has quit [Quit: Farewell!]
etcetera has joined #ruby
Gwyxx has joined #ruby
SolidResolve has joined #ruby
joofsh has joined #ruby
horofox has joined #ruby
cantonic has quit [Ping timeout: 272 seconds]
cantonic_ is now known as cantonic
drumond19 has quit [Remote host closed the connection]
<jani>
more about mixins questions: i have a string & module .. i do mystring.extend(mymodule), in modules extended method, i try to store the value of mystring to modules instance variable, but on the next call to mystring.methodfrommodule, instance variable is nil. What am i missing ?
<csmrfx>
dude
<csmrfx>
gist or pastie
alfakini has quit [Quit: Computer has gone to sleep.]
<csmrfx>
paste code, output, desired output
pavilionXP has quit [Ping timeout: 248 seconds]
<csmrfx>
ei voi ruveta arvailee mitä teit
<jani>
csmrfx: i'll make a small example. rest of the code is so quite unreadable.
swoosh has joined #ruby
horofox has quit [Quit: horofox]
whitequark has joined #ruby
znode has joined #ruby
invisime has quit [Quit: Leaving.]
khismetix has quit [Ping timeout: 256 seconds]
rickmasta has quit [Quit: Leaving...]
jacobw has quit [Quit: WeeChat 0.4.0]
pepper_chico has quit [Quit: Computer has gone to sleep.]
mercwithamouth has joined #ruby
jpcamara has joined #ruby
Bry8Star has joined #ruby
m3pow has quit [Read error: Operation timed out]
znode has quit [Ping timeout: 255 seconds]
khismetix has joined #ruby
axl__ has joined #ruby
axl_ has quit [Ping timeout: 256 seconds]
axl__ is now known as axl_
hiroyuki has quit [Ping timeout: 252 seconds]
pdamer has joined #ruby
biofobico has joined #ruby
ferdev has joined #ruby
biofobico has left #ruby [#ruby]
zigomir has quit [Quit: zigomir]
<jani>
http://pastebin.com/gLNr1Pmm <- there .. i do understand that im not quite familiar with this sort of pattern yet so im sure this is noob question.
mercwithamouth has quit [Ping timeout: 272 seconds]
emergion has joined #ruby
hiroyuki has joined #ruby
mulinux has left #ruby [#ruby]
biofobico has joined #ruby
<apeiros_>
jani: self.extended is a class method of Foo. @orig therefore belongs to Foo, not the object being extended
kpshek has quit []
<apeiros_>
it's not making much sense anyway, since `base` in self.extended is what `self` is in bar. and that doesn't change.
aib has quit [Quit: So long and thanks for all the fish.]
biofobico has quit [Quit: biofobico]
fmcgeough has quit [Quit: fmcgeough]
<sam113101>
you miss an "end", don't you?
<lewis>
oh shit
<lewis>
fuuu end
piotr_ has quit [Remote host closed the connection]
<lewis>
It just took 30min of my life
otherj has quit []
<lewis>
sam113101: thanks
<sam113101>
np
lewis is now known as lewix
Clownz has joined #ruby
yalue has quit [Quit: Leaving]
joeycarm_ has quit [Read error: Connection reset by peer]
pdamer has quit [Quit: pdamer]
joeycarmello has joined #ruby
Zolo has joined #ruby
<jani>
apeiros_: got that, atleast partially. so if extended would be changed to instance method, @orig's context would switch to instance too ? this is the part i dont quite get yet.
mneorr has quit [Ping timeout: 250 seconds]
Zolo has quit [Remote host closed the connection]
krawchyk has quit [Ping timeout: 276 seconds]
slainer68 has joined #ruby
m8 has quit [Quit: Sto andando via]
mneorr has joined #ruby
<jani>
but then again, result is exactly the same - which quite clearly says to me that i don't quite get the big picture ;)
vandemar has joined #ruby
enroxorz-quit has quit [Remote host closed the connection]
clarkf has joined #ruby
sailias has quit [Ping timeout: 264 seconds]
<MrZYX>
hm, how unexpected, I found something I can't overwrite. Looks like you can't trick case statements
bluOxigen has quit [Ping timeout: 276 seconds]
mark_locklear has quit [Ping timeout: 245 seconds]
<onewheelskyward>
clarkf You can try installing libiconv via homebrew for the compilation.
<onewheelskyward>
wait, why is it looking for things in /opt/local/include?
<clarkf>
That's exactly my question
<onewheelskyward>
Any chance you have old macports stuff lingering?
<clarkf>
It provides a `--with-opt-dir` option
geekbri has quit [Remote host closed the connection]
<clarkf>
macports was never installed on this system
Rioji has quit [Remote host closed the connection]
<onewheelskyward>
Do you have an /opt folder?
Axsuul has joined #ruby
<clarkf>
Yeah
geggam__wk has joined #ruby
<onewheelskyward>
weird. Something went and pooped there.
razibog has joined #ruby
geggam_wk has quit [Ping timeout: 245 seconds]
<onewheelskyward>
Anything in your env, clarkf? set | grep /opt
<clarkf>
_=/opt/local/include
<clarkf>
No clue where that's coming from. The only stuff in /opt/local/include is SDL stuff
s__dana has quit [Quit: s__dana]
apeiros_ has quit [Remote host closed the connection]
<clarkf>
It's not being set by ~/.bash_profile
horofox_ has joined #ruby
freakazoid0223 has quit [Read error: Connection reset by peer]
<onewheelskyward>
the underscore has a specific purpose, "The underscore variable is set at shell startup and contains the absolute file name of the shell or script being executed as passed in the argument list. "
spider-mario has quit [Read error: Connection reset by peer]
<clarkf>
Wait, upon running it again, _ is no longer set
<onewheelskyward>
It gets rewritten a lot.
apeiros_ has joined #ruby
Mon_Ouie has quit [Ping timeout: 260 seconds]
<onewheelskyward>
So. I'm running nokogiri within my bundle on 10.8 so I know it's possible. Which ruby are you running?
Azrial has joined #ruby
<clarkf>
So, it's probably getting rewritten during the gem i process?
<clarkf>
1.9.3-p392
Myconix has joined #ruby
`p has quit [Ping timeout: 252 seconds]
<onewheelskyward>
Me too.
emergion has quit [Quit: Computer has gone to sleep.]
<onewheelskyward>
What happens if you gem i nokogiri without the extra args?
<clarkf>
No clue why or how, but at least I can use capybara now
sambao21 has quit [Quit: sambao21]
jcrawford has joined #ruby
<k776>
Hello. GC.start or ObjectSpace.garbage_collect ? (or are they the same thing?)
<realDAB>
Quadlex: well the first thing i notice is that you're calling the method before you define it
<Quadlex>
realDAB: Doesn't the interpreter just deal with that?
musl has joined #ruby
cousine has joined #ruby
<realDAB>
Quadlex: no. it will deal with a reference from one method to another, but not a top-level reference to an undefined method
<realDAB>
Quadlex: also it does indeed seem to be a top-level method, whereas you almost certainly would want to have it as a class method of some class (or module) (or an instance method of Module)
ngoldman_ has joined #ruby
<Quadlex>
DEEERP
<Quadlex>
TIL
alvaro_o_ has quit [Read error: Connection reset by peer]
<Quadlex>
That was all it was
<Quadlex>
*sigh*
<Quadlex>
TY realDAB, you are a Gentleperson and a Scholar
alvaro_o has joined #ruby
<realDAB>
Quadlex: glad to 'elp :-)
<Quadlex>
I think there's levels of skill with a language
grayson has quit [Quit: Computer has gone to sleep.]
uxp has joined #ruby
<Quadlex>
And you pick up the syntax and the idiom
<realDAB>
Quadlex: is this all actually inside a class definition?
<Quadlex>
And then the next stage is coming to terms with HOW shit actually happens
alvaro_o has quit [Remote host closed the connection]
<junidu>
Hi everyone. object_id - unique for every object, but how does that work when there are 2^31 Fixnum object instances, around 2^64 Float instances, plus all the other objects, and only 2^31 possible object ids
<whitequark>
it's wider on 64bit but the idea is the same
<lewix>
what exactly does puts and p do to an array . supposedly it puts call .to_s and p calls .inspect but it seems to work a little bit differently for arrays
adkron_ has quit [Ping timeout: 256 seconds]
musl has joined #ruby
sambao21 has joined #ruby
<havenwood>
If called with an array argument, writes each element on a new line.
<lewix>
havenwood: so it does not call .to_s
<junidu>
aah, it can return a Bignum, that makes sense then
<whitequark>
junidu: the idea is that all distinct objects addressable by ruby are distinct VALUEs, so if we can map VALUE to object_id 1:1 in a some way we're good
<whitequark>
yea
<havenwood>
lewix: Just a quirk of #puts. It actually does call #to_s, on each element.
<lewix>
havenwood: right it just doesnt actually do what [1,2,3].to_s
<havenwood>
lewix: [1,2,3].each(&:to_s)
tommyvyo has quit [Quit:]
<lewix>
havenwood: why is that the output you get from IRB when you use p is different from the one with ruby
jonathanwallace has quit [Ping timeout: 256 seconds]
xiphiasx_ has joined #ruby
<havenwood>
lewix: It doesn't?
qhartman has quit [Ping timeout: 245 seconds]
musl has quit [Read error: Connection reset by peer]
Guest90376 has quit [Ping timeout: 245 seconds]
<havenwood>
lewix: Have an example?
musl has joined #ruby
dougireton has joined #ruby
d2dchat has joined #ruby
<lewix>
my irb crashes a lot ah
<lewix>
havenwood: hold on
<havenwood>
lewix: Only thing I can think of is if you're running 1.9+ on one and 1.8 on the other, maybe?
<havenwood>
Don't. Use. 1.8. :P
kevinfagan has quit [Quit: Leaving...]
<lectrick>
How do I redirect where "puts" goes temporarily?
adamjleonard has quit [Quit: Leaving...]
<lectrick>
basically send stdout to /dev/null within a block
<havenwood>
lectrick: change $stdout
PragCypher has quit [Quit: Leaving]
`p- has joined #ruby
`p has quit [Ping timeout: 245 seconds]
<lewix>
havenwood: ok. how about p, it does call inspect right?
sambao21 has quit [Quit: sambao21]
generalissimo has quit [Remote host closed the connection]
tricon_ has joined #ruby
pdamer has joined #ruby
khismetix has quit [Quit: Computer has gone to sleep.]
kaen has joined #ruby
<havenwood>
lectrick: StringIO
ffranz has quit [Quit: Leaving]
sambao21 has joined #ruby
<lewix>
havenwood: it doesn't look like it
<havenwood>
lectrick: Avdi did a great example of doing something just like that in a RubyTapas episode, sec.
sailias has quit [Quit: Leaving.]
sambao21 has quit [Client Quit]
pdamer has quit [Client Quit]
breakingthings has quit []
zekriad has quit [Quit: Computer has gone to sleep.]
bnjamin has joined #ruby
junidu has quit [Quit: Page closed]
qhartman has joined #ruby
alanp_ has joined #ruby
alanp has quit [Disconnected by services]
alanp_ is now known as alanp
etcetera has quit []
<felixjet>
im doing tryruby.org tutorial but.... there is a lesson at the start that say use "poem.lines.to_a.reverse" and it just doesnt work! http://ideone.com/jGnzgT
Blaze_Boy has quit [Ping timeout: 272 seconds]
joeycarmello has quit [Read error: Connection reset by peer]
`p- has quit [Ping timeout: 272 seconds]
joeycarmello has joined #ruby
s122 has quit [Ping timeout: 252 seconds]
pdamer has joined #ruby
shevy has quit [Ping timeout: 252 seconds]
<felixjet>
i think tryruby.org is just f*cked
<felixjet>
it doesnt work as expected, what a way to learn..
<lewix>
felixjet: idon't think you need to_a
JaTochNietDan has quit [Ping timeout: 256 seconds]
<felixjet>
the tutorial say it
<felixjet>
plus in the tutorial interpreter it works
<havenwood>
lectrick: Avdi gives a bunch of examples. Could actually send it to /dev/null if you wanted, ^ i just send it here to a StringIO object and do nothing with it
kirun has quit [Quit: Client exiting]
atmosx has quit [Quit: And so the story goes…]
<havenwood>
lectrick: If that is even what you meant?
sambao21 has joined #ruby
<MrZYX>
felixjet: you're not catching the return value, all those methods operate on copies and return those modified copies. it "works" in the tutorial interpreter because it prints the return value
Radnor has joined #ruby
etcetera has joined #ruby
<lewix>
MrZYX: use reverse!
backjlack has quit [Remote host closed the connection]
mmitchell has quit [Ping timeout: 264 seconds]
<MrZYX>
lewix: well you can't chain that then
ozgura has joined #ruby
<lewix>
MrZYX: you can't?
wmdom25_ has joined #ruby
[Neurotic]_ is now known as [Neurotic]
<vandemar>
would it be considered bad coding style if there's a hash with a bunch of keys, and values to validate, to have another hash mapping keys to anonymous blocks that validate the values in the first hash?
<felixjet>
well, the tutorial is broken..
<MrZYX>
lewix: nope, usually bang methods only return something when they change something, so you quickyl run into a nil
<felixjet>
even if i dont modify vars, they do
<felixjet>
:/
imitkit has quit [Quit: imitkit]
jtharris has quit [Quit: WeeChat 0.4.0]
bean|work has quit [Quit: Computer has gone to sleep.]
ad_AA has quit [Ping timeout: 276 seconds]
horofox_ has quit [Quit: horofox_]
swex has quit [Remote host closed the connection]
hackeron_ is now known as hackeron
hackeron has quit [Changing host]
hackeron has joined #ruby
swex has joined #ruby
poikon has joined #ruby
dmiller1 has quit [Ping timeout: 272 seconds]
shevy has joined #ruby
`p- has joined #ruby
<shevy>
test
<sam113101>
tset
tvw has quit []
<havenwood>
lectrick: Updated Gist to properly send output to null.
<lewix>
MrZYX: I thought lines returned an array..and we didn't need to_a
jpcamara has joined #ruby
tenmilestereo has quit [Quit: Leaving]
<Scriptonaut>
Hey guys, when using ruby regex's, how do I make match = /<textarea/ =~ line; return the position at the end of the match
jpcamara has quit [Remote host closed the connection]
<MrZYX>
lewix: in 2.0 it does, not in 1.9
<havenwood>
Yup, works in latest stable Ruby release. :)
SCommette has quit [Quit: SCommette]
rickmasta has joined #ruby
libryder has quit [Ping timeout: 245 seconds]
<_br_>
Scriptonaut: Are you using Regular expressions to match against HTML/XML ?
amacleod has quit [Quit: Leaving]
mercwithamouth has joined #ruby
<Scriptonaut>
_br_ yep :)
<dsf>
Scriptonaut, can you please specify your problem more clear?
ngoldman has joined #ruby
<Scriptonaut>
dsf, so, when you use the operator =~ in ruby, it returns an index of the match
<Scriptonaut>
for a patter in a regular expression
<_br_>
Scriptonaut: Never ever parse HTML/XML with regular expressions, that nonsense. For that there are plenty of parsers.
<Scriptonaut>
I want it to return the end of the patter
<Scriptonaut>
_br_ why?
jonahR has quit [Quit: jonahR]
<Scriptonaut>
I'm just making a quick script that I'm going to use once
<havenwood>
Scriptonaut: Nokogiri is very nice.
Gues_____ has joined #ruby
jrajav has joined #ruby
<Scriptonaut>
I have about 500 electronic forms, and the guy who wrote them used style="width:655" without the px at the end
<havenwood>
(For parsing (X)HTML)
<Scriptonaut>
havenwood, I've actually used Nokogirl when I was writing rails apps
tommyvyo has joined #ruby
Gues_____ is now known as flip_digits
<MrZYX>
so you want to just add the px?
<onewheelskyward>
nokogiri++
<Scriptonaut>
yes
<Scriptonaut>
because we're moving to html5 doctypes
<Scriptonaut>
and if you don't specify px, it relies on cols
<_br_>
Scriptonaut: a.) every time you parse a HTML/XML document with regex'es a kitten dies. b.) Use Nokogiri it has nice selector syntax and can probably easily give you what you want.
<MrZYX>
.gsub(/width:(\d+)/, "width:\1px")
Whatyousay has joined #ruby
<Scriptonaut>
MrZYX, thanks :)
<Scriptonaut>
_br_, I gotta be quick and dirty here
<lewix>
MrZYX: lewix: nope, usually bang methods only return something when they change something, so you quickyl run into a nil. ==> I thought the bang method changed the copied array
Stilo has joined #ruby
ngoldman_ has quit [Ping timeout: 260 seconds]
<_br_>
Scriptonaut: the poor kittens ;)
<Scriptonaut>
if what they say about masturbating is true I've already commited genocide, 500 more won't hurt
joeycarmello has quit [Read error: Connection reset by peer]
<_br_>
^^
<MrZYX>
lewix: well true in this case, still the variable would go unaffected so not what he wanted in this case anyway
joeycarmello has joined #ruby
arya has quit [Ping timeout: 255 seconds]
emergion has quit [Quit: Computer has gone to sleep.]
Whatyousay has quit [Client Quit]
Whatyousay has joined #ruby
tjbiddle has joined #ruby
joeycarmello has quit [Read error: Connection reset by peer]
Whatyousay has left #ruby [#ruby]
arya has joined #ruby
<realDAB>
Scriptonaut: if you ever need the offset where a particular match begins and ends, look into MatchData objects and their begin, end, and offset methods
<dsf>
MrZYX, Scriptonaut: I guess you need "\\1"
joeycarmello has joined #ruby
<MrZYX>
yeah I always mess that up :P
<dsf>
MrZYX, it happened to me to. ;-)
znode has quit [Ping timeout: 245 seconds]
<Scriptonaut>
realDAB, today I learned, thanks
geggam__wk has quit [Read error: Connection reset by peer]
<Scriptonaut>
dsf, Hmm, i replaced \1 with \\1, not working as planned
joeycarmello has quit [Remote host closed the connection]
<MrZYX>
you might want to be tolerant about whitespace: .gsub(/width:\s*(\d+)/, "width: \\1px")