banister has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tkuchiki has quit [Ping timeout: 255 seconds]
b_hoffman has joined #ruby-lang
auzty has quit [Quit: Leaving]
Pathfinder has quit [Ping timeout: 250 seconds]
lucas__ has joined #ruby-lang
solars_ has joined #ruby-lang
PaulePan1er has joined #ruby-lang
benlovell has quit [Ping timeout: 265 seconds]
nvg has quit [Ping timeout: 250 seconds]
solars has quit [Ping timeout: 250 seconds]
PaulePanter has quit [Ping timeout: 250 seconds]
lucas has quit [Ping timeout: 250 seconds]
segy has quit [Ping timeout: 250 seconds]
ldnunes has joined #ruby-lang
segy has joined #ruby-lang
hahuang65 has joined #ruby-lang
fujimura_ has joined #ruby-lang
hahuang65 has quit [Ping timeout: 244 seconds]
symm- has joined #ruby-lang
fujimura_ has quit [Ping timeout: 272 seconds]
elia has joined #ruby-lang
konsolebox has quit [Quit: Leaving]
[k- has joined #ruby-lang
banister has joined #ruby-lang
stardiviner has joined #ruby-lang
stardiviner has quit [Changing host]
stardiviner has joined #ruby-lang
revath has quit [Quit: Leaving.]
futilegames has joined #ruby-lang
revath has joined #ruby-lang
sgambino has joined #ruby-lang
futilegames has quit [Client Quit]
ur5us has quit [Remote host closed the connection]
Mon_Ouie has quit [Ping timeout: 246 seconds]
banister has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
benlovell has joined #ruby-lang
alestuber has joined #ruby-lang
TvL2386 has joined #ruby-lang
hinbody has joined #ruby-lang
farme has joined #ruby-lang
<farme>
clear
<farme>
Hi !
stamina has quit [Ping timeout: 265 seconds]
<jhass>
hi
mehdi1 has joined #ruby-lang
chouhoulis has quit [Remote host closed the connection]
chinmay_dd has quit []
<farme>
quit
farme has quit [Quit: Leaving]
shazaum has joined #ruby-lang
shazaum has quit [Changing host]
shazaum has joined #ruby-lang
nedp has quit [Remote host closed the connection]
revath1 has joined #ruby-lang
revath has quit [Ping timeout: 256 seconds]
workmad3 has quit [Ping timeout: 256 seconds]
sankaber has joined #ruby-lang
[k-_ has joined #ruby-lang
k3asd` has quit [Ping timeout: 245 seconds]
tkuchiki has joined #ruby-lang
toretore has joined #ruby-lang
imperator has joined #ruby-lang
charliesome has joined #ruby-lang
symm- has quit [Ping timeout: 252 seconds]
Pathfinder has joined #ruby-lang
olistik has joined #ruby-lang
<olistik>
hi @all :-)
<elia>
olistik, sup?
<olistik>
oh, hi there :-D
<olistik>
I was playing around with pure functions in Ruby
<olistik>
and wondering if Ruby gives you performance benefits when dealing with pure functions
<jhass>
no, 98% sure it doesn't, it's an OOP focused language after all
<olistik>
marking a method as a pure function should tell the interpreter that it can be further optimized
<olistik>
it seems the GC punishes you for creating immutable objects.. ^_^'
<olistik>
jhass: that's a pity
<elia>
olistik, are lambdas pure functions? I mean, they still have to care about closure variables…
<jhass>
not really, it's just not the language you want it to be, if that's an issue for you use another language
<jhass>
I don't use a hammer if I want a screwdriver
<apeiros>
I don't think ruby has pure functions
<elia>
afaik there are no pure functions in ruby
<olistik>
jhass: ruby is actually a multi-function rocket launcher, I'd expect some configurations from it :-D
<elia>
yep
<apeiros>
lambda/proc/bock all are closures
<apeiros>
and the rest is either toplevel code or methods
<elia>
the only difference could be method lookup (it's an issue in js for example) but I think MRI method cache has it covered…
malconis has joined #ruby-lang
allomov has quit [Remote host closed the connection]
<Petruchio>
I don't really think there *could* be pure functions in Ruby. "Functions" are all methods of some object; you're passing messages. The object can respond to the message as it pleases; you don't know what's happening behind the scenes.
<olistik>
I don't know Ruby's internal implementation but would its GC speeds up if it can detect methods that declare themselves as "pure function-ish". It could mark every object created in its execution context as trashable.
<Petruchio>
Within a pure function, you'd have to be able to perform operations which are also pure, and so on down the line.
<Petruchio>
Ruby doesn't have such things.
revath1 has quit [Ping timeout: 250 seconds]
<Petruchio>
This seems fundamentally at odds with the nature of the language.
<Petruchio>
Say I want a pure function which looks like { |arg| return arg + 1 }. + is a method of the arg object, and 1 is an object.
<olistik>
Petruchio: it would be an optimization such as declaring inline functions in C++ or unsafe code in Rust
<Petruchio>
I understand how that works.
ttilley has joined #ruby-lang
<olistik>
probably more like "unsafe" ;-)
<apeiros>
olistik: ruby already has a generational GC, which attempts to do precisely something like that - quickly GC frame local variables
ttilley has quit [Client Quit]
<Petruchio>
I'm saying it can't happen in Ruby, as best I know.
nvg has joined #ruby-lang
<olistik>
apeiros: that's nice, so it actually gives you a little benefit (to be traded with the cost of the added immutability)
<olistik>
Petruchio: I understand that it's a bit cumbersome (to say the least) in the way we currently do Ruby
<olistik>
:-)
Miphix has joined #ruby-lang
<Petruchio>
"a bit cumbersome" != "can't happen"
gambl0re has quit [Ping timeout: 272 seconds]
<elia>
anyway looks a bit like what brixen was advocating in one of his presentation
<olistik>
elia: do you have a link?
* apeiros
concurs with jhass
<apeiros>
if you use ruby, use it to its strenghts
<olistik>
Petruchio: I'm not getting why it can't happen, by looking at the closure you've written
<apeiros>
if what you want to do are not ruby's strengths - use a language which has those things as strengths
<elia>
olistik, no, just search youtube, was probably something related to rubinius x
<olistik>
elia: searching :-)
<imperator>
time for Elixir
hinbody has quit [Read error: Connection reset by peer]
<Petruchio>
arg calls its + method, with an argument of 1. You'd need to ensure that + had no side effects. What is + implemented in terms of? They'd have to be other pure functional operations.
<Petruchio>
I'm thinking this through. If I turn out to be wrong, I'll appreciate the experience of having argued this. :-)
hahuang65 has joined #ruby-lang
skade has quit [Quit: Computer has gone to sleep.]
yalue has joined #ruby-lang
enebo has joined #ruby-lang
bungoman has joined #ruby-lang
<jhass>
worse, I can change + at any point to something it's not pure
<Petruchio>
Yeah, that's right, but Ruby kind of cheats at that sometimes anyway, I think.
<jhass>
so method (re)definition would have to rejudge everything
<Petruchio>
It breaks abstraction, in a sense, though.
<Petruchio>
For instance, if I say "some string %{name}." % some_hash
<Petruchio>
And some_hash doesn't have a :name key, but it does have a default value.
<Petruchio>
The default value isn't used, as you'd expect.
<Petruchio>
The OO isn't quite "pure", either. :-)
<olistik>
Petruchio: I was thinking about potentially unsafe method marks
fujimura_ has joined #ruby-lang
<olistik>
something the developer set, not the interpreter by itself
<Petruchio>
*That* sounds bad.
<jhass>
well, that's because all hashes have a default value
<Petruchio>
I'd think the interpreter should be responsible for that.
hahuang65 has quit [Ping timeout: 256 seconds]
<Petruchio>
They do, yes.
<Petruchio>
But a default value is still a value.
<Petruchio>
To the rest of the world, it shouldn't matter.
skade has joined #ruby-lang
<olistik>
Petruchio: Ruby lets you tune GC settings with potentially unsafe side effects
<Petruchio>
When I pass a message to an object, it sends a response. Another object shouldn't be able to tell that the response is a default.
<jhass>
accessing a missing value and checking whether a key exists are quite distinct operations
<Petruchio>
Asking for a value and asking whether a key exists are definitely distinct.
momomomomo has joined #ruby-lang
<Petruchio>
And that's a good point; I wonder whether the % method starts off by asking about keys.
<jhass>
so % decided to check whether the key exists, because all not existing %{foo}s replaced by nothing would be a lot more confusing
<Petruchio>
I'm guessing not, but again I could be wrong.
fujimura_ has quit [Ping timeout: 256 seconds]
workmad3 has joined #ruby-lang
<Petruchio>
I just defined has_key? to return true in any case, and still got a KeyError.
<Petruchio>
Tried that both for Hash and for a subclass.
<Petruchio>
I guess it could be asking for the information some other way, but I'm thinking this is an optimization.
<Petruchio>
I know I've run across a few other things where things don't work in a quite pure OO way, which were optimizations. I can't quite recall them offhand, but I'll try to think of examples.
<jhass>
it probably is calling the C function directly and avoids transitioning back to Ruby land
bungoman has quit []
<jhass>
a subclass of Hash still is_a? Hash
k3asd` has joined #ruby-lang
chouhoulis has joined #ruby-lang
chouhoulis has quit [Remote host closed the connection]
chouhoulis has joined #ruby-lang
stardiviner has quit [Ping timeout: 245 seconds]
<Petruchio>
I'm sure that's the case, yes. Hypothetically, it should check to see whether I have a has_key? before executing the native code.
bruno- has joined #ruby-lang
Pathfinder has quit [Ping timeout: 246 seconds]
skade has quit [Quit: Computer has gone to sleep.]
skade has joined #ruby-lang
caseypatrickdris has joined #ruby-lang
bruno- has quit [Ping timeout: 265 seconds]
dzejrou has joined #ruby-lang
hinbody has joined #ruby-lang
pyo_ has quit []
momomomomo_ has joined #ruby-lang
momomomomo has quit [Ping timeout: 264 seconds]
momomomomo_ is now known as momomomomo
bantic has joined #ruby-lang
bantic has quit [Client Quit]
charliesome has quit [Quit: zzz]
symm- has joined #ruby-lang
bantic has joined #ruby-lang
joaomdmoura has joined #ruby-lang
joaomdmoura has quit [Read error: Connection reset by peer]
joaomdmoura has joined #ruby-lang
bruno- has joined #ruby-lang
bruno- is now known as Guest41235
agarie has joined #ruby-lang
joaomdmoura has quit [Ping timeout: 272 seconds]
banister has joined #ruby-lang
tkuchiki has quit [Ping timeout: 264 seconds]
DCameronMauch has joined #ruby-lang
slawrence00 has joined #ruby-lang
skade has quit [Quit: Computer has gone to sleep.]
bungoman has joined #ruby-lang
gambl0re has joined #ruby-lang
skade has joined #ruby-lang
nomadicoder has quit []
riotjones has quit [Remote host closed the connection]
dudedudeman has quit [Changing host]
dudedudeman has joined #ruby-lang
whippythellama has joined #ruby-lang
elia has quit [Quit: Computer has gone to sleep.]
caseypatrickdris has quit [Remote host closed the connection]
postmodern has joined #ruby-lang
hinbody has quit [Ping timeout: 265 seconds]
charliesome has joined #ruby-lang
jas02 has quit [Quit: jas02]
<imperator>
hm, rspec and rbenv not getting along
VinnyBoy has joined #ruby-lang
<imperator>
"no Ruby script found in input" - that's a new one for me
<jhass>
haha
<jhass>
rbenv I like the least
<imperator>
doesn't seem to like the -S in their baked in rake task
centrx has joined #ruby-lang
hinbody has joined #ruby-lang
chinmay_dd has joined #ruby-lang
symm- has quit [Ping timeout: 272 seconds]
alestuber has quit [Remote host closed the connection]
skammer has joined #ruby-lang
skammer has quit [Client Quit]
caseypatrickdris has joined #ruby-lang
skammer has joined #ruby-lang
<maloik>
I have a module that defines a class method which in turn defines some callbacks to log changes to the classes the module is included in. Is there a way to stub a method in all classes that have the module included without manually defining them?
<maloik>
not sure if that question made sense at all :D
<maloik>
a bunch of our activerecord classes have it included, so we log changes to the objects to logstash automatically without too much custom code
<maloik>
there's some stuff going on for exceptions about what to log, and extra attributes to log and what not but that's irrelevant for this example
jo__ has joined #ruby-lang
<maloik>
problem is that right now the callbacks are being triggered in tests, I'd like them to never be set in the first place, perhaps by stubbing the log_changes method for all classes that have the module included
<centrx>
can't you just define your logger method so it returns immediately if it is run in a test environment?
<maloik>
I could but I'm not a fan of that
<maloik>
not sure why, but checking for env throughout the code feels icky :D
skade has quit [Quit: Computer has gone to sleep.]
<centrx>
How else would you do it?
<centrx>
And it's not throughout the code, it's only in the logger module
<maloik>
metaprogramming and stubbing the method
<maloik>
(maybe)
PaulePan1er is now known as PaulePanter
momomomomo has quit [Ping timeout: 256 seconds]
Chagel has joined #ruby-lang
momomomomo has joined #ruby-lang
TvL2386 has quit [Quit: Ex-Chat]
skammer is now known as skammer|afk
caseypatrickdris has quit [Remote host closed the connection]
baweaver has quit [Remote host closed the connection]
alestuber has quit [Ping timeout: 245 seconds]
alestuber has joined #ruby-lang
seank_ has quit [Remote host closed the connection]
wallerdev_ has quit [Ping timeout: 252 seconds]
symm- has joined #ruby-lang
alestuber has quit [Read error: Connection reset by peer]
elia has quit [Read error: Connection reset by peer]
dayid has quit [Remote host closed the connection]
DCameronMauch has joined #ruby-lang
momomomomo has joined #ruby-lang
elia has joined #ruby-lang
momomomomo_ has joined #ruby-lang
imperator2 has joined #ruby-lang
chinmay_dd has quit []
zendrix has quit [Remote host closed the connection]
<DCameronMauch>
How do you dynamically add a method to an instance, when the method name is in a variable? I do not want to contaminate the class or any other instances.
momomomomo has quit [Ping timeout: 256 seconds]
momomomomo_ is now known as momomomomo
GarethAdams has quit [Ping timeout: 276 seconds]
havenwood has joined #ruby-lang
alestuber has joined #ruby-lang
revath has quit [Ping timeout: 265 seconds]
shinnya has joined #ruby-lang
arBmind has joined #ruby-lang
GarethAdams has joined #ruby-lang
<imperator>
extend + instance_eval would be my first attempt DCameronMauch
<imperator>
or instance_variable_get
arBmind has quit [Read error: Connection reset by peer]
postmodern has quit [Remote host closed the connection]
<DCameronMauch>
with the instance_eval, still not sure how to define the method when the method name is in a variable
<DCameronMauch>
can't use define_method - that is a class method
chadwtaylor has joined #ruby-lang
<imperator>
i'll take a stab at it, see what i can come up with
<DCameronMauch>
it would create the method in all instances
<DCameronMauch>
okey dokey, thanks
<imperator>
is this a regular instance variable, a class variable, or a class instance variable?
<jhass>
DCameronMauch: define_singleton_method, but doing that at runtime is smelly
<imperator>
jhass, like most metaprogramming ;)
<DCameronMauch>
well, this is actually to be used in a spec
<DCameronMauch>
apparently mocking out :respond_to? breaks things
<jhass>
will likely still slow them down
<jhass>
yeah, why do you do that?
jwaldrip has quit [Quit: Be back later ...]
frank___1 has joined #ruby-lang
<DCameronMauch>
I am testing a module, that looks for methods and calls them if they exist
<jhass>
perhaps you meant to define respond_to_missing? ?
jwaldrip has joined #ruby-lang
<DCameronMauch>
I am including the module to test in an otherwise empty test class
baweaver has quit [Remote host closed the connection]
jwaldrip has quit [Ping timeout: 265 seconds]
joaomdmoura has quit [Remote host closed the connection]
drewo has joined #ruby-lang
jwaldrip has joined #ruby-lang
rikkipitt has joined #ruby-lang
revath has quit [Ping timeout: 256 seconds]
zendrix has joined #ruby-lang
jwaldrip has quit [Ping timeout: 258 seconds]
revath has joined #ruby-lang
yalue has joined #ruby-lang
jwaldrip has joined #ruby-lang
benlovell has quit [Ping timeout: 264 seconds]
benlovell has joined #ruby-lang
fusillicode has joined #ruby-lang
joaomdmoura has joined #ruby-lang
skade has quit [Quit: Computer has gone to sleep.]
fusillicode has quit [Client Quit]
fusillicode has joined #ruby-lang
redbullion has joined #ruby-lang
jwaldrip has quit [Ping timeout: 255 seconds]
jwaldrip has joined #ruby-lang
wallerdev_ has joined #ruby-lang
ta has quit [Remote host closed the connection]
jwaldrip has quit [Ping timeout: 246 seconds]
fujimura has joined #ruby-lang
jwaldrip has joined #ruby-lang
wallerdev has quit [Quit: wallerdev]
langlands has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
wallerdev_ has quit [Ping timeout: 244 seconds]
elia has quit [Read error: Connection reset by peer]
fujimura has quit [Ping timeout: 255 seconds]
elia has joined #ruby-lang
b_hoffman has joined #ruby-lang
bb010g has quit [Quit: Connection closed for inactivity]
workmad3 has joined #ruby-lang
jwaldrip has quit [Ping timeout: 272 seconds]
jwaldrip has joined #ruby-lang
chouhoulis has quit [Ping timeout: 264 seconds]
lupine has left #ruby-lang ["Leaving"]
workmad3 has quit [Ping timeout: 252 seconds]
momomomomo has quit [Ping timeout: 244 seconds]
jwaldrip has quit [Ping timeout: 255 seconds]
sepp2k has quit [Quit: Leaving.]
jwaldrip has joined #ruby-lang
momomomomo has joined #ruby-lang
GBrawl has joined #ruby-lang
jwaldrip has quit [Ping timeout: 252 seconds]
olleolleolle has left #ruby-lang [#ruby-lang]
jgpawletko has quit [Quit: jgpawletko]
<BanzaiJoe>
RubyMine , WTF, you default to the users documents, then you scan them all, then you create a UI that makes it look like the project is in user documents....I give you day to make a better impression
jwaldrip has joined #ruby-lang
mkosaki has quit [Ping timeout: 276 seconds]
kadoppe has quit [Ping timeout: 246 seconds]
<sarkyniin>
anyone has some experience with google drive oauth login in ruby?
<sarkyniin>
and the google drive gem
<sarkyniin>
until now, I just used the simple GoogleDrive.login(email, password) but now I need to go through the whole oauth process
<sarkyniin>
which is a pain
Squarepy has joined #ruby-lang
igualpuyo has joined #ruby-lang
kadoppe has joined #ruby-lang
havenwood has quit [Ping timeout: 240 seconds]
skade has joined #ruby-lang
elia has quit [Quit: Computer has gone to sleep.]
zendrix has quit [Remote host closed the connection]
arBmind has joined #ruby-lang
arBmind has quit [Client Quit]
jwaldrip has quit [Ping timeout: 264 seconds]
chadwtay_ has joined #ruby-lang
baweaver has joined #ruby-lang
jwaldrip has joined #ruby-lang
chadwtaylor has quit [Ping timeout: 265 seconds]
momomomomo has quit [Ping timeout: 250 seconds]
bb010g has joined #ruby-lang
Squarepy has quit [Quit: Leaving]
jwaldrip has quit [Ping timeout: 256 seconds]
momomomomo has joined #ruby-lang
wallerdev has joined #ruby-lang
jwaldrip has joined #ruby-lang
igualpuyo has quit [Quit: Leaving]
jgpawletko has joined #ruby-lang
havenwood has joined #ruby-lang
redbullion has quit [Remote host closed the connection]
jwaldrip has quit [Ping timeout: 250 seconds]
jwaldrip has joined #ruby-lang
mfmfmfmfmfmf has joined #ruby-lang
momomomomo has quit [Quit: momomomomo]
alestuber has quit [Remote host closed the connection]
lapide_viridi has quit [Quit: Leaving]
zendrix has joined #ruby-lang
wallerdev_ has joined #ruby-lang
Missphoenix has joined #ruby-lang
jwaldrip has quit [Ping timeout: 244 seconds]
joaomdmoura has quit [Remote host closed the connection]
rikkipitt has quit [Remote host closed the connection]
djbkd has quit [Remote host closed the connection]
joaomdmoura has quit [Remote host closed the connection]
jwaldrip_ has quit [Ping timeout: 255 seconds]
arBmind has joined #ruby-lang
jwaldrip_ has joined #ruby-lang
rikkipitt has joined #ruby-lang
skammer has joined #ruby-lang
banister has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
gambl0re has quit [Ping timeout: 256 seconds]
Petruchio has quit [Ping timeout: 256 seconds]
alestuber has joined #ruby-lang
Petruchio has joined #ruby-lang
bertocode has joined #ruby-lang
Benvolio has joined #ruby-lang
benlovell has quit [Ping timeout: 240 seconds]
zendrix has quit [Remote host closed the connection]
zendrix has joined #ruby-lang
Petruchio has quit [Ping timeout: 258 seconds]
SpeakerToMeat has quit [Ping timeout: 255 seconds]
<havenwood>
imperator2: My first impression is that it's janky to try to tie a RUBY_ENGINE to a particular RUBY_VERSION. JRuby of a particular version can run in 1.9 or 2.0 mode, etc.
yalue has quit [Quit: return 0;]
<havenwood>
imperator2: In dev versions MRI, JRuby and Rubinius all now support RUBY_ENGINE_VERSION for the RUBY_ENGINE version.
alestuber has quit [Ping timeout: 265 seconds]
<havenwood>
Negated requirements don't make sense to me, like the example: :rubinius => 'unsupported'
ht__ has quit [Quit: Konversation terminated!]
elia has joined #ruby-lang
<havenwood>
imperator2: But seems they care about the JRUBY_VERSION (RUBY_ENGINE_VERSION) so that's what they should be specifying.
alestuber has joined #ruby-lang
benlovell has joined #ruby-lang
SpeakerToMeat has joined #ruby-lang
baweaver has quit [Remote host closed the connection]
<havenwood>
I can imagine a scenario where one might want to specify both RUBY_VERSION and RUBY_ENGINE_VERSION on a per RUBY_ENGINE basis. Dunno if it's worth supporting that.
<zendrix>
How do I load a local .gem file into irb.
<zendrix>
?
centrx has joined #ruby-lang
Fooster has quit [Ping timeout: 276 seconds]
<havenwood>
zendrix: Install the gem and require it from your irb session.
<havenwood>
zendrix: Sure, the long way you could `gem unpack ... && cd .. && gem unpack && gem install` but just skip straight to the install if you're not modifying the gem.
<havenwood>
That second gem unpack I meant gem build.
<zendrix>
But when I tried the 'gem install this_gem-1.0.0.gem' it said ERROR: Could not find a valid gem 'this_gem-1.0.0.gem' in any reposiroty
<zendrix>
So delete the built .gem and just try the install without the build first?
<havenwood>
zendrix: was it in your local directory?
baweaver has joined #ruby-lang
<zendrix>
yes
<havenwood>
zendrix: Should work, double check filename.
<jhass>
I think it needs the ./
<zendrix>
havenwood: Thanks. It has been a long day.
<jhass>
should at least tab complete if you start that way ;)
ldnunes has quit [Ping timeout: 276 seconds]
<havenwood>
imperator2: Hmm, yeah not sure how to represent it but both RUBY_VERSION and RUBY_ENGINE_VERSION seem relevant.
workmad3 has joined #ruby-lang
allomov has quit [Remote host closed the connection]
Fooster has joined #ruby-lang
joaomdmoura has joined #ruby-lang
sarkyniin has quit [Ping timeout: 272 seconds]
<havenwood>
imperator2: Maybe leave `required_ruby_version` as-is and have a `required_ruby_engine_version`?
jgpawletko has quit [Quit: jgpawletko]
<havenwood>
Or have both take a hash for the most granularity.
<havenwood>
imperator2: Dunno.
k3asd` has joined #ruby-lang
chadwtay_ has quit [Read error: Connection reset by peer]
gamename has quit [Remote host closed the connection]
gamename has joined #ruby-lang
<havenwood>
*'>= 9.0.0.0'
baweaver has quit [Remote host closed the connection]
fujimura has quit [Ping timeout: 240 seconds]
gamename has quit [Ping timeout: 255 seconds]
sankaber has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
gambl0re has joined #ruby-lang
wallerdev_ has joined #ruby-lang
<havenwood>
imperator2: TL;DR: Seems like a good idea. I'm not so sure about negating engines but haven't thought it through. A `required_ruby_engine_version` might help cover the bases.
sgambino has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
caseypat_ has joined #ruby-lang
Missphoenix has quit [Ping timeout: 256 seconds]
alestuber has quit [Remote host closed the connection]
wallerdev_ has quit [Ping timeout: 256 seconds]
caseypat_ has quit [Remote host closed the connection]
caseypatrickdris has quit [Ping timeout: 256 seconds]
caseypatrickdris has joined #ruby-lang
havenwood has quit [Ping timeout: 264 seconds]
centrx has quit [Quit: Shutting down, Please wait...]
centrx has joined #ruby-lang
hahuang65 has quit [Ping timeout: 250 seconds]
dzejrou has quit [Ping timeout: 252 seconds]
ur5us has joined #ruby-lang
tenderlove has quit [Quit: Leaving...]
<imperator>
perhaps that would be a better approach
alestuber has joined #ruby-lang
<imperator>
well, except that there's no RUBY_ENGINE_VERSION in MRI atm
<imperator>
musta been referring to dev
baweaver has joined #ruby-lang
baweaver has quit [Remote host closed the connection]
workmad3 has quit [Ping timeout: 246 seconds]
Voker57 has joined #ruby-lang
mfmfmfmfmfmf has quit [Remote host closed the connection]
skade has quit [Quit: Computer has gone to sleep.]
b_hoffman has quit [Quit: b_hoffman]
malconis has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
gianlucadv has quit [Ping timeout: 264 seconds]
kfpratt has joined #ruby-lang
malconis has joined #ruby-lang
revath has quit [Ping timeout: 246 seconds]
malconis has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
elia has quit [Quit: Computer has gone to sleep.]
bertocode has quit [Quit: Nettalk6 - www.ntalk.de]
imperator has quit [Quit: Leaving]
Fooster has quit [Ping timeout: 240 seconds]
joaomdmoura has quit [Remote host closed the connection]
maxasd111 has joined #ruby-lang
<maxasd111>
in rails, can i set the url fragment using render?
imperator2 has quit [Quit: Valete!]
benlovell has quit [Ping timeout: 246 seconds]
wallerdev_ has joined #ruby-lang
<apeiros>
maxasd111: you want #rubyonrails
bruno- has quit [Ping timeout: 265 seconds]
maxasd111 has quit [Client Quit]
_ht has quit [Quit: Konversation terminated!]
wallerdev_ has quit [Ping timeout: 252 seconds]
bantic has quit [Quit: bantic]
benlovell has joined #ruby-lang
<BanzaiJoe>
I have been banging my head for....
<BanzaiJoe>
1h50 minutes, and I'm just plain missing something
<womble>
BanzaiJoe: Aha, you've fallen victim to one of the classic blunders.
<BanzaiJoe>
well of course, i'm a n00b
<BanzaiJoe>
sock some edumacation on me
baweaver has joined #ruby-lang
<womble>
The first, is "never get involved in a land war in Asia"
<BanzaiJoe>
I think I've heard that somewhere ;)
<womble>
Good, just checking.
pragmatism has quit [Ping timeout: 246 seconds]
<BanzaiJoe>
am I going to have to battle rats of enormous size on my way to Ruby expertise?
pragmatism has joined #ruby-lang
<BanzaiJoe>
seriously, I don't get something or actually even worse, I think I'm not getting something
<womble>
So, you're calling `HelloWorld.hello`, which is trying to run a *class* method on the `HelloWorld` class. However, you've defined an *instance* method on `HelloWorld`, so you need to create an instance of `HelloWorld` and then call `hello` on that.
<womble>
Also, the `hello` method you've defined doesn't take an argument, so the test cases where you've passed an argument, you need to pass that argument to the instance constructor, rather than the call to `hello` itself.
<BanzaiJoe>
can the instance constructor (or any method for that matter) have multiple .... "behavior changes". The loop/problem I ran into is that I put the puts in the constructor and get no output
<womble>
Sure you can call puts in the constructor.
hahuang65 has joined #ruby-lang
<BanzaiJoe>
so... can I do a class method constructor and @name and puts in one def-end?
<womble>
Sure.
<womble>
Or you could make `hello` a class method, and then you don't have to have a constructor at all.
<BanzaiJoe>
and is that where the test is "leaning"?
<BanzaiJoe>
I tried that and got all sorts of relative errors that I didn't know what was trying to relate to what (or at least I think that's what happened)
<womble>
BanzaiJoe: Is that hello_world_test.rb entirely from exercism, is it? You're supposed to write code that will make that exact test pass?
<BanzaiJoe>
correct
<womble>
Yep, in that case, it's looking for a class method.
<womble>
It's also not looking for you to print the resulting string, but instead return it.
<BanzaiJoe>
OK, thanks, what piece of code says "looking for class method"
<BanzaiJoe>
oh, wait
postmodern has quit [Quit: Leaving]
<BanzaiJoe>
I think I got it
<BanzaiJoe>
an instance method would be like p = HelloWorld.hello, right?
<BanzaiJoe>
and straight up naked HelloWorld.hello is class method with no instance created?
<womble>
No.
<BanzaiJoe>
doh
duderonomy has quit [Ping timeout: 244 seconds]
<pipework>
BanzaiJoe: Nope. Have you gone through any ruby tutorials yet?
<womble>
You create a class method by defining the method as `def self.hello` rather thant `def hello`
<BanzaiJoe>
yes, many, and they just don't seem to nail this concept well
<pipework>
BanzaiJoe: The pickaxe book should cover what you're missing.
<pipework>
Another great book is the metaprogramming ruby book. The first half is all object model and it's fantastic. Then black book.
<BanzaiJoe>
womble I tried that, how do I get a return on that?
<BanzaiJoe>
axe, meta, black
<BanzaiJoe>
thanks, will take a look at those
<womble>
BanzaiJoe: Call 'return', or just make it the last value in the method (Ruby has what's called "implicit return semantics" -- everything returns something, even if you don't explicitly tell it to)
<BanzaiJoe>
will do, thanks for your help
mkosaki has joined #ruby-lang
<baweaver>
pipework: The Black book? Well Grounded Rubyist?
<pipework>
baweaver: yeah
<baweaver>
Just making sure there's not a literal black book I'd not seen yet
<BanzaiJoe>
woooohoooooo 4 runs, 2 assertions, ZERO failures, ZERO errors, and only 2+hours later, I feel VICTORIOUS!
<baweaver>
(Well, Black wrote it, but you get the point)
<BanzaiJoe>
I get by with a little help from my friends
<BanzaiJoe>
thank you for your help
<womble>
You're welcome.
micmus has quit [Ping timeout: 256 seconds]
shazaum has quit [Quit: Leaving]
<pipework>
It's historically called "The Black Book".
alestuber has quit [Ping timeout: 272 seconds]
arBmind1 has joined #ruby-lang
centrx has quit [Quit: Shutting down, Please wait...]
arBmind has quit [Ping timeout: 245 seconds]
<BanzaiJoe>
pipework which of those would you suggest is most n00b accessible?
bantic has joined #ruby-lang
rikkipitt has quit [Remote host closed the connection]
<pipework>
BanzaiJoe: Hm. Depends on what you're looking for. I'd always suggest meta, then black, then pickaxe.
whippythellama has quit [Quit: whippythellama]
k3asd` has quit [Ping timeout: 265 seconds]
ta has quit [Remote host closed the connection]
fujimura has joined #ruby-lang
alestuber has joined #ruby-lang
<BanzaiJoe>
thanks
fujimura has quit [Ping timeout: 276 seconds]
fry_ has joined #ruby-lang
<fry_>
hi all, someone can give me help with an initialize method ?
<jhass>
what's your issue?
<fry_>
i'm trying to define def initialize(inode, path) but compiler give me in `initialize': wrong number of arguments (1 for 0) (ArgumentError) on that line
caseypat_ has joined #ruby-lang
hinbody has quit [Ping timeout: 272 seconds]
<pipework>
fry_: We might need more of the source.
<fry_>
is it possible to define an inititialize method with 2 arguments ?
<fry_>
yes, wait a sec, pastebin
caseypat_ has quit [Remote host closed the connection]
<jhass>
fry_: include the full error with backtrace too