<zastern>
I make too many typos for irb to be that useful :)
<Spooner>
Its main benefit for you would be code highlighting (colour) and being able to easily look up documentation.
hsbt is now known as hsbt_away
<zastern>
ehh.
<zastern>
What I have found useful though, is the debugger, for working through errors
hsbt_away is now known as hsbt
Pip has joined #ruby
Serial_Killer_C has joined #ruby
<Spooner>
I never use it. Nothing wrong with old fashioned debugging with p (well, that and proper tests, o fcourse).
lggr has quit [Ping timeout: 245 seconds]
<waxjar>
there was this new debugging library called letters that was very interesting
<davidcelis>
Kernel#puts and pry are enough for me
<waxjar>
i like to use it to make the terminal beep :D
<zastern>
Thank god for the inventor of the visual terminal bell.
<zastern>
Whoever that was.
<Spooner>
waxjar : I like the idea of having #o so I can get output in the middle of a pipe.
lggr has joined #ruby
cobragoat has quit [Ping timeout: 272 seconds]
rakl has quit [Quit: sleeping]
<RubyPanther>
Well, before you worry about debugging tools, why are you debugging in the first place? Is it to find out what happens when you do something, or to find out what is happening in your code?
<RubyPanther>
If you're doing modern testing, you should use that to find out what is happening
`brendan has joined #ruby
tommyvyo has joined #ruby
<jrajav>
RubyPanther: You thinking testing is a substitute for debugging?
<RubyPanther>
No, I think testing tells people (who do it) what their code does.
rabidpraxis has joined #ruby
<waxjar>
i find i mostly use tests to verify that changes i made don't break stuff
<RubyPanther>
So they only should need a debugger when they don't know what something would do, to try things out
nateberkopec has quit [Quit: Leaving...]
hsbt has quit [Ping timeout: 260 seconds]
<Spooner>
And if it tells you that, that is great, but it doesn't help you fix it (beyond pointing you at a single or group of faulty methods).
<jrajav>
Call me crazy, but they can also be useful to, you know, DEBUG
hsbt_away has joined #ruby
<jrajav>
You can't test for a bug that you don't know the origin of
rabidpraxis has quit [Remote host closed the connection]
rakl has joined #ruby
emmanuelux has quit [Quit: emmanuelux]
lggr has quit [Ping timeout: 240 seconds]
<RubyPanther>
If your methods are small and you have good coverage, it is hard to have a bug and not be able to trace it through the tests, to isolate
rabidpraxis has joined #ruby
Monie has quit [Quit: Quit]
rabidpraxis has quit [Remote host closed the connection]
hsbt_away is now known as hsbt
<RubyPanther>
But print statement style debugging does the same thing, tells you where the bug is. So if you're using that, you also don't need the debugger for information about bugs. Just for experimenting.
samphippen has quit [Quit: Computer has gone to sleep.]
<RubyPanther>
So between people who do modern testing and people who print-debug, I figure that is most people.
cardoni has quit [Quit: cardoni]
lggr has joined #ruby
ryanf has quit [Quit: broken pipes |||]
freeayu has quit [Remote host closed the connection]
ryanf_ is now known as ryanf
rabidpraxis has joined #ruby
rabidpraxis has quit [Read error: Connection reset by peer]
rabidpraxis has joined #ruby
nyrb has joined #ruby
rakl has quit [Quit: sleeping]
lggr has quit [Ping timeout: 245 seconds]
Apocalypse has quit [Remote host closed the connection]
lggr has joined #ruby
dmiller has quit [Ping timeout: 244 seconds]
justinmcp has quit [Remote host closed the connection]
Serial_Killer_C has quit [Remote host closed the connection]
hsbt has quit [Ping timeout: 272 seconds]
rakl has joined #ruby
cakehero has quit [Quit: Computer has gone to sleep.]
wpaulson has joined #ruby
hsbt_away has joined #ruby
hsbt_away is now known as hsbt
lggr has quit [Ping timeout: 272 seconds]
Serial_Killer_C has joined #ruby
samuel02 has quit [Remote host closed the connection]
kiyoura has joined #ruby
hsbt has quit [Read error: Connection reset by peer]
mercwithamouth has quit [Ping timeout: 246 seconds]
nateberkopec has joined #ruby
<ddd>
being able to step through execution 1 line at a time and check vars and see what exact lines were called etc has been a great aid, in *addition* to writing tests to make sure A) i didn't break something i did earlier, and B) it does what I expect. They alert me when there's a problem, and the debugger helps me figure it out.
<ddd>
it *also* works as a great tool for testing things out and poking at things.
hotovson has quit [Remote host closed the connection]
<ddd>
being able to step through the stack and through exceptions and seeing what was looking like what at the time of the exception is also a great tool
hsbt has joined #ruby
<ddd>
being able to set breakpoints and execute up to them and then slowly step through the problem area has helped me in more than one occasion. (also helps me not have to clean up the damned p and puts afterwards hehe)
<shadewind>
what's the best way to get the filename component of a path without opening the file? using hte File class seems to require opening the file
lggr has quit [Ping timeout: 272 seconds]
<ddd>
File.basename(__FILE__) iirc
c0rn_ has joined #ruby
mercwithamouth has joined #ruby
<shadewind>
ddd: I'm so stupid... I should really have seen that the basename method is not an instance method :)
<zastern>
I feel like this would be a lot easier if I understood C and could read the source of the things I'm looking up :(
lggr has joined #ruby
JonnieCache has joined #ruby
Apocalypse has quit [Remote host closed the connection]
<shadewind>
ddd: right. Is there an instance method equivalent?
slainer68 has joined #ruby
<ddd>
not that I know of
shiki has joined #ruby
<zastern>
When the ruby docs talk about "ios", what exactly do they mean? Output?
williamcotton has quit [Quit: williamcotton]
<shadewind>
ddd: I'm a bit new to the docs... is :: for class methods and # for instance methods?
axl_ has quit [Quit: axl_]
<ddd>
no :: is a delimiter. like Module::Class#method .method is usually for instances
<ddd>
vs #method for methods on a class
Takehiro has quit [Ping timeout: 246 seconds]
williamcotton has joined #ruby
<ryanf>
the opposite of what ddd said
<ryanf>
you were right the first time shadewind
<ddd>
err?
<ryanf>
although sometimes people use . instead of ::
<ryanf>
ddd: "is :: for class methods and # for instance methods?
<ryanf>
"
<ryanf>
the answer to that question is "yes"
<ryanf>
. can be used instead of :: for class methods, but # is always for instance methods
<ddd>
That would mean it would be File::basename
<ryanf>
yes
rakl has quit [Quit: sleeping]
<ryanf>
personally I like the . notation better for class methods, but people do use :: for that
<Spaceghostc2c>
You can use . or :: for class methods.
<shadewind>
ryanf: sure, but the docs seem to list class methods with the :: prefix in the left column
<Spaceghostc2c>
::Module::class_method or ::Module.class_method
<ryanf>
yes, that's correct shadewind
elico has quit [Quit: Elico]
<Spaceghostc2c>
The leading :: isn't necessary.
reuf has joined #ruby
<ddd>
ok I stand correct.
<ddd>
err corrected
justinmcp has joined #ruby
<ddd>
my bad
<ddd>
(went to play with ri for a second. ri responds as you depict)
<shadewind>
anyway... a module is essentially a class which cannot be instantiated?
Trioke has joined #ruby
lggr has quit [Ping timeout: 276 seconds]
<ddd>
shadewind: my apologies :)
<shadewind>
I get that they are used for completely different things
<shadewind>
ddd: no problem, we all make mistakes :)
<Spooner>
shadewind : On a very basic level, yes, but a module is used either as a namespace or for extending classes as a sort of multiple inheritance.
<shadewind>
that is, a module is used as a namespace for a library et.c.
<ryanf>
yes
<ryanf>
class inherits from module
manizzle has quit [Ping timeout: 246 seconds]
<ryanf>
i.e., the Class class inherits from the Module class
<shadewind>
I see
<shadewind>
right
axl_ has joined #ruby
<shadewind>
which means that a non-instance method is technically the same as a class method in a class
Xeago has quit [Remote host closed the connection]
Apocalypse has joined #ruby
<zastern>
What's the difference between a method named like ::this or like #this ?
<Spooner>
Yes, technically.
A124 has quit [Quit: Leaving.]
<shadewind>
and to repeat, I understand that they are different things conceptually (which is clear from the names "module" and "class")
<Spooner>
We just discussed that. Foo::bar or Foo.bar refers to a class/module method, whcih is called on the module/class directly in either of those ways.
<Spooner>
However, Foo#bar is available on the instance e.g. foo = Foo.new; foo.bar
<zastern>
That doesn't mean much to me right now, but hopefully it will soon
<Spooner>
In the case of modules, Foo#bar would only be available if that module was included in a class that was instantiated.
DomKM_ has joined #ruby
DomKM_ has quit [Client Quit]
Serial_Killer_C has quit [Remote host closed the connection]
reuf has quit [Quit: Leaving]
lggr has quit [Ping timeout: 244 seconds]
<Spooner>
zastern : Yeah, the class/instance/module trinity takes a bit of a leap of faith, but soon becomes second nature.
rabidpraxis has quit [Remote host closed the connection]
<zastern>
Spooner: I think the issue is that LRTHW focuses on "doing things" and not understanding the semantics of what those things "actually are".
<shadewind>
# isn't a real operator, is it?
<Spooner>
Nope.
<shadewind>
just something used in the docs to signify instance methods?
<Spooner>
It is just documentation (meaning use . on an instance, rather than . or :: on a class/module).
<shadewind>
right
<Spooner>
zastern : exercise 40 does discuss these relationships.
<zastern>
Spooner: heh im only on 20 right now, and it's pretty damn confusing
mahmoudimus has joined #ruby
lggr has joined #ruby
<zastern>
e.g. I can't really wrap my head around seek. I sort of get what it does, but I don't quite understand "why"
<shadewind>
the syntax "def self.foobar(arg)" seems like a special case of defining a "singleton method" as described in Ruby User's Guide
<shadewind>
inside a class 'self' means the class object
<Spooner>
Yeah, we generally do: class << self; def foobar(arg)...end; def foochicken(arg)...end;end to do the same thing.
adeponte has quit [Remote host closed the connection]
emmanuelux has joined #ruby
<shadewind>
Spooner: hmm... could you elaborate on that?
<Spooner>
And yes, shadewind, the self there refers to the class itself, since it is inside its scope that it is being run (no instances exist at that point).
<Spooner>
shadewind : "class << self; def foobar(arg)...end; end" is the same as "def self.foobar(arg)...end;"
<shadewind>
Spooner: right
<shadewind>
what does the << operator do?
<Spooner>
It does what you want it to, but generally means add or append.
<shadewind>
by "what you want it to", you mean that it can be defined using def <<(blah) et.c.
<shadewind>
?
LucidDreamZzZz has joined #ruby
<Spooner>
What it actually does in this case is to allow you to access the class's metaclass within class << self ... end - any instance methods added to that class act like class methods on the main class. Advanced topic. Just accept it for now ;)
lggr has quit [Ping timeout: 246 seconds]
justinmcp has quit [Remote host closed the connection]
<shadewind>
Spooner: I see. saves me from typing self.blah
<Spooner>
Yes, << is just accessing a method.
<Spooner>
It also allows you to do a lot of other things directly on the metaclass, that you can't do otherwise.
<shadewind>
somehow, operator overloading in ruby doesn't make me want to throw up as much as operator overloading in C++ does
rakl has joined #ruby
<Spooner>
As I understand it, there is no such thing, per se, as a class method. It is really an instance method on that class's metaclass.
conor_ireland has quit [Quit: conor_ireland]
<shadewind>
Spooner: just like in Objective-C then
<Spooner>
I wouldn't know.
<shadewind>
sort of
<shadewind>
Spooner: but "class" in this context is some sort of special (or non-special?) variable then?
conor_ireland has joined #ruby
<Spooner>
shadewind : One thing you need to beware of, if you are used to C++ overloading, is that += is purely syntactic sugar. It isn't an operator (it just resolves as a = a + b).
lggr has joined #ruby
<shadewind>
Spooner: makes sens
<shadewind>
Spooner: so what I'd want to define in that case is +(rhs) and not +=(rhs)
<Spooner>
class is a keyword. I honestly don't know what magic is involved in mixing an operator with a keyword in "class << self", but someone might.
<shadewind>
:)
<Spooner>
Yes. This is also why we use string << "frog" and array << 2 rather than using +=, since the latter creates a new String/Array.
<Spooner>
Whereas in C++, you'd be able to append-in-place using +=
<shadewind>
in C++ you be able to do all sorts of crazy shit
axl_ has quit [Quit: axl_]
<Spooner>
Ruby is all about crazy shit too. Just not as painful crazy shit.
noyb has joined #ruby
<shadewind>
Spooner: not quite as ugly crazy shit
<Spooner>
Yeah, that too ;)
<shadewind>
and I'm not saying that because I find C++ too hard
<shadewind>
I regularly use C++ for production work
adeponte has joined #ruby
felipec has joined #ruby
<shadewind>
I just don't happen to find it very nice
<shadewind>
although useful
<felipec>
is there a shorter way to do this? array.group_by { |e| e[:id] }
<harushimo>
give me some time. I do have some questions on it
<harushimo>
i want to look it over.
mikepack has joined #ruby
tjbiddle has joined #ruby
<harushimo>
Spooner: thank you for helping me
lggr has quit [Ping timeout: 260 seconds]
tjbiddle has quit [Read error: Connection reset by peer]
<werdnativ>
Using capistano, I want to `tar` some files to a string and pass it to the put command for uploading. Is there a way to use IO.popen or StringIO, etc. to get this input in a streaming way?
<harushimo>
you've been correcting me along the way. I'm getting somewhat better ruby
<harushimo>
i'm not there yet
<Spooner>
I'd only be sleeping if I didn't and who wants that?
<harushimo>
i just took a nice long nap
tjbiddle has joined #ruby
adeponte has joined #ruby
<Trioke>
Spooner: Sleeeeep! A elusive creature. Almost... mythical ;).
ZenGuy311 has joined #ruby
lggr has joined #ruby
g-ram has joined #ruby
icole has quit [Remote host closed the connection]
icole has joined #ruby
shadewind has quit [Quit: Lost terminal]
kiyoura has quit [Quit: Leaving]
cyt93cs has joined #ruby
jenrzzz has joined #ruby
<Spooner>
harushimo : Not sure why they suggest using class_eval(string) when you can use class_eval do...end
<harushimo>
its becuase of the test case on the bottome
<harushimo>
I mean bottom
<Spooner>
No, I mean it is horrid to eval a string, when you can write the code in a block.
<harushimo>
this should return [nil, 1, 2]
<harushimo>
oh okay
icole has quit [Ping timeout: 252 seconds]
<harushimo>
when I try running it, this gives me some errors
joeycarmello has quit [Remote host closed the connection]
lggr has quit [Ping timeout: 265 seconds]
<Spooner>
Errors are part of the game.
slainer68 has joined #ruby
<harushimo>
I know
<harushimo>
that is why I'm debugging
<harushimo>
hehe
CaptainJet has joined #ruby
felipec has left #ruby ["Leaving"]
lggr has joined #ruby
jrajav has quit [Read error: Connection reset by peer]
jrajav has joined #ruby
Takehiro has joined #ruby
k4mirox has joined #ruby
jenrzzz has quit [Ping timeout: 256 seconds]
Hanmac1 has joined #ruby
jenrzzz has joined #ruby
JonnieCache has quit [Ping timeout: 240 seconds]
uris_ has joined #ruby
Takehiro has quit [Ping timeout: 246 seconds]
Hanmac has quit [Ping timeout: 260 seconds]
lggr has quit [Ping timeout: 276 seconds]
lggr has joined #ruby
adeponte has quit [Remote host closed the connection]
ruby has quit [Ping timeout: 276 seconds]
advorak has joined #ruby
raul782 has joined #ruby
c0rn_ has quit [Quit: Computer has gone to sleep.]
jenrzzz has quit [Ping timeout: 252 seconds]
jenrzzz has joined #ruby
lggr has quit [Ping timeout: 244 seconds]
mikepack has quit [Remote host closed the connection]
<Spooner>
harushimo : I really can't see how it is possible to do what is required *if you use the provided code*
<fbernier>
is there a way to check if a class is part of a module?
<fbernier>
even with multiple levels
<Spooner>
A specific module or to find out which module it is in?
<fbernier>
a specific
lggr has quit [Ping timeout: 255 seconds]
<ddd>
you could check .parent.class
<Spooner>
ddd, not superclass, but namespace.
joeycarmello has quit [Ping timeout: 246 seconds]
hoofman has joined #ruby
daniel_hinojosa has quit [Ping timeout: 252 seconds]
<ddd>
like I have module Dtf ; module Session ; class Environment so if I run Dtf::Session::Environment.parent.class it says module (which is its)
<fbernier>
I have an instance of Feedzirra::Parser::RSS, and I want to check if it's part of Feedzira
<Spooner>
fbernier : You have to play with the name string, which is painfully dumb, but it is the only way. E.g. klass.name.split("::").first == my_module.name
lggr has joined #ruby
<Spooner>
ddd No, that isn't what you are getting. Dtf::Session::Environment.parent is Class and its class is module (Class is a subclass of Module). Nothing to do with Dtf or Session.
<fbernier>
ok so something like this: instance.class.name.split('::').include? 'Feedzirra'
<Spooner>
fbernier : Not strictly, since that would match Fish::Feedzirra::Wombat too. In this case you can get away with it though.
<fbernier>
yeah ..
<ddd>
add class to that and it comes back Module
c0rn_ has joined #ruby
<Spooner>
ddd No, that is following inheritance, not namespacing.
<Spooner>
Actually no, #parent isn't Ruby, it is just a method that object happens to provide ;) You are confusing me.
<ddd>
Spooner: OK, didn't realize it was namespace he wanted. He said (or I took it to mean) something like @my_feed = Feedzirra::Parser::RSS and he wanted to find out if it was part of Feedzirra. which @my_feed.class.parent.to_s('Feedzirra') would do
<ddd>
so I thought he wanted to check the inheritence path. my bad
lggr has quit [Ping timeout: 260 seconds]
<Spooner>
ddd There is no #parent in Ruby. You are thinking of superclass.
<ddd>
Spooner: err then how am I calling it?
<Spooner>
Because you aren't using vanilla Ruby?
<ddd>
how am I not? Ruby 1.9.3-p286
<ddd>
ruby 1.9.3p286 (2012-10-12 revision 37165)
lggr has joined #ruby
<Spooner>
With no gems loaded?
<ddd>
yes I have gems loaded.
<ddd>
so does he :)
<ddd>
ok so how do I track down *which* gem is giving me that method
<Spooner>
So it isn't vanilla Ruby ;) Class.superclass does it normally. I am guessing someone else gavbe you #parent.
<Spooner>
If you have pry, you could use show-source Class.parent and that should tell you which file it is in.
manizzle has joined #ruby
<ddd>
yeah i use pry. sec
<Spooner>
I'm curious where it is. Having #parent as an alias for #superclass seems unnecessary and sounds like Rails evil ;D
<ddd>
active_support
<Spooner>
Aha! Close enough :D
<ddd>
ctivesupport-3.2.8/lib/active_support/core_ext/module/introspection.rb @ line 7 for parent_name ctivesupport-3.2.8/lib/active_support/core_ext/module/introspection.rb @ line 30 for parent
lggr has quit [Ping timeout: 245 seconds]
<ddd>
Spooner: thank you for setting me straight.
<Spooner>
You had me doubting for a minute there!
<ddd>
i thought you were nuts actually ;)
<ddd>
but I'm a big enough boy to take being wrong. you schooled me, for which I'm happy
jeffreybaird has joined #ruby
ericmathison has joined #ruby
<Spooner>
I suspect it is quite hard to separate vanilla from activesupport, if you use Rails a lot.
freeayu has joined #ruby
<ddd>
not using rails. using activerecord with some of the support modules. (yes you can use AR with non rails apps :))
<Spooner>
I know, I have, but 99% of AR is Rails.
<ddd>
this is a PORA I'm writing
<Spooner>
*99% of AR usage is Rails.
<ddd>
yeah, i'd argue the statistics but damned close enough it'd be nitpicking :)
<Spooner>
PORA?
<ddd>
Plain Old Ruby Application
<ddd>
family to PORO Plain Old Ruby Object
lggr has joined #ruby
<ddd>
of course, people could argue there is no such thing as a ruby 'application' as its a scripting language, however, thats splitting hairs methinks
noyb has quit [Ping timeout: 272 seconds]
<Spooner>
I have no problem with application.
raul782 has quit [Remote host closed the connection]
g-ram_ has joined #ruby
<RubyPanther>
it is splitting fake hairs
<ddd>
i did get into ruby because of rails (rails was becoming big and i'd heard of ruby but never used it, rails seemed 'special' so i checked it out. took me *directly* to writing straight ruby though using some of the paradigms from rails-land like app/models etc.
slainer68 has quit [Remote host closed the connection]
<ddd>
now i'm coding ruby gems, and yes, rails's apps/models has infiltrated there too for me :) i have to write a special line but i do like that layout, personally.
wpaulson has joined #ruby
<RubyPanther>
even if that was a real distinction, okay in C then... #include "ruby/ruby.h" \n ruby_init(); \n rb_load_file("application.rb")
lggr has quit [Ping timeout: 245 seconds]
<RubyPanther>
You can code in C and treat the Ruby interpreter as your stdlib, at the extreme
<Spaceghostc2c>
RubyPanther: Is that even close to the right syntax? :D
<Spooner>
You could also argue that Ruby is the application and you are thus not creating the application.
<RubyPanther>
My syntax was capable of strict parsing, I do believe.
<Spaceghostc2c>
RubyPanther: I mean, does it do what I'd expect?
lggr has joined #ruby
<RubyPanther>
Spaceghostc2c: Sure. And instead of rb_load_file you can use rb_require, though if you want something from rubygems you'll have to resort to rb_funcall(rb_cObject, rb_intern("require"), 1, rb_str_new2("bundler") );
<RubyPanther>
What we need is an mRuby thin client.
jarred has joined #ruby
<Spaceghostc2c>
RubyPanther: I guess one cool thing about the jvm is the number of opcodes is so small.
<RubyPanther>
RiteVM is small enough you can easily just sit down and write bytecode like it was ASM.
AndChat- has joined #ruby
<Spaceghostc2c>
That's a ruby vm?
lggr has quit [Ping timeout: 252 seconds]
<RubyPanther>
Yeah, that's the VM for mRuby.
davidcelis has quit [Ping timeout: 246 seconds]
<Spaceghostc2c>
Oh!
<Spaceghostc2c>
RubyPanther: Do you use rvm or something else?
<RubyPanther>
Originally it was Matz's lightweight replacement for 1.8, but YARV is more advanced and was a better choice for the mail interpreter so Rite got pushed down to embedded support
<RubyPanther>
Spaceghostc2c: I'm using rbenv and loving it
raul782 has joined #ruby
<RubyPanther>
"main interpreter"
<Spaceghostc2c>
I've got to work on a quick little server to serve up directory indexes really quickly.
<Spaceghostc2c>
Some prat is writing one in asm.
lggr has joined #ruby
tomoyuki28jp has joined #ruby
mjording has joined #ruby
axl_ has joined #ruby
<tomoyuki28jp>
How can I install 'net/http'? Is it better to use open-uri instead?
<waxjar>
net/http is part of the standard library, you can just require it
thehustle has quit [Remote host closed the connection]
emdub has joined #ruby
emdub has quit [Client Quit]
emdub has joined #ruby
g-ram_ is now known as g-ram
icole has quit [Remote host closed the connection]
lggr has quit [Ping timeout: 255 seconds]
eindoofus has joined #ruby
jenrzzz has quit [Ping timeout: 252 seconds]
lggr has joined #ruby
<eindoofus>
hi, I'm going through a ruby book and using windows at the moment and I forgot what command to launch to use simple ruby commands in the ruby command prompt lie "a=1" "a=2" "a+b"
<eindoofus>
btw, it's strangly quiet in here... is it because it's Saturday?
_cheney has quit [Ping timeout: 245 seconds]
<Spooner>
eindoofus : Depends if people are asking questions. Just a momentary lull.
<Spooner>
And the command is "irb"
<eindoofus>
I see.
<eindoofus>
thanks :)
ryanlecompte has joined #ruby
<eindoofus>
also, is there a way to wait at the end of a ruby program so that the console window doesn't close?
wpaulson has joined #ruby
<Spooner>
eindoofus : Yeah, run it from a cmd window. Don't run it by clicking on the file.
<Spooner>
Though if you must, you could use "gets" to force the user to press return.
kyletcarey has quit [Quit: leaving]
kyletcarey has joined #ruby
<eindoofus>
thanks
raul782 has quit [Remote host closed the connection]
<Spooner>
Er, do...end for multi-line blocks and {...} for single-line blocks (so you don't have to worry about { on newline or not).
<eindoofus>
oh
<eindoofus>
I forgot about do, end. I'm brand spanking new to this. lol
<Spooner>
Just read a bit of code.
Pip has left #ruby ["离开"]
icole has joined #ruby
lggr has quit [Ping timeout: 246 seconds]
jenrzzz has quit [Ping timeout: 248 seconds]
lggr has joined #ruby
hsbt is now known as hsbt_away
hsbt_away is now known as hsbt
ddd has quit [Quit: Leaving.]
slainer68 has joined #ruby
iamjarvo has joined #ruby
Takehiro has joined #ruby
lggr has quit [Ping timeout: 244 seconds]
slainer68 has quit [Ping timeout: 252 seconds]
lggr has joined #ruby
Takehiro has quit [Ping timeout: 260 seconds]
havenn has joined #ruby
Nautilus has joined #ruby
<Nautilus>
I'm on ubuntu 12.04 and want to setup a sass/compass dev env, in synaptic I see libcompass-ruby and libcompass-ruby1.8 ... why two? How to decide what to do?
jeffreybaird has quit [Quit: jeffreybaird]
JonnieCache has joined #ruby
hbpoison has quit [Ping timeout: 255 seconds]
pridian has joined #ruby
n_blownapart has joined #ruby
hbpoison has joined #ruby
lggr has quit [Ping timeout: 246 seconds]
eindoofus has quit [Ping timeout: 246 seconds]
havenn has quit [Remote host closed the connection]
pridian has quit [Client Quit]
eindoofus has joined #ruby
emergion has joined #ruby
lggr has joined #ruby
<Spooner>
Nautilus : At a guess, the 1.8 version is to support the old version and the other is the currently developed version (for 1.9).
<Spooner>
Depends which Ruby you are using.
<Spooner>
Which you want, that is.
<n_blownapart>
hi how and where (on which line) is the array created in the first of these two examples? the second example apparently does not create an array. thanks you: http://pastie.org/5055432
snorkdude has joined #ruby
<Spooner>
n_blownapart : The only arrays there are fields.
<Nautilus>
Spooner: and if I install the 1.8 I'm guessing it won't auto-upgrade, while the other one would?
<Spooner>
There are compatibility issues between the two Ruby versions, so I'd guess not.
<Nautilus>
oh, I see. So I'm back to How to decide what to do?
<Spooner>
As I say, it depends which Ruby you are using.
<n_blownapart>
Spooner: I tried puts fields.class and got an error. sorry not sure why or how i can check in a case like this.
<Nautilus>
far as I know, none
<Spooner>
Oh, use 1.9.3 then ;)
raul782 has joined #ruby
<Nautilus>
and that should be fine for U12.04, sass/compass dev env? I suspect so but get twitchy when installing things I dont understand yet
<Spooner>
n_blownapart : Both examples are actually the same. Only the latter one is a bit more wordy.
<swarley>
hi
<Nautilus>
Spooner: ^
<n_blownapart>
Spooner: hmm. the books says " no intermediate array is created on the second example. The File object 'does its own work.' "
<Spooner>
Nautilus : Yeah, 1.9.3 is fine. 1.8.7 is probably the one you get if you just install "ruby" but is nearing end of life ;)
mjording_ has joined #ruby
lggr has quit [Ping timeout: 240 seconds]
mjording has quit [Read error: Connection reset by peer]
mjording_ is now known as mjording
<Nautilus>
Spooner: hm, i don't have a specific "1.9.3" option, it's libcompass-ruby and libcompass-ruby1.
<Spooner>
n_blownapart : Hmm, I suppose then that readlines() generates an array. Yeah.
<Nautilus>
1.8*
<Spooner>
Nautilus : Oh, I see. I hadn't thought that it _included_ ruby. Sorry.
emergion has quit [Quit: Computer has gone to sleep.]
<n_blownapart>
Spooner: thanks ! but in this case there is no way to view it with #class . Is intermediate another way to say 'implicit'.?
<Nautilus>
head+desk. all this for a text processor
<Nautilus>
(no fault of ruby, just... head+desk)
<Spooner>
Most people work the other way around. They install stuff for Ruby, not Ruby as part of stuff. Sorry, I was confused.
daniel_hinojosa has joined #ruby
<Nautilus>
gotcha. Yea, just trying to setup a sass/compass environment
miso1337 has joined #ruby
lggr has joined #ruby
<Nautilus>
so i should probably do it the other way around and that means I probably have even more Q's
<Spooner>
Well, I'd recommend installing the ruby1.9.1 package (it says that, but probably means 1.9.3 for arcane reasons).
hbpoison has quit [Ping timeout: 276 seconds]
<n_blownapart>
anyone, is 'intermediate' and 'implicit' array synonymous? Spooner
<Spooner>
n_blownapart : Yes, it is generating an array, which I would say was intermediate, rather than implicit.
<Spooner>
n_blownapart : You can "prove" it with File.readlines("members.txt").tap{|a| p a.class }.inject(0)
<Spooner>
Or just doing: p File.readlines("members.txt").class
<n_blownapart>
Spooner: whoa that is a mouthfull. will check it out. thanks !
thmzlt has joined #ruby
<Spooner>
Nautilus : No idea. The more usual way to install Ruby on Linux is via RVM or rbenv rather than via package manager, though you only really need to do it that way if you want multiple versions at once, which I doubt you do.
lggr has quit [Ping timeout: 245 seconds]
<Nautilus>
correct, just one version. I'm using synaptic just because I find it easier to search for packages, then usually install with apt-get
joeycarmello has joined #ruby
<Nautilus>
i see 1.9.1-full, 1.8, 1.9.3, but only 1.8 has the ubuntu logo next to it (maybe that means its in the default repo)
<thmzlt>
Nautilus: is that 12.04?
<Nautilus>
yes
sambio has quit []
<thmzlt>
there's ruby 1.9.3 in there
<Nautilus>
^
<thmzlt>
that's probably what you're looking for
<Nautilus>
any idea why some packages have the U logo next to it?
<thmzlt>
not really, I use ubuntu server edition
<Spooner>
thmzlt Yeah, but not sure if compass wants that (when used as a package).
<Nautilus>
gotcha
lggr has joined #ruby
mahmoudimus has joined #ruby
<thmzlt>
Spooner: sorry, I got the conversation in the middle
<Spooner>
But I'm really beyond my experience. I'd just install libcompass-ruby and see what it installed for me.
joeycarmello has quit [Ping timeout: 252 seconds]
<Nautilus>
parsing 'what it installed' is beyond my experience too.
harushimo has quit [Quit: Leaving]
<Spooner>
Good point. Specifically which Ruby version is what I meant.
<thmzlt>
if you aren't using ruby directly, I'd say just go with whatever apt does
sent-hil has joined #ruby
<Nautilus>
is it something I can undo reasonably easy?
raul782 has quit [Remote host closed the connection]
<Spooner>
You can just right-click in synaptic and "mark for complete removal".
<Nautilus>
ok, how's this look for syntax? "sudo apt-get install libcompass-ruby" ... thanks for hanging in while I'm pedantic about this
<Spooner>
Anyway, good luck ;) I'm to bed. And yeah, that looks right to me.
<Nautilus>
thanks a bunch
Spooner has quit []
miso1337_ has joined #ruby
lggr has quit [Ping timeout: 252 seconds]
AndChat- has quit [Ping timeout: 240 seconds]
sent-hil has quit [Remote host closed the connection]
synthetix has joined #ruby
<synthetix>
hey guys
<synthetix>
when i type :! irb -r % in vim
<synthetix>
i've got following message
<synthetix>
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require':LoadError: cannot load such file
<synthetix>
i understood smth with a path
<synthetix>
where do i need to change it ?
miso1337 has quit [Ping timeout: 245 seconds]
miso1337_ is now known as miso1337
Guest91117 is now known as sent-hil
iamjarvo has quit [Ping timeout: 245 seconds]
Forevernade has joined #ruby
sent-hil is now known as Guest64210
lggr has joined #ruby
tspike has quit [Quit: leaving]
mikepack has joined #ruby
mercwithamouth has quit [Ping timeout: 244 seconds]
Synthead has quit [Remote host closed the connection]
JonnieCache has quit [Ping timeout: 246 seconds]
c0rn_ has quit [Quit: Computer has gone to sleep.]
<Nautilus>
now that I have libcompass-ruby installed, I typed "compass" and didn't expect it to do much without additional command info, what I get is ... `select_appropriate_command_line_ui': uninitialized constant Compass::Exec::Helpers::Haml (NameError) what's that mean to me?
<Nautilus>
though I suppose that's for the compass channel
eindoofus has quit []
kyletcarey has quit [Quit: leaving]
lggr has quit [Ping timeout: 248 seconds]
n_blownapart has quit [Remote host closed the connection]
havenn has joined #ruby
havenn has quit [Remote host closed the connection]
lggr has joined #ruby
k4mirox has quit []
emergion has joined #ruby
miso1337 has quit [Quit: afk]
hsbt is now known as hsbt_away
lggr has quit [Ping timeout: 245 seconds]
hsbt_away is now known as hsbt
moshee has quit [Ping timeout: 260 seconds]
moshee has joined #ruby
moshee has quit [Changing host]
moshee has joined #ruby
Takehiro has joined #ruby
lggr has joined #ruby
bigmeow has quit [Read error: Connection reset by peer]
Takehiro has quit [Ping timeout: 260 seconds]
<Nautilus>
thanks for the help, got a good bit done. nites
Nautilus has left #ruby ["Client Exiting"]
lggr has quit [Ping timeout: 246 seconds]
Bosma has quit [Ping timeout: 246 seconds]
thmzlt has quit [Remote host closed the connection]
hemanth has quit [Read error: Connection reset by peer]
hemanth has joined #ruby
lggr has joined #ruby
Nanuq has quit [Quit: leaving]
tommyvyo has quit [Quit: Computer has gone to sleep.]
pac1 has quit [Ping timeout: 246 seconds]
thmzlt has joined #ruby
Nanuq has joined #ruby
lewis has joined #ruby
hbpoison has joined #ruby
_kW has joined #ruby
_kW is now known as Guest35230
emergion has quit [Quit: Computer has gone to sleep.]
pac1 has joined #ruby
havenn has joined #ruby
lggr has quit [Ping timeout: 240 seconds]
kaawee has quit [Ping timeout: 260 seconds]
tommyvyo has joined #ruby
lggr has joined #ruby
havenn has quit [Remote host closed the connection]
tk__ has joined #ruby
tommyvyo has quit [Client Quit]
tommyvyo has joined #ruby
bradhe has quit [Remote host closed the connection]
freeayu has quit [Read error: Connection reset by peer]
adeponte has joined #ruby
eindoofus has joined #ruby
AlecTaylor has joined #ruby
<AlecTaylor>
hi
<eindoofus>
Hi, I just followed along with the following code in my book: http://pastie.org/5055603 and I' wondering whether it's supposed to work for 1.9.3? I'm not getting the output => "catdog"
AlecTaylor is now known as AlecTaylor
<AlecTaylor>
What's wrong with my function? `def palindrome?(str) return str==str.reverse end`
lggr has quit [Ping timeout: 255 seconds]
tchebb has quit [Quit: Leaving.]
tchebb has joined #ruby
adeponte has quit [Ping timeout: 255 seconds]
Takehiro has joined #ruby
Mon_Ouie has quit [Remote host closed the connection]
Apocalypse has quit [Remote host closed the connection]
lggr has joined #ruby
Mon_Ouie has joined #ruby
swarley has quit [Ping timeout: 260 seconds]
<RubyPanther>
AlecTaylor: maybe you need a newline or a ; after the the method declaration
thmzlt has quit [Remote host closed the connection]
quazimodo has quit [Remote host closed the connection]
shadoi has quit [Quit: Leaving.]
Axsuul has joined #ruby
bbttxu__ has joined #ruby
xorgnak has joined #ruby
shadoi has joined #ruby
adeponte has joined #ruby
bradhe has quit [Ping timeout: 255 seconds]
mikepack has joined #ruby
icole has quit [Remote host closed the connection]
yaymukund has quit [Ping timeout: 260 seconds]
shadoi has quit [Ping timeout: 246 seconds]
lggr has quit [Ping timeout: 252 seconds]
Cache_Money has quit [Ping timeout: 256 seconds]
cakehero has joined #ruby
lggr has joined #ruby
rippa has joined #ruby
conor_ireland has quit [Quit: conor_ireland]
Takehiro has quit [Remote host closed the connection]
cakehero has quit [Quit: Computer has gone to sleep.]
Banistergalaxy has joined #ruby
Takehiro has joined #ruby
araujo has joined #ruby
araujo has joined #ruby
araujo has quit [Changing host]
lggr has quit [Ping timeout: 245 seconds]
JonnieCache has joined #ruby
lggr has joined #ruby
mjording has quit [Quit: mjording]
levifig has quit [Quit: WeeChat 0.3.9]
nemesit|osx has joined #ruby
JonnieCache has quit [Read error: Operation timed out]
sandGorgon has quit [Read error: Connection reset by peer]
vedic has joined #ruby
<vedic>
Probably I am asking a very simple question to Project Managers/Developers/Admins. I am looking for opinion on "Where do you prefer setting up version control repository for your project source code?" At your own premise or at hosting provider or colocate your server at hosting provider?
nemesit has quit [Ping timeout: 260 seconds]
sandGorgon has joined #ruby
<Spaceghostc2c>
vedic: Git doesn't need a central server.
<vedic>
Spaceghost2c: My question is not able version control per say. I am asking about the what practice you follow. Hosting the version control at any one server in premise or at hosting provider (like VPS) or colocate your own server at hosting provider? Lets say there 10 members in a project and alll need access to repository to push their part and pull from what others have done. So at least the one location must get all the pushes to get propogated to all other
<Ivo>
Spaceghostc2c: but practically every project has some sort of canonical repo, which is a symbolic central server though
FifthWall has quit [Quit: Zzzzzzzzzzzzz]
<Spaceghostc2c>
Ivo: I can't speak for other people's bad decisions. You can use the gatekeeper repo or the golden repo, but you don't need it.
<Ivo>
vedic: both github and bitbucket provide excellent private services, and they *need* to stay up, or a shitstorm will occur
<Spaceghostc2c>
vedic: There are many models that allow for that.
<vedic>
Spaceghostc2c: And with bug tracking
lggr has joined #ruby
<Spaceghostc2c>
But lots of people tend to treat git like a typical VCS and it makes me sad.
<Spaceghostc2c>
vedic: What does that have to do with it?
<vedic>
Ivo: I got it. So it is considered normal to share the critical code at bitbucket
<Ivo>
vedic: you pay for a private account, which means you don't have to share it with everyone
<Ivo>
gitorious is the other big one
<Spaceghostc2c>
Isn't there some gitlab thingy?
<Ivo>
yeah, but who's server is better tested? github, or gitlab?
<Spaceghostc2c>
It shouldn't fucking matter. :)
<Ivo>
Spaceghostc2c: shouldn't, but does. People want reliability
<Spaceghostc2c>
Ivo: Git, bruv.
<Spaceghostc2c>
Git.
<Ivo>
I don
<Ivo>
I don't follow
<Spaceghostc2c>
Most people don't.
coderhut has quit [Ping timeout: 245 seconds]
jenrzzz has quit [Ping timeout: 245 seconds]
mikepack has quit [Remote host closed the connection]
<Spaceghostc2c>
It is insanely hilarious when people say "I can't work, github is down"
<Ivo>
well that's just stupid
<Spaceghostc2c>
Like, I literally explode with laughter.
<Spaceghostc2c>
It gets awkward after I finish laughing.
<Ivo>
those people literally don't understand dcvs
tommyvyo has joined #ruby
<Ivo>
it's perfectly fine to use git in a cvs model, and is only enhanced by the fact that you can fall back to a dcvs model if your central server goes down
<Spaceghostc2c>
I guess.
<Spaceghostc2c>
But I suppose it's more acceptable to me when you know git properly.
<Ivo>
I don't think I'm learning ruby properly...
<Ivo>
oh well
<Spaceghostc2c>
It's okay!
AndChat| has joined #ruby
<Ivo>
that's reassuring, Spaceghostc2c. Thanks
answer_42 has quit [Ping timeout: 276 seconds]
lggr has quit [Ping timeout: 272 seconds]
AndChat- has joined #ruby
icole has joined #ruby
take_cheeze has quit [Remote host closed the connection]
lggr has joined #ruby
take_cheeze has joined #ruby
vlad_starkov has joined #ruby
Banistergalaxy has quit [Ping timeout: 240 seconds]
rabidpraxis has quit [Remote host closed the connection]
AndChat| has quit [Ping timeout: 246 seconds]
vlad_sta_ has joined #ruby
roadt has quit [Ping timeout: 245 seconds]
thone has joined #ruby
thone_ has quit [Read error: Operation timed out]
vedic has left #ruby [#ruby]
Apocalypse has quit [Remote host closed the connection]
vlad_starkov has quit [Ping timeout: 240 seconds]
cakehero has joined #ruby
lggr has quit [Ping timeout: 276 seconds]
synthetix has quit [Ping timeout: 255 seconds]
wallerdev has quit [Quit: wallerdev]
lggr has joined #ruby
<profx_>
im getting stuck lots learning Ruby as well
<profx_>
it isn't for everyone, thats for sure
charliesome has joined #ruby
locriani has joined #ruby
PragCypher has joined #ruby
lggr has quit [Ping timeout: 255 seconds]
akem has quit [Ping timeout: 256 seconds]
akemEikko has joined #ruby
<profx_>
what is class_eval ?
cakehero has quit [Quit: Computer has gone to sleep.]
jenrzzz has joined #ruby
lggr has joined #ruby
freeayu has joined #ruby
quest88 has quit [Quit: quest88]
yaymukund has joined #ruby
<Mon_Ouie>
A method that runs a block in a context where self is the class you call it on, and where methods that are defined within that block will be added as instance methods to the class
lggr has quit [Ping timeout: 245 seconds]
<Mon_Ouie>
(It can also be used to evaluate strings, but it's more common to use blocks with that one, mostly because string-based evals are avoided like the plague)
arturaz has joined #ruby
lggr has joined #ruby
<profx_>
i really wish I knew what every word of that meant
coderhut has joined #ruby
<Spaceghostc2c>
profx_: It's mostly technobabble.
<profx_>
what does 'where self is the class you call it on' mean ?
<profx_>
Spaceghostc2c: that still doesn't help
<Mon_Ouie>
Foo.class_eval { self } == Foo
<profx_>
what is foo ?
<Mon_Ouie>
Foo.class_eval { def bar; end }; Foo.method_defined? :bar
<Mon_Ouie>
A class
<profx_>
ok, so to understand class_eval you need just one class ?
<Mon_Ouie>
Well, you need a class to be able to use it (or a module, since it actually works on modules too despite the name)
<profx_>
lets not talk modules
<profx_>
it is difficult enough to understand on its own
imami|afk is now known as banseljaj
<profx_>
so you need more than one class to understand it ?
<Mon_Ouie>
I'm not sure what you mean by that
<profx_>
sorry, at this point I have a really hard time 'reading' between the lines
shiki has quit [Remote host closed the connection]
<Mon_Ouie>
What could be "needed" to understand it?
JohnBat26 has joined #ruby
<profx_>
ok, sure
JohnBat26 has quit [Client Quit]
JohnBat26 has joined #ruby
<profx_>
so, you gave an example, in layman's terms, using that single example can you explain what it is doing ?
fixl has joined #ruby
<profx_>
well, it seems you wrote two examples
<Mon_Ouie>
They just show two of the things that hold true when you use class_eval with a block
lggr has quit [Ping timeout: 265 seconds]
<profx_>
so I guess its hard to determine which of the two I am discussing, so ill choose the simpler one "Foo.class_eval { self } == Foo"
<Mon_Ouie>
self is the receiver of the #class_eval method (the thing you call it on), and methods are defined on that object
<profx_>
sorry, that just looks like blah, blah, blah to me
<profx_>
over my head
<profx_>
are you explaining class_eval or self ?
<Mon_Ouie>
class_eval. I assumed you knew what self was.
<profx_>
well, it starts with "self is"
<profx_>
so I wasn't sure
<Mon_Ouie>
self is the current object. When you do "some_method" (as opposed to an_object.some_method), it is called on self
<profx_>
and again
<Mon_Ouie>
"self is" as in "Within the block, self is set to"
lggr has joined #ruby
<profx_>
so your still explaining self to me then ?
<profx_>
i see we aren't getting far
<Mon_Ouie>
Only in the line that says it's the current object
<profx_>
ill try later, thanks
negev_ has joined #ruby
negev_ has quit [Client Quit]
negev has joined #ruby
<negev>
how do you set an object property based on a variable, eg obj.{key} = "foo" ?
Takehiro has quit [Remote host closed the connection]
PragCypher has quit [Read error: Connection reset by peer]
<profx_>
how can I find if a method was released in a certain version of ruby ?
<Mon_Ouie>
obj.send("#{key}=", "foo")
PragCypher has joined #ruby
slainer68 has joined #ruby
<negev>
thanks
<Mon_Ouie>
profx_: I think the closest thing to that is scanning the log files in the SVN repo for the method's name — it's not indicated in the documentation
<profx_>
lol
<profx_>
ok, thanks
<Mon_Ouie>
(If you want to check that for #cass_eval, it's going to be a *long* time ago :p)
<profx_>
sure
qubit has joined #ruby
hamed_r has joined #ruby
lggr has quit [Ping timeout: 240 seconds]
icooba has joined #ruby
eldar has joined #ruby
slainer68 has quit [Ping timeout: 260 seconds]
<qubit>
does ruby have a way to assign to multiple elements of a hash in one operation? Like in perl I can do `@hash{'foo','bar'} = (1,2)` and %hash will be { foo => 1, bar => 2 }
<Mon_Ouie>
No. You could zip over the keys and the values (as arrays) and do each update separately though.
<Mon_Ouie>
Well, we do have Hash#merge though, depending on what you're looking for.
<Mon_Ouie>
a_hash.merge("foo" => 1, "bar" => 2)
<profx_>
i get undefined method in 1.8 and 1.9 for yeild
<Mon_Ouie>
It's spelt "yield"
lggr has joined #ruby
<profx_>
sure, my mistake
<Mon_Ouie>
And most of the time it's used as a keyword, not a method
jenrzzz has quit [Ping timeout: 256 seconds]
<profx_>
each { |y| yield [x, y] }
<profx_>
in `each': undefined method `yeild'
xorgnak has quit [Ping timeout: 245 seconds]
<Mon_Ouie>
You did misspel it according to that error
bairui has quit [Quit: WeeChat 0.3.7]
<profx_>
saw that after I posted it
<Mon_Ouie>
misspell*, quite ironically :p
<qubit>
Mon_Ouie: ya, merge wont do it unfortunately. I'll just iterate over each :-(
<qubit>
thanks for the info though :-)
negev has left #ruby [#ruby]
bluOxigen has joined #ruby
melzz has quit [Remote host closed the connection]
<profx_>
i want to replace in array2, the index of array with array[value]
melzz has joined #ruby
vlad_sta_ has quit [Remote host closed the connection]
<profx_>
but im not sure how to iterate over array2
<profx_>
as its an array of arrays
lggr has quit [Ping timeout: 246 seconds]
daniel_-_ has joined #ruby
<Mon_Ouie>
It's nothing special. As far as Ruby is concerned, an Array is a regular object too. You can still just use #each.
<profx_>
but I want to keep the structure of array2
<Mon_Ouie>
Oh, maybe you want to iterate recursively?
<profx_>
ugh
<Mon_Ouie>
If you know there will always be two levels of nesting, just nest two loops
<profx_>
that word gives me shivers down my spine
<profx_>
yes, nesting would be preferred
<profx_>
i just wasnt sure if that was elegant enough
lggr has joined #ruby
vlad_starkov has joined #ruby
<Spaceghostc2c>
profx_: Your words excite me in a most innapropriate way.
<profx_>
Spaceghostc2c: im not sure how I feel about that statement
<Spaceghostc2c>
Me neither.
<profx_>
im hoping you are not a trucker, 45, and living in your moms basement
<profx_>
if you were, I may never return to this channel
<Spaceghostc2c>
I wish things were going that well for me.
vlad_sta_ has joined #ruby
und3f has joined #ruby
freeayu has quit [Ping timeout: 246 seconds]
<profx_>
array.each do |index_array| ?
<Spaceghostc2c>
profx_: What do you need exactly?
<profx_>
that would give me each array within array in index_array, which I can then to index_array.each
<profx_>
im doing the anaagrams question
lggr has quit [Ping timeout: 245 seconds]
vlad_sta_ has quit [Remote host closed the connection]
<profx_>
i have two arrays, atm. one contains all the strings I am testing for anagrams in, the other is an array of indexes to that array, for all words that are anagrams
swarley has quit [Read error: Operation timed out]
<profx_>
and s.each_char.sort will do a sort on each word in the array
<Hanmac>
|s| is a block parameter ... like the i in an for loop
<nemesit|osx>
hm how can i execute sudo commands with ruby?
emergion has quit [Quit: Computer has gone to sleep.]
<profx_>
block parameter as in a method parameter ?
<profx_>
similar to in java ?
jerius has joined #ruby
roadt has joined #ruby
<Mon_Ouie>
Java has a (oh so verbose) syntax for defining anonynmous classes within methods. That's the closest thing they have to blocks (a.k.a closures).
<Hanmac>
information: with newer ruby, rubygems is bounded with ruby, so it cant be removed without breaking ruby
lggr has joined #ruby
<shevy>
hehe bounded
<shevy>
why not bonded :D
<romankrv>
that is; i must remove ruby that to remove gem?
<shevy>
ruby bondage!
zmo_ has joined #ruby
<shevy>
romankrv you could kill the gem file
<shevy>
"find / -name gem"
<shevy>
Hanmac whoa, removing rubygems would break ruby?
ananthakumaran has quit [Ping timeout: 256 seconds]
roadt has quit [Ping timeout: 245 seconds]
JohnBat26 has quit [Remote host closed the connection]
<Hanmac>
shevy he still dont answer me cleary why he wants to remove rubygems ... i think he does not understand what it is
Xeago has joined #ruby
<romankrv>
ok - thanks. I have one question yet: what is better use: RVM or rbenv? and what in more get resource (hdd, memory, cpu etc) ? and what more clearly to use?
lggr has quit [Ping timeout: 246 seconds]
ananthakumaran has joined #ruby
tobyo has quit [Ping timeout: 260 seconds]
aces1up has quit [Remote host closed the connection]
Solnse has joined #ruby
aces1up has joined #ruby
JohnBat26 has joined #ruby
<shevy>
romankrv I always compile and use ruby from source, so my answer is both RVM and rbenv is unnecessary
<shevy>
rbenv is much smaller though so comparing the two is unfair
lggr has joined #ruby
<shevy>
and if you are concerned about resources
<shevy>
use C not Ruby :-)
<shevy>
Hanmac, I decided that I need to master C
<shevy>
there is just no way around it
JonnieCache has joined #ruby
klip has quit [Read error: Operation timed out]
vlad_starkov has joined #ruby
<Hanmac>
shevy that sounds good, and if you master C, you can tame C++ too :P
stw has joined #ruby
melzz has quit [Remote host closed the connection]
lggr has quit [Ping timeout: 240 seconds]
daniel_-_ has quit [Read error: Operation timed out]
lggr has joined #ruby
danguita has joined #ruby
melzz has joined #ruby
<shevy>
nah
<shevy>
C shall be enough
roadt has joined #ruby
<shevy>
I won't like C anyway
<shevy>
but learning C++ on top of that is just useless!
jianchen has joined #ruby
<shevy>
I'd like for C to add cout << "bla" though
jerius has quit [Quit: Computer has gone to sleep.]
timonv_ has quit [Remote host closed the connection]
shiki has joined #ruby
workmad3 has joined #ruby
chendo_ has quit [Quit: Computer has gone to sleep.]
lggr has quit [Ping timeout: 272 seconds]
lggr has joined #ruby
emergion has quit [Quit: Computer has gone to sleep.]
somazero has joined #ruby
Spooner has joined #ruby
shiki has quit [Read error: Connection reset by peer]
skaczor has quit [Remote host closed the connection]
Takehiro has quit [Remote host closed the connection]
rabidpraxis has joined #ruby
bradhe has joined #ruby
skaczor has joined #ruby
lggr has quit [Ping timeout: 240 seconds]
Iszak has joined #ruby
Iszak has joined #ruby
Iszak has quit [Changing host]
lggr has joined #ruby
bradhe has quit [Ping timeout: 252 seconds]
frogprince_mac has joined #ruby
mneorr has joined #ruby
daniel_-_ has quit [Read error: Operation timed out]
kil0byte has quit [Remote host closed the connection]
freeayu has quit [Ping timeout: 245 seconds]
Iszak has quit [Remote host closed the connection]
icole has joined #ruby
lggr has quit [Ping timeout: 252 seconds]
Neesan has joined #ruby
freeayu has joined #ruby
icooba has quit [Quit: Computer has gone to sleep.]
morozovm has quit [Quit: morozovm]
hsbt is now known as hsbt_away
lggr has joined #ruby
icole has quit [Ping timeout: 260 seconds]
vlad_starkov has joined #ruby
JonnieCache has joined #ruby
A124 has joined #ruby
danguita has quit [Ping timeout: 240 seconds]
AngeloChang has joined #ruby
lggr has quit [Ping timeout: 256 seconds]
Takehiro has joined #ruby
timonv has joined #ruby
workmad3 has quit [Ping timeout: 246 seconds]
lggr has joined #ruby
negev has joined #ruby
<negev>
hi, i've got a model object descended from a class called NSManagedObject. if i call obj.name from elsewhere in the code i can see the name, but inside the model class i can't do @name to get the name, how can i figure out how to access the properties? i've tried listing the instance variables but it seems there aren't any
cantonic_ has joined #ruby
AngeloChang|2 has joined #ruby
zmo_ has joined #ruby
akemEikko has quit [Read error: Connection reset by peer]
akem has joined #ruby
<Hanmac>
negev it depends on the class, i dont know about NSManagedObject
cantonic has quit [Ping timeout: 245 seconds]
cantonic_ is now known as cantonic
negev has quit [Quit: Lost terminal]
mneorr has quit [Remote host closed the connection]
<Spooner>
Hanmac : It is something in iOS/rubymotion so I'd guess the name will be external to Ruby, but negev decided that knowing wasn't that important ;)
jeffreybaird has joined #ruby
akem has joined #ruby
<elliot98>
the net library works in 1.9.2 for ssl authentication, but getting an error with the same exact code on 1.9.3
<Spooner>
Hey matti! Got Fizzbuzz into the 2.0 stdlib yet?
<Snader_LB>
if there's anyone with write access to the Web site <http://www.ruby-lang.org/>, or just a dev getting there, please PM me for a bit
<Snader_LB>
there are some typos i'd like to report via this way
gmci has joined #ruby
<matti>
Spooner: Not funny :<
<Spooner>
Yeah, I already know they have a code-freeze on, before release.
<Spooner>
:D
<matti>
Spooner: Plus, the idea is to move most of stdlib to gems.
<matti>
Spooner: Aside of that, nobody gives likes my FizzBuzz ;d
<Spooner>
Oh yeah, that is true, but they will be gems distributed with Ruby, so effectively the same thing, only they can be updated.
vlad_starkov has joined #ruby
<Spooner>
matti : I think it is a grand project.
t0rc has joined #ruby
<matti>
Spooner: Not funny, Mark II
<matti>
;d
<shevy>
matti!
<shevy>
let's marry
kjellski has joined #ruby
<matti>
Spooner: Stop mocking noobs ;p
Virunga has quit [Remote host closed the connection]
<shevy>
stop nooking moobs!
<matti>
shevy: Are you an cute asian girl?
<matti>
s/an/a/
<matti>
shevy: Preferably Japanese.
<shevy>
no :(
<matti>
Well then. I need to refuse.
<matti>
But thanks for the offer.
akem has quit [Ping timeout: 245 seconds]
<matti>
Very kind, indeed.
<matti>
Provided that nobody would like to marry me ;d
<matti>
[ ;p ]
c0rn_ has joined #ruby
<sakh>
ty Spooner, its confusing as I remember seeing this hash somewhere in docs
<Spooner>
sakh : Yeah, it does take a hash, but not for that which is a regular arg.
nouh has joined #ruby
<Spooner>
sakh Specific Rails questions are better in #rubyonrails though.
lggr has quit [Ping timeout: 260 seconds]
<Spooner>
sakh It is terrible API though, to have a default argument AND a hash. Bleh bleh bleh!
<sakh>
oh ok thanks
monkegjinni has joined #ruby
lggr has joined #ruby
Jellyg00se has quit [Read error: Connection reset by peer]
Jellyg00se has joined #ruby
akafurious has joined #ruby
akafurious has quit [Client Quit]
lggr has quit [Ping timeout: 246 seconds]
Neomex has quit [Quit: Neomex]
workmad3 has joined #ruby
<matti>
Spooner: Rails is like that ;d
<shevy>
hehe
<shevy>
I'd wish ruby projects would work
<shevy>
can it be so hard to want a script that uploads a video to youtube
lggr has joined #ruby
hsbt_away is now known as hsbt
Virunga has joined #ruby
bradhe has joined #ruby
hiroyuki has quit [Ping timeout: 256 seconds]
lggr has quit [Ping timeout: 255 seconds]
timonv has joined #ruby
bradhe has quit [Ping timeout: 240 seconds]
freeayu has quit [Remote host closed the connection]
sambio has joined #ruby
lggr has joined #ruby
drago757 has quit [Quit: drago757]
vlad_starkov has quit [Remote host closed the connection]
chimay has quit [Quit: WeeChat 0.4.0-dev]
NiteRain has joined #ruby
mucker has joined #ruby
<Spooner>
shevy : I can guantee that all my gems don't work. At least I'm consistent.
Snader_LB has left #ruby [#ruby]
<shevy>
lol
<shevy>
this youtube-g gem does not work
<Spooner>
If they do work, it is purely accidental.
wallerdev has joined #ruby
jrajav has joined #ruby
und3f has quit [Quit: Leaving.]
xsdg has quit [Ping timeout: 255 seconds]
lggr has quit [Ping timeout: 255 seconds]
lggr has joined #ruby
hsbt is now known as hsbt_away
<waxjar>
shevy, i was recently looking for youtube gems. youtube_it seems to be the best one
sertaconay has joined #ruby
xsdg has joined #ruby
<shevy>
aha
<shevy>
let's see, thanks
JohnBat26 has quit [Remote host closed the connection]
robustus has joined #ruby
icooba has joined #ruby
icooba has quit [Client Quit]
lggr has quit [Ping timeout: 252 seconds]
punkrawkR has joined #ruby
psirw has joined #ruby
conor_ireland has joined #ruby
workmad3 has quit [Ping timeout: 246 seconds]
icole has joined #ruby
lggr has joined #ruby
monkegjinni has quit [Read error: Connection reset by peer]
monkegjinni has joined #ruby
vlad_starkov has joined #ruby
wubino has quit [Quit: Leaving]
miphe has joined #ruby
icole has quit [Ping timeout: 260 seconds]
joofsh has joined #ruby
Xeago has joined #ruby
Guest35230 has joined #ruby
slainer68 has quit [Remote host closed the connection]
stw1 has joined #ruby
c0rn_ has quit [Quit: Computer has gone to sleep.]
lggr has quit [Ping timeout: 265 seconds]
lggr has joined #ruby
stw has quit [Ping timeout: 256 seconds]
_cheney has joined #ruby
timonv has quit [Remote host closed the connection]
moted has quit [Ping timeout: 248 seconds]
<thejoecarroll>
hi folks
daniel_- has joined #ruby
<matti>
Ohai thejoecarroll
<thejoecarroll>
hi matti
<thejoecarroll>
you have a minute to help a n00b with some questions about instance variables, accessors and initialize
<thejoecarroll>
?
daniel_-_ has quit [Read error: Operation timed out]
mneorr has quit [Remote host closed the connection]
<matti>
thejoecarroll: Just ask :)
<thejoecarroll>
cheers :-)
meskyanichi has joined #ruby
<matti>
Hey meskyanichi
<thejoecarroll>
i'm working on an edx assignment. i don't want the solution, just to figure it out for myself. i have a couple of ideas, and i wanted to know where/whetehr i'm going wrong
lggr has quit [Ping timeout: 244 seconds]
<Spooner>
matti I'm waiting for someone to ask if they can ask if they can ask a question ;)
<matti>
meskyanichi: I had no idea that you sit on IRC as well.
<meskyanichi>
hello
<matti>
Spooner: That does happen ;d
<meskyanichi>
I'm on and off :)
<matti>
meskyanichi: :)
<matti>
thejoecarroll: You can show sample code.
<matti>
thejoecarroll: Or explain the problem very well ;]
<thejoecarroll>
you won't get a better explanation from me :-)
<thejoecarroll>
that's the full text of of the particular task
vectorshelve has quit [Quit: Page closed]
<Spooner>
thejoecarroll : You aren't the first person in the last 24 hours with this problem in #ruby ;)
<thejoecarroll>
i'm sure :-D
<matti>
Yeah.
jeffreybaird has joined #ruby
<matti>
There will be 3 already.
<matti>
Haha
<thejoecarroll>
aw, thought there would have been more ;-)
timonv has joined #ruby
<thejoecarroll>
some people have shamelessly put tasks up on stackexchange and asked for solutions
<Spooner>
I can honestly say that it is a dreadful question and I can't see how you can do it with the given code (it isn't hard, but it is impossible if you absolutely use the code you are given).
<thejoecarroll>
anyway, to be clear, i want to figure it out myself; i just need to get a few details straight
lggr has joined #ruby
kjellski has quit [Ping timeout: 255 seconds]
<Spooner>
Yeah, they will do. People are pretty stupid (because we want people to get good grades, not to learn anything).
<Spooner>
But anyway, yes, I looked at this yesterday, out of interest. Ask away.
<matti>
I'd do it differently.
<Spooner>
matti would implement it as a C extension gem.
<thejoecarroll>
well, i did think some of the instructions that are meant to help are a little confusing and complicate the matter
<matti>
Spooner: Not funny, Mark III.
<matti>
Spooner: I'd do it with method_missing
codeFiend has quit [Ping timeout: 246 seconds]
<thejoecarroll>
btw, i cleaned up that pastie (commented the instructive text so the ruby code is properly highlighted etc.)
<Spooner>
Not a good way, matti, since you "use up" method_missing (Yes, you can method-chain it, but why bother if you can do it simply with dynamic code?).
FifthWall has joined #ruby
niklasb has joined #ruby
vlad_starkov has quit [Remote host closed the connection]
workmad3 has joined #ruby
<matti>
Spooner: For flexibility.
<Spooner>
Why do you need it to be flexible? You know exactly what methods you need.
<Spooner>
method_missing is better when you don't know what you need until run-time.
<matti>
Indeed.
icooba has joined #ruby
<matti>
What if I want to handle foo, bar, baz, quux, etc.
<matti>
And have quux_history.
<Spooner>
Sorry, by run-time I mean after object instantiation rather than during class definition.
<thejoecarroll>
what i'm doing first is to create a Foo class that just does bar_history as asked. then i'll generalise that and add it to Class, defining #{attr_name}= etc. using class_eval as required
<matti>
Spooner: Ah.
* matti
is just a noob
lggr has quit [Ping timeout: 245 seconds]
<thejoecarroll>
but i'm embarrassed to say that getting the first of these steps isn't working the way i expected
<Spooner>
So where are you falling over?
<shevy>
the cliff
<thejoecarroll>
my first question is to do with initialising variables
<thejoecarroll>
(in fact, once i get that straight, i hope to manage the rest myself)
<shevy>
I usually put the variables in a method called "reset"
<Spooner>
thejoecarroll Nope, you are creating an instance vairable on the class once, not on each instance.
<thejoecarroll>
so it seems
<thejoecarroll>
so my next thought was the standard constructor method, initialize
<Hanmac>
(@bar_history ||=[nil]) << value
<Spooner>
You need to use @bar_history ||= [nil] in the method, so that it sets it if it doesn't already exist.
<thejoecarroll>
and what i wanted to check is that there's no way reopen the initialize method the way you can reopen classes etc?
<Spooner>
You can't put it in initialize, since there is no guarantee that Foo class won't have an initialize and _not_ call "super".
fyolnish has joined #ruby
<thejoecarroll>
i assume that if i were to write in an initialize for this instance variable, any class that uses the custom accessor and wants to define it's own initialize will break it, no?
<thejoecarroll>
yeah, Spooner, that's what i was thinking
bradhe has quit [Ping timeout: 246 seconds]
<Spooner>
Yes. You could use initialize here and it would work, but it would not likely work in the real world (and also you don't know which variables to create in initialize).
<thejoecarroll>
so the only way to do it is a conditional assignment
fyolnish has quit [Remote host closed the connection]
<thejoecarroll>
great
<Spooner>
Yeah, you need to create it when it is requested.
<thejoecarroll>
that straightens things out for me
<thejoecarroll>
i believe i can manage the rest
<thejoecarroll>
thanks guys
<thejoecarroll>
basically wanted to establish that there was nothing else special about initialize other than its name (which logically should be new, no?)
lggr has quit [Ping timeout: 248 seconds]
hsbt_away is now known as hsbt
<thejoecarroll>
and that instance variables only work within method definitions
<Spooner>
No, new is the class method. It creates an instance and calls initialize on it.
<Spooner>
But yes, there is nothing special about it other than that it always gets called from #new.
slainer68 has joined #ruby
jstarr has joined #ruby
<thejoecarroll>
ok, that's clear
chichou_ has joined #ruby
andrew__ has joined #ruby
<thejoecarroll>
unfortunately some of the stuff i've read has muddied the waters as much as it has clarified other stuff. and some of it just needs to be read several times to sink in (and some experiments tried), e.g. Why?'s old metaid.rb article http://ruby-metaprogramming.rubylearning.com/html/seeingMetaclassesClearly.html
lggr has joined #ruby
<thejoecarroll>
still getting my head around the some of the intricacies of the ruby object model
<thejoecarroll>
love it though :-)
chichou has quit [Ping timeout: 246 seconds]
andrew__ is now known as andrewhl
codeFiend has joined #ruby
<wwoodrum>
hey guys
otters has quit [Ping timeout: 245 seconds]
<wwoodrum>
im trying to write a scrit using the Fibonacci sequence
<wwoodrum>
and I have most of the code written but I can't figure out how to start using a user defined value
<Spooner>
Haven't had a Fibonacci for a week or two.
<Spooner>
There does. I'm just happy to see they are teaching Ruby rather than Java (or Ada, which is what we got back in the day).
<thejoecarroll>
btw, thanks Spooner & Hanmac for the reminding me of the ||= idiom for assignments. i'd forgotten all about that. concise and elegant
<rTypo>
also probably Project Euler
<wwoodrum>
so.. im assuming you guys already helped somone with fibonacci?
<Spooner>
wwoodrum : Yeah, but not sure what your question is. Your code seems to work for me.
<wwoodrum>
yeah it works, but I want to be able to input a value and start the sequence from that number
<matti>
rTypo: Oh, yeah. Good point.
lggr has quit [Ping timeout: 245 seconds]
chimay has joined #ruby
slainer68 has quit [Ping timeout: 245 seconds]
<Spooner>
wwoodrum : You can't.
<wwoodrum>
=[
kuzushi has quit [Ping timeout: 252 seconds]
<wwoodrum>
-A method fibonacci(n) that calculates the nth user defined Fibonacci number.
<wwoodrum>
-A method fibonacci(n) that calculates the nth user defined Fibonacci number.]=
<Spooner>
However, if you want to improve it, don't generate the entire array. You only actually need to remember the last two values. You don't want a million element array.
lggr has joined #ruby
<wwoodrum>
-Implements an option for the user to enter either integers (example above) or floats (decimals) before displaying the Fibonacci sequence.
<wwoodrum>
oohh ok
<Spooner>
Oh, I see, then you just need to do: puts fib(value)
timonv has quit [Remote host closed the connection]
<wwoodrum>
when i put fib(value) i get 8,8,8,8
otters has joined #ruby
<wwoodrum>
if i enter 6
<Spooner>
Yeah, indexes start at 0 in Ruby. You probably want fib(value + 1) then
jmampost has joined #ruby
<wwoodrum>
kk
<Spooner>
I mean: value -1
<Spooner>
10.times gives you 0 up to 9
thmzlt has joined #ruby
<Spooner>
Or you might want to change the number in the method, so 1 is the first index. Depends what floats your boat ;)
havenn has quit [Remote host closed the connection]
hsbt is now known as hsbt_away
v0n has quit [Ping timeout: 255 seconds]
jstarr has quit [Quit: leaving]
lggr has quit [Ping timeout: 252 seconds]
ananthakumaran has quit [Quit: Leaving.]
vlad_starkov has joined #ruby
noxoc1 has joined #ruby
ananthakumaran has joined #ruby
irleif has joined #ruby
bitZero__ has joined #ruby
lggr has joined #ruby
noxoc has quit [Ping timeout: 260 seconds]
vlad_starkov has quit [Remote host closed the connection]
jmampost has quit [Remote host closed the connection]
lggr has joined #ruby
anderse has quit [Ping timeout: 252 seconds]
anderse_ is now known as anderse
niklasb has joined #ruby
roychri has quit [Quit: And that's the way the cookie crumbles!]
mneorr has joined #ruby
jrajav has quit []
Vert has joined #ruby
timonv has joined #ruby
busybox42 has quit [Read error: Connection reset by peer]
lggr has quit [Ping timeout: 246 seconds]
busybox42 has joined #ruby
<thejoecarroll>
Hanmac: going back to the solution you suggested earlier, what is the consensus on (ab)use of define_method, instance_variable_get, instance_variable_set etc.?
<thejoecarroll>
(i finished the problem successfully some time ago with my own alternative, using class_eval, as instructed)
marcux has joined #ruby
lggr has joined #ruby
<thejoecarroll>
it seems to me that those methods, run counter to the general approach towards objects' instance variables
synthetix has joined #ruby
<thejoecarroll>
i discovered them and played around with them a bit yesterday, but figured that using them extensively is probably not good practice
marcux has quit [Remote host closed the connection]
uris_ has joined #ruby
<Spooner>
thejoecarroll : Using those methods is not any better or worse than using the class eval("bleh") route.
<thejoecarroll>
fair enough
<thejoecarroll>
i'd say eval has the potential to be more readable
<Spooner>
The thing is that using them externally to the object, to bypass encapsulation, is bad, but the thing with Ruby is that you can always do something; it is just more convoluted to avoid the "protections" to try to encourage people not to do stupid stuff (or to make them doubly careful when they need to).
JonnieCache has quit [Ping timeout: 252 seconds]
lggr has quit [Ping timeout: 265 seconds]
<Spooner>
thejoecarroll : eval is also faster at run-time, since you aren't manipulating strings and calling methods, but just directly accessing @frog_history
<Hanmac>
i mosty try to awoid eval when possible
<Spooner>
Yes, you should always use the least horrible method ;)
<thejoecarroll>
that's a good detail to know, Spooner
<thejoecarroll>
but, i just tested it in irb, and i got nil, rather than [nil]...
lggr has quit [Ping timeout: 240 seconds]
<shevy>
wat
<shevy>
[nil] is an array
<Spooner>
Those tests aren't up to scratch then ;)
<Spooner>
shevy No, it wants [nil], not nil.
bitZero__ has quit [Quit: leaving]
anderse has quit [Quit: anderse]
<thejoecarroll>
i'd have to agree
<thejoecarroll>
:-D
bitZero__ has joined #ruby
<Spooner>
thejoecarroll : You need to implement the history reader yourself is all. This is why I said that the given starting code _prevents_ you from actually completing the assignment.
fridim_ has joined #ruby
<thejoecarroll>
well-spotted
<thejoecarroll>
how long have you been coding ruby Spooner ?
Virunga has quit [Remote host closed the connection]
<thejoecarroll>
you called that pretty quickly
<Spooner>
Too long. As I said, though, I did this a couple of days ago.
<thejoecarroll>
although, i guess you've already been bothered with this assignment earlier :-)
<thejoecarroll>
yeah :-)
peterhellberg has joined #ruby
ForevernadeAFK has joined #ruby
lggr has joined #ruby
<Spooner>
If you get it working, I'll show you my version ;)
g-ram has joined #ruby
<Spooner>
Or you can have it now, allowing for the fact that you've technically finished your version.
nemesit has joined #ruby
robozahn has joined #ruby
<thejoecarroll>
i used to code as a hobby as a kid and for a while in my teens (basic, logo, pascal, c, c++, lisp) but lost interest at some point and only recently (i'm in my 30s now) got interested again, partly because i'm a sysadmin & it manager, and partly because ruby has inspired me. it's a really beautiful language, imho
<thejoecarroll>
i'll fix mine first, then compare notes :-)
timonv has quit [Remote host closed the connection]
lggr has quit [Ping timeout: 260 seconds]
rabidpraxis has quit [Read error: Connection reset by peer]
mneorr has quit [Remote host closed the connection]
<Spooner>
thejoecarroll : Yeah, I have been programming on and off since my teens, but very rarely professionally (40 now).
<peterhellberg>
Just started playing around with perftools.rb, and I must say that I’m impressed :)
lggr has joined #ruby
rabidpraxis has joined #ruby
irleif has quit [Quit: Computer has gone to sleep.]
JetAway has joined #ruby
CaptainJet has quit [Disconnected by services]
JetAway is now known as CaptainJet
noxoc1 has quit [Quit: Leaving.]
fridim_ has quit [Ping timeout: 265 seconds]
lggr has quit [Ping timeout: 244 seconds]
frederic has joined #ruby
<thejoecarroll>
hmm
<Spooner>
I agree.
<thejoecarroll>
i thought this would work, but it doesn't (no errors, but nil is returned not inside an array):
<thejoecarroll>
def #{attr_name}_history
<thejoecarroll>
@#{attr_name}_history || [nil]
<thejoecarroll>
end
<Spooner>
||=
lggr has joined #ruby
<thejoecarroll>
ah
<thejoecarroll>
oops :-)
<Spooner>
Though you are right, that should still return [nil] (if you are using/testing it correctly).
hsbt is now known as hsbt_away
<thejoecarroll>
that's what i thought
zmo_ has joined #ruby
bitZero__ has quit [Quit: leaving]
frederic has quit [Ping timeout: 260 seconds]
punkrawkR has quit [Read error: Connection reset by peer]
bitZero__ has joined #ruby
<thejoecarroll>
testing in irb || worked , i.e. nil || [nil] #=> [nil]
<thejoecarroll>
since i don't actually want to do an assignment
<thejoecarroll>
|| should be more correct
arturaz has joined #ruby
<thejoecarroll>
actually, it was correct
<thejoecarroll>
i just forgot to define the Foo class again before testing
<Spooner>
Yeah, || does make more sense since you don't have to set it, depending on how you are doing the rest of it (I use ||=, but that is because of how I do other stuff ;P).
<thejoecarroll>
i changed it back to || and can confirm that works. now let's see if i submit this more correct version, will the course's autograder still give me 100%. if now, i'll report an erratum
<thejoecarroll>
s/now/not
lggr has quit [Ping timeout: 272 seconds]
Faris has joined #ruby
<Spooner>
It presumably didn't check that part of the spec.
Virunga has joined #ruby
jeffreybaird has quit [Quit: jeffreybaird]
meskyanichi has quit [Quit: Leaving...]
dagnachewa has joined #ruby
lggr has joined #ruby
vitor-br has quit [Read error: Connection reset by peer]
mneorr has joined #ruby
Xeago has quit [Remote host closed the connection]
vitor-br has joined #ruby
alecchen has quit [Ping timeout: 255 seconds]
bitZero__ has quit [Quit: leaving]
bitZero__ has joined #ruby
cardoni has joined #ruby
irleif has joined #ruby
<Spooner>
thejoecarroll : My solution is https://gist.github.com/3889080 (though I'll admit the testing could be more thorough if I was being anal, it is quite enough for me :D). Going to be AFK a bit.
lggr has quit [Ping timeout: 272 seconds]
fridim_ has joined #ruby
lggr has joined #ruby
havenn has quit [Remote host closed the connection]
BMF has quit [Remote host closed the connection]
bitZero__ has quit [Quit: leaving]
miphe has quit [Quit: Leaving]
Neomex has quit [Quit: Neomex]
irleif has quit [Quit: Computer has gone to sleep.]
bitZero__ has joined #ruby
Eplemosen has joined #ruby
lggr has quit [Ping timeout: 244 seconds]
<shevy>
that's it
<shevy>
I am gonna master vim and C AT THE SAME TIME
<Spooner>
Yeah, blazes816 answer does exactly that. Thing is, I can't see a use-case for it, so hard to argue whether Ruby should have it (you can add special case stuff forever and ever).
kyletcarey has joined #ruby
kyletcarey has quit [Client Quit]
<bttf>
i have ruby1.8 packages installed on a prod machine ... i have never compiled ruby from source before and was wondering, should i be able to compile the 1.9.3 packages and seamlessly upgrade my existing 1.8.7 installation ?
lggr has joined #ruby
kyletcarey has joined #ruby
ZenGuy311 has joined #ruby
joeycarmello has joined #ruby
A124 has quit [Quit: Leaving.]
<blazes816>
new_hash = old_hash[other_hash.keys] would work if #[] took an array and returned a new hash from it
Cache_Money has joined #ruby
<blazes816>
well, I guess it wouldn't do the intersection
timonv has joined #ruby
irleif has quit [Quit: Computer has gone to sleep.]
<blazes816>
that php/mass-assignment article is ridiculous. it has nothing to do with ruby, it has to do with AR, which many people know sucks
<blazes816>
probably on par with the people who use PDO
Guest35230 has quit [Ping timeout: 265 seconds]
ZenGuy311 has quit [Excess Flood]
<Spooner>
And anyone using unsafe input is a muppet and doesnt' have a lot to do with Rails or PHP either ;)
<pnbeast>
bttf: FWIW, what I usually do is leave the distro's standard version alone, and compile my own, current version in another directory, then link it out of /usr/local/bin w/ a slightly different name. That is painful in some ways but convenient in others.
<workmad3>
blazes816: on top of that, the whole thing about mass-assignment was a blown-up case of people overreacting to a mostly non-issue
<thejoecarroll>
thanks blazes816 & Spooner
ngoldman has joined #ruby
<workmad3>
blazes816: it blew up because of a case of github managing to miss a place they should have been whitelisting attribute assignment, and then everyone was like 'oh noes, mass assignment is a massive security hole, we must find ways to make sure this is never a problem'
mohits has joined #ruby
mohits has quit [Changing host]
mohits has joined #ruby
ananthakumaran has quit [Quit: Leaving.]
<blazes816>
definitely agree. and it made them change to a totally different and unnecessary system
lggr has quit [Ping timeout: 245 seconds]
<workmad3>
blazes816: I quite like the new github system tbh
mneorr has quit [Remote host closed the connection]
<blazes816>
oh, I mean rails
Guest41452 has quit [Read error: Connection reset by peer]
<blazes816>
not gh
<workmad3>
blazes816: ah, you mean the whole strong-parameters thing?
<blazes816>
gh's new stuff makes a lot of sense
<blazes816>
yeah
<workmad3>
blazes816: yeah, I'm not convinced by that approach tbh
mahmoudimus has quit [Quit: Computer has gone to sleep.]
mneorr has joined #ruby
<blazes816>
I mean, it's fine, but it could have been solved by have a default attr_accessible nil, or something
<workmad3>
blazes816: and it breaks a lot of things... and IMO it moves the information to the wrong place
My_Hearing has joined #ruby
<blazes816>
workmad3: the info is my biggest complaint
bradhe has joined #ruby
sepp2k1 has quit [Remote host closed the connection]
<workmad3>
blazes816: I guess the thing there is that if you use non-AR models, strong-params still protects
<workmad3>
blazes816: while the attr_accessible stuff is something that hasn't been pulled out into ActiveModel, afaik... but that indicates something
<workmad3>
blazes816: active_attributes does try and do that, but I think AM should pull that side of things in personally :)
<blazes816>
i didn't realize it wasn't in AM, but that sounds strange
<blazes816>
yeah, for sure
<blazes816>
everything that's non-persistence related
<blazes816>
probably move that hyphen
lggr has joined #ruby
Mon_Ouie has quit [Disconnected by services]
My_Hearing is now known as Mon_Ouie
thmzlt has joined #ruby
quest88 is now known as kevinw
v0n has joined #ruby
manizzle has quit [Ping timeout: 248 seconds]
My_Hearing has joined #ruby
<workmad3>
blazes816: thinking about it, I can actually think that the info is in the right place for strong-params
Virunga has quit [Read error: Connection reset by peer]
<workmad3>
blazes816: because it's frequently dependent on the controller you're in what attributes are allowed to be passed through... e.g. an admin controller allows more params to be assigned than a users controller
bradhe has quit [Read error: Operation timed out]
<workmad3>
blazes816: and that's a use-case that is annoying with attr_accessible mass-assignment :)
zommi has joined #ruby
jgrevich has joined #ruby
<blazes816>
that's definitely a good use-case
<workmad3>
blazes816: a guy I work with also commented the other day that, to him (with a lot of java experience) it seemed odd to have authorization-style stuff in the domain model :)
<blazes816>
i still think the model should be in-charge of what to allow, and provide alternative interfaces for doing such, but open to it
<blazes816>
I'd setting for it being in an auth-related object if one exists
fir_ed has quit [Read error: Connection reset by peer]
samphippen has quit [Read error: Operation timed out]
<Hanmac>
shevy: "an small step for a man, but an large fall for the mankind" :D
<blazes816>
but they're not stock-rails so that'd be difficult
fir_ed has joined #ruby
chussenot has joined #ruby
chussenot has quit [Client Quit]
samphippen has joined #ruby
lggr has quit [Ping timeout: 245 seconds]
bitri has joined #ruby
philcrissman has joined #ruby
Chryson has joined #ruby
lggr has joined #ruby
swarley has quit [Ping timeout: 248 seconds]
jbw has joined #ruby
glyytchy has joined #ruby
fridim_ has quit [Ping timeout: 246 seconds]
glyytchy has quit [Client Quit]
iamjarvo has joined #ruby
whowantstolivefo has joined #ruby
mneorr has quit [Remote host closed the connection]
glyytchy has joined #ruby
mneorr has joined #ruby
andrewhl has quit [Remote host closed the connection]
g-ram has quit [Quit: Computer has gone to sleep.]
paolooo has quit [Ping timeout: 245 seconds]
lggr has quit [Ping timeout: 255 seconds]
thmzlt has quit [Remote host closed the connection]
<kendrick_>
Mon_Ouie: well, xx doesn't get altered
<Mon_Ouie>
Then it wasn't a Fixnum in the first place
<workmad3>
kendrick_: xx isn't a Fixnum
pnbeast has joined #ruby
<kendrick_>
so then why does xx.study show 5::Fixnum ?
<Mon_Ouie>
You shouldn't rely on Fixnum either way: use when Integer then …
<kendrick_>
again, i don't know ruby :)
<workmad3>
kendrick_: the result of calling xx.study is a Fixnum
<kendrick_>
Mon_Ouie: to be precisey, the case actually does when Fixnum, Integer ... else ... :)
<Mon_Ouie>
That's redundant, any Fixnum is an Integer
<kendrick_>
so would i want the 'case' to be on xx.study instead of xx?
<kendrick_>
well, this isn't an integer, either, then :)
<kendrick_>
code block is something like:
<Mon_Ouie>
workmad3: What's that #study method anyway?
<kendrick_>
[:foo, :bar, :baz].each do |x|
<workmad3>
Mon_Ouie: I'm guessing it's a custom method on whatever object xx is
<kendrick_>
xx = eval x.to_s
<kendrick_>
.. then that case/when/else/end
<kendrick_>
Mon_Ouie & workmad3 hah, aha, no wonder i couldn't find it via google
<kendrick_>
shoot, brb. weekend = taking care of children while i try to do this fix :(
<Mon_Ouie>
kendrick_: puts xx.class; p xx should tell you more
<Hanmac>
kendrick_ in this case xx can be "absolutely" anything
x82_nicole has joined #ruby
<workmad3>
Hanmac: anything apart from a Fixnum anyway, thanks to a process of elimination ;)
JonnieCache has quit [Ping timeout: 252 seconds]
timonv has quit [Remote host closed the connection]
awestroke has quit [Remote host closed the connection]
lggr has quit [Ping timeout: 252 seconds]
kiyoura has joined #ruby
<kendrick_>
class = String
Axsuul has joined #ruby
<kendrick_>
which i guess does not surprise me, considering that x.to_s :)
<workmad3>
kendrick_: so xx is a string
<kendrick_>
i wonder what my coworker was thinking :)
<workmad3>
kendrick_: which also seems to indicate that you've monkey-patched string at some point in your code-base ;)
<kendrick_>
not it. :)
<kendrick_>
otoh, his system is replacing an older one i wrote in PHP, so......
philcrissman has quit [Remote host closed the connection]
<kendrick_>
so i guess .study is something he wrote for logging/execption-raising purposes
lggr has joined #ruby
<workmad3>
kendrick_: quite possibly... sounds a bit odd (especially as it sounds like what he really wanted/needed was just the .inspect method)
sterNiX has joined #ruby
hsbt is now known as hsbt_away
h4mz1d has joined #ruby
<kendrick_>
yeah i found the def for study. it crams .inspect and .class together, sometimes along with something length-related. again, this seems to be a helper function for debugging output purposes.
<kendrick_>
worst case scenario, since i know the cronjobs that invoke this script are sending it the right input, is to comment this block out and throw a FIXME comment in there
adeponte has joined #ruby
bttf has quit [Quit: Lost terminal]
uris_ has quit [Quit: leaving]
irleif has joined #ruby
zommi has quit [Quit: Leaving.]
<kendrick_>
my coworker's under a bit of stress, and has been doing this himself, until we recently hired another engineer who's been helping him.
wpaulson_ has joined #ruby
<kendrick_>
that said, it's annoying that he puts stuff that's obviously broken (cannot parse its own command-line args :) ) into production
lggr has quit [Ping timeout: 260 seconds]
<peterhellberg>
Released a new gem today, feels nice to have a productive weekend once in a while ;)
<peterhellberg>
kendrick_: What about the test suite?
<kendrick_>
heh, i _looked _at Tux Paint the other day. does that count as working on it?
<peterhellberg>
kendrick_: Is it also broken?
<kendrick_>
peterhellberg: no clue what kind of test stuff he has set up for this
<peterhellberg>
kendrick_: Ah
banseljaj is now known as imami|afk
wpaulson has quit [Ping timeout: 240 seconds]
wpaulson_ is now known as wpaulson
reuf has quit [Quit: Leaving]
<peterhellberg>
I’ve been having some issues with Travis CI today, it would be nice if there was some way to differentiate errors with launching the virtual machines and actual test run failures
reuf has joined #ruby
lggr has joined #ruby
awestroke has joined #ruby
timonv has joined #ruby
glyytchy has quit [Quit: Leaving...]
Guest35230 has joined #ruby
<kendrick_>
sigh ok
<peterhellberg>
Oh, and the little project I’ve been working on today just got linked from the main site: http://www.hashids.org/ruby/
<kendrick_>
emailed my engineering team list :)
<kendrick_>
thanks and cya folks! i'll probably pop in here now and then as i get more accustomed to this new codebase & ruby :)
dagnachewa has quit [Remote host closed the connection]
<kendrick_>
*sigh* exception raised later in the script :D
<peterhellberg>
kendrick_: Ouch, I hope you figure it out :)
kaawee has joined #ruby
pencilcheck has joined #ruby
<kendrick_>
code out of sync
chimay has quit [Quit: WeeChat 0.4.0-dev]
<kendrick_>
crap in production that's not in repository
Guest35230 has quit [Ping timeout: 245 seconds]
hvq has joined #ruby
<workmad3>
kendrick_: damn :( sounds like your team mate needs a bit of re-education in good developer practices, like making sure nothing gets to production that isn't in source control
ryanf has joined #ruby
<workmad3>
(hell, nothing gets to production without being tested too... preferably with both developer tests and business tests, and possibly some QA...)
lggr has quit [Ping timeout: 252 seconds]
<hvq>
hi, what does the hash :provides => :json do? If I want to look up functions like that, where can I see the references? Thanks
<hvq>
get "/thing/?", :provides => :json do
<workmad3>
hvq: so is this in the context of sinatra?
<Spooner>
hvq It does nothing, but I am assuming you are talking about it in a very specific method call - in Rails, perhaps? Oh, Sinatra.
<kendrick_>
workmad3: yeah. :( he's been under duress<sp?> lately. so getting a bit sloppy
<hvq>
Spooner, workmad3: it's Sinatra
Neomex has quit [Quit: Neomex]
<workmad3>
hvq: maybe you should be reading sinatra documentation then :P
<kendrick_>
sadly, that makes stuff break and everyone else's lives harder :) we have far too many fun projects to work on, instead of debugging
pen has quit [Ping timeout: 246 seconds]
<workmad3>
kendrick_: unfortunately :( it's important to keep discipline even under duress, but it's also hard
krz has quit [Quit: krz]
lggr has joined #ruby
tk__ has quit [Quit: ばいばい]
<Spooner>
hvq : ":provides => :json configures the route to respond with an Content-Type: application/json" you know, Google responded to "sinatra provides json" perfectly well.
<workmad3>
Spooner: yes, but now hvq has a new way to google - 'Spooner: what does X mean?' :P
<Spooner>
I know. Grand, isn't it? Thus the sarcastic response.
<hvq>
workmad3, Spooner: yeah, thanx! perhap I didnt include sinatra in the keywords, got no idea they are related :P
<workmad3>
Spooner: I prefered my sarcastic 'rtfm' response ;)
timonv has quit [Remote host closed the connection]
hemanth has quit [Read error: Connection reset by peer]
<Spooner>
workmad3: And I haven't provided my invoice as a Google search consultant yet ;)
h4mz1d has quit [Ping timeout: 245 seconds]
<workmad3>
Spooner: ooh, that's something to start doing :D
<workmad3>
Spooner: what are your rates? £200 a search? :D
hemanth has joined #ruby
<Spooner>
workmad3: I dunno. I don't think the UK government could process the amount of tax I'd generate on that fee. It would wrap all the bank's clocks around to 0 again ;)
joofsh has quit [Quit: This computer has gone to sleep]
<workmad3>
Spooner: we could start a brand new industry
mikepack has joined #ruby
<workmad3>
Spooner: and at those rates, it would be worth trillions within a few days :D
tjbiddle has joined #ruby
<Spooner>
It already exists actually. There are SMS "ask any question" companies that are just googling for £5 or whatever.
<workmad3>
Spooner: and besides... just funnel the profits through a shell account in jersey
leprkhn has joined #ruby
Takehiro has quit [Remote host closed the connection]
lggr has quit [Ping timeout: 246 seconds]
Takehiro has joined #ruby
irleif has quit [Quit: Computer has gone to sleep.]
<workmad3>
Spooner: I'm not sure... we could keep going for a bit longer :)
<hvq>
workmad3, Spooner: :@)
timonv has joined #ruby
lggr has joined #ruby
swarley has joined #ruby
jslowe has joined #ruby
kaawee has quit [Read error: Connection reset by peer]
mohits has quit [Ping timeout: 255 seconds]
kaawee has joined #ruby
lggr has quit [Ping timeout: 255 seconds]
conor_ireland has quit [Quit: conor_ireland]
tjbiddle has quit [Quit: tjbiddle]
conor_ireland has joined #ruby
lggr has joined #ruby
reuf has quit [Ping timeout: 252 seconds]
xcvd`` has joined #ruby
frederic has joined #ruby
arielpts has quit [Ping timeout: 260 seconds]
jslowe has quit [Ping timeout: 244 seconds]
joofsh has joined #ruby
iamjarvo has quit [Read error: Operation timed out]
jeffreybaird has joined #ruby
slainer68 has joined #ruby
arielpts has joined #ruby
hbpoison has joined #ruby
akem has joined #ruby
lggr has quit [Ping timeout: 245 seconds]
ryanRT has quit [Quit: Ex-Chat]
kaawee has quit [Read error: Connection reset by peer]
hsbt_away is now known as hsbt
nyrb has joined #ruby
kaawee has joined #ruby
lggr has joined #ruby
bradhe has joined #ruby
hbpoison has quit [Ping timeout: 245 seconds]
nyrb has quit [Remote host closed the connection]
kaawee has quit [Ping timeout: 245 seconds]
locriani_ has joined #ruby
clj_newb has quit [Ping timeout: 272 seconds]
locriani_ has quit [Remote host closed the connection]
conor_ireland has quit [Quit: conor_ireland]
awestroke has quit [Remote host closed the connection]
Orcris has joined #ruby
awarner has quit [Remote host closed the connection]
bradhe has quit [Ping timeout: 240 seconds]
locriani has quit [Ping timeout: 244 seconds]
v0n has quit [Ping timeout: 260 seconds]
rippa has quit [Ping timeout: 240 seconds]
lggr has quit [Ping timeout: 240 seconds]
c0rn_ has joined #ruby
mikepack has quit [Remote host closed the connection]
leprkhn has quit [Read error: Connection reset by peer]
leprkhn has joined #ruby
lggr has joined #ruby
headius has joined #ruby
Guest569 has joined #ruby
mohits has joined #ruby
mohits has quit [Changing host]
mohits has joined #ruby
Monie has joined #ruby
pencilcheck has quit [Read error: Connection reset by peer]
pen has joined #ruby
cakehero has quit [Quit: Computer has gone to sleep.]
hsbt is now known as hsbt_away
mikepack has joined #ruby
lggr has quit [Ping timeout: 256 seconds]
punkrawkR has joined #ruby
mikepack has quit [Remote host closed the connection]
rlomax has quit [Quit: Lost terminal]
leprkhn has quit [Quit: Leaving]
jerius has joined #ruby
Guest569 has left #ruby [#ruby]
ddd has quit [Quit: Leaving.]
lggr has joined #ruby
Eplemosen has quit [Ping timeout: 265 seconds]
<profx_>
anyone else working on their Berkley assignment ?
awestroke has joined #ruby
lggr has quit [Ping timeout: 260 seconds]
robbyoconnor has joined #ruby
<Spaceghostc2c>
profx_: Berkeley doesn't tell me what to do!
pen has quit [Remote host closed the connection]
<Spaceghostc2c>
Berkeley ain't my mom!
* profx_
sighs
<wwoodrum>
word up ruby scripting homies
v0n has joined #ruby
<otters>
scripting
<otters>
hah
Virunga has joined #ruby
<wwoodrum>
if i convert an integer to float. will it automatically add .00 ?
<wwoodrum>
or no...?
<Spooner>
wwoodrum : It will truncate it, if that is what you mean.
<profx_>
Spooner: the reverse wouold, you mean
lggr has joined #ruby
<profx_>
float -> int would truncate
frederic has quit [Remote host closed the connection]
<wwoodrum>
well im back to the fibonacci number... is fibonacci possible with flaots or just integers?
<Spooner>
profx_ : Yeah, brain not on ;)
<profx_>
wwoodrum: just ints
workmad3 has quit [Ping timeout: 246 seconds]
advorak has quit [Quit: This computer has gone to sleep]
<wwoodrum>
my professor wants: -Implements an option for the user to enter either integers (example above) or floats (decimals) before displaying the Fibonacci sequence.
<Spooner>
wwoodrum : There is no sense in a fibonacci from an int. So you would be converting a float to an int if you are to accept floats.
robbyoconnor has quit [Disconnected by services]
<Spooner>
Oh jeez. No point from a float. I should give up today ;)
<wwoodrum>
any idea what he wants?
<profx_>
wwoodrum: make it multi-purpose, convert all floats to ints ?
<Spooner>
Though that makes no sense at all, since it is an integer, not a float. But that is professors for you - they are prepared to break all sense of logic in trying to fix a problem around their teaching goals ;)
pjb1__ has joined #ruby
<wwoodrum>
i think he wants the user to choose ints ( 0,0,1) or floats so it displays (0.00,0.00,1.00)
arturaz has quit [Quit: Bye]
<profx_>
ah, so the result type is dependant upon the input type
haxrbyte has quit [Remote host closed the connection]
<Spooner>
wwoodrum : The use of "then" is superfluous.
<profx_>
in irb, can I reference the last command or the result returned from the last command ?
jimeh has quit [Ping timeout: 240 seconds]
<wwoodrum>
what should i use instead of then?
<Spooner>
Just don't use it.
<Spooner>
Leave it out ;)
<wwoodrum>
just use if else?
tobyo has quit [Quit: WeeChat 0.3.2]
<wwoodrum>
kk
jerius has quit [Quit: Computer has gone to sleep.]
lggr has quit [Ping timeout: 246 seconds]
<Spooner>
The use of "then" is purely optional, so we don't use it. The only use that makes sense is in a one-liner "if x then 2 else 12 end" but you might as well use ?: in that case.
sambio has quit [Ping timeout: 260 seconds]
<wwoodrum>
gotcha, yeh took then out and still eveyrthing works fine..
<wwoodrum>
jsut trying to figure out this float thing
lggr has joined #ruby
pjb1__ has left #ruby [#ruby]
tchebb has joined #ruby
jeffreybaird has quit [Quit: jeffreybaird]
irleif has joined #ruby
roadt has quit [Ping timeout: 246 seconds]
<Spooner>
The requirement doesn't make sense to me, to tell the truth.
Linuxfreak78 has left #ruby ["zzzz.."]
joofsh has quit [Read error: Connection reset by peer]
<wwoodrum>
yeah me either, I posted on the class discussion board. He is a pretty confusing professor last week required a lone_sum product, and so i used addition but then he pinged my grade 30 points because he wanted a lone_product and accused me of copying last semesters work when his instructions clearly stated lone_sum
joofsh has joined #ruby
<Spooner>
"If you can't do, then teach" (though not universally true, it is certainly common).
<wwoodrum>
hah, well thanks again spooner! you're a great help
<Spooner>
The thing is, for example, that "2.0".to_i == "2".to_i = 2, so you already _can_ enter floats or ints.
lggr has quit [Ping timeout: 265 seconds]
pjb1 has joined #ruby
frogprince_mac has joined #ruby
c0rn_ has quit [Quit: Computer has gone to sleep.]
sertaconay has joined #ruby
lggr has joined #ruby
ph^ has joined #ruby
SqREL has joined #ruby
yxhuvud has quit [Read error: Connection reset by peer]
wargasm has joined #ruby
mohits has quit [Read error: Connection reset by peer]
yxhuvud has joined #ruby
fuleo2 has joined #ruby
eldar has quit []
fuleo has quit [Ping timeout: 255 seconds]
boxy has joined #ruby
lggr has quit [Ping timeout: 246 seconds]
irleif has quit [Quit: Computer has gone to sleep.]
advorak has quit [Quit: This computer has gone to sleep]
Bosma has joined #ruby
wwoodrum has quit [Quit: irc2go]
irleif has joined #ruby
<profx_>
sorry, what is : ?
<Spooner>
profx_ ?: you mean? It is the ternary operator and shorthand for if/else
<profx_>
i mean, :
lggr has joined #ruby
<Spaceghostc2c>
profx_: Depends on how you use it.
<profx_>
books["Gravity's Rainbow" ] = :splendid
<Spaceghostc2c>
It's called a colon.
<Spaceghostc2c>
profx_: :splendid.class
<Spooner>
Oooh, I thought you were referencing my message about using ?: earlier.
<boxy>
Hey I'm using active record and need to pull all records with a certain movie 'rating' i've been previously using Movie.all but i'm having trouble finding documentation on how to do this?
<profx_>
nope, I wasn't Spooner, sorry for the confusion
<Spooner>
S'ok, profx_, I'll forgive you ;)
<profx_>
ok, what is it, in that context ?
hbpoison has joined #ruby
<Spooner>
As Spaceghostc2c said, just do :splendid.class to find out.
<profx_>
would splendid do the same thing ? books["Gravity's Rainbow"] = splendid
<profx_>
Spooner: that was not clear
<profx_>
to try that command, I mean
<profx_>
so its a symbol
joeycarmello has quit [Remote host closed the connection]
<Spooner>
Although, in all fairness, Spaceghostc2c, there are plenty of cases where that wouldn't work to explain what something was (for example a method call, which would tell you what it returned, not that it was a method call).
<profx_>
and splendid.class is an error
alanp has joined #ruby
Cache_Money has quit [Ping timeout: 260 seconds]
jeffreybaird has joined #ruby
<Spaceghostc2c>
Spooner: Right, and I hope he knows what a method is at this point.
<Spaceghostc2c>
profx_: because splended is a local variable that hasn't been assigned a value.
<profx_>
ah, ok, so the symbol is needed (:)
<Spooner>
splendid would be a local variable or a method call, so yeah, if there wasn't one it would be an error.
yxhuvud has quit [Ping timeout: 265 seconds]
hsbt_away is now known as hsbt
<profx_>
i thought it was a value, being assigned to a hash (key,value)
<profx_>
but if it was, then it would be enclosed in ""
<Spooner>
The : used as a prefix is a symbol, yes (though also as a postfix in certain circumstances, such as in a hash { frog: 12 } then the key, :frog, is a Symbol.
<Spaceghostc2c>
profx_: "Waffle": "sauce"
<profx_>
and the key (string) would point to the value (string)
daniel_- has quit [Quit: WeeChat 0.3.9]
<profx_>
you meant { :frog 12 } ?
<Spaceghostc2c>
Nope.
ph^ has quit [Remote host closed the connection]
<Spaceghostc2c>
frog: 12
<Spaceghostc2c>
profx_: You should really get a book on this.
<Spooner>
profx_: { frog: 12 } is shorthand for { :frog => 12 }
<Spaceghostc2c>
profx_: Have you used any other programming languages?
<profx_>
its not something that contains a value, like a variable
<Spaceghostc2c>
Yes it is.
lggr has joined #ruby
joofsh has quit [Quit: This computer has gone to sleep]
jeffreybaird has quit [Quit: jeffreybaird]
mneorr has quit [Remote host closed the connection]
<profx_>
like a Java constant? (symbol)
<Spooner>
Nope.
workmad3 has joined #ruby
mneorr has joined #ruby
<profx_>
CONSTANT is immutable
<profx_>
i guess thats were im thinking they are similar
jeffreybaird has joined #ruby
<Spooner>
It is and it isn't. The value in CONSTANT can't be changed (though strictly, in Ruby, you can change it but you get a warning), but the object can be altered. That is: CONSTANT = "fish"; CONSTANT << " paste"; CONSTANT = 3 # The second statement is fine, the last isn't.
<Spooner>
A symbol is a value, like a string or a number, not a type of variable.
lggr has quit [Ping timeout: 256 seconds]
<profx_>
oh
<profx_>
ok
<Spooner>
It just can't be changed. s = "fish"; s << "paste" is OK (makes s == "fishpaste", but :fish can't be appended to like that. As said, you probably want a tutorial not a lecture here :$
cardoni has quit [Ping timeout: 246 seconds]
vitor-br has joined #ruby
<Spaceghostc2c>
profx_: Mmm, no.
<Spaceghostc2c>
symbols are mutable.
<Spaceghostc2c>
Constants aren't.
lggr has joined #ruby
<Spooner>
Spaceghostc2c: No, symbols are not mutable.
ph^ has joined #ruby
ph^ has quit [Remote host closed the connection]
<waxjar>
I think of Symbols as immutable, singleton Strings
<Spaceghostc2c>
Oh gotcha.
<Spooner>
But there is a difference between a mutable variable and a mutable object.
<Spaceghostc2c>
Yeah.
irleif has quit [Quit: Computer has gone to sleep.]
jeffreybaird has quit [Quit: jeffreybaird]
<Spaceghostc2c>
Spooner: thanks, almost imparted bad info.
tchebb has quit [Ping timeout: 240 seconds]
pjb1 has quit [Quit: pjb1]
workmad3 has quit [Read error: Operation timed out]
pjb1 has joined #ruby
<Spooner>
waxjar : Although a reasonable way to look at it, not sure that is useful to newbies ;)
headius has quit [Quit: headius]
reset has joined #ruby
ph^ has joined #ruby
<waxjar>
true, tho it might be useful for people that are familiar with other languagues
hsbt is now known as hsbt_away
<Spooner>
Spaceghostc2c : Meh, imparting bad info is part and parcel of being in #ruby. I do it every day and did less than an hour ago.
<Spaceghostc2c>
:D
<Spaceghostc2c>
Spooner: <3
healpay has joined #ruby
meskyanichi has joined #ruby
workmad3 has joined #ruby
Beoran__ has joined #ruby
axl_ has quit [Read error: Connection reset by peer]
x82_nicole has quit [Ping timeout: 276 seconds]
axl_ has joined #ruby
lggr has quit [Ping timeout: 246 seconds]
stw1 has quit [Quit: Leaving.]
Takehiro has quit [Remote host closed the connection]
anderse has quit [Quit: anderse]
daniel_- has joined #ruby
Russell^^ has quit [Quit: Russell^^]
Beoran_ has quit [Ping timeout: 246 seconds]
mohits has joined #ruby
Synthead has joined #ruby
lggr has joined #ruby
JonnieCache has joined #ruby
<Synthead>
in python, I can do something like print('You entered "%s".' % variable). Can I do something like this with ruby?
awestroke has quit [Remote host closed the connection]
<Synthead>
and not just for printing strings, for strings in general
<workmad3>
Synthead: p 'you entered "%s".' % "foo"
<Spooner>
Synthead : In fact, that is legal Ruby as well ;)
headius has joined #ruby
<workmad3>
oh yeah, ruby has 'print' along with 'p' and 'puts' :)
<pnbeast>
And a printf, too, no?
<Synthead>
workmad3, Spooner: puts 'That is %s, thanks!' % 'great'
<workmad3>
pnbeast: yeah, and an sprintf, iirc :)
<workmad3>
there's lots of ways to print crap in ruby... hard to remember them all :P
<heftig>
'%<b>02d %<a>02d' % {a:3, b:4}
<Spooner>
Now we need to find out if % used like that is Python STEALING from Ruby or Ruby being inspired by Python (I shall boycott!)!
<yaymukund>
class_eval v. define_method. Is there one that's generally preferred, or is this still a debatable/stylistic thing?
<Spaceghostc2c>
Synthead: printf
montyboy has joined #ruby
<Spaceghostc2c>
It's there.
<heftig>
yaymukund: you mean class_eval with def?
<Spooner>
yaymukund : Use define_method if you can. Eval is to be avoided on pain of death.
<workmad3>
Spooner: don't know
<yaymukund>
heftig: yes, exactly
<Spaceghostc2c>
yaymukund: One would prefer the lesser of two evals.
<heftig>
Spooner: class_eval can also take a block
joeycarmello has joined #ruby
<workmad3>
Spooner: however, if ruby didn't have it, you could easily implement % formatting yourself in ruby :)
ph^ has quit [Remote host closed the connection]
<heftig>
yaymukund: def isn't a closure, so it doesn't capture local variables
<heftig>
yaymukund: saves on memory if you don't need them
<Spooner>
heftig : True, but then you'd just be using define_method in it anyway.
elico has joined #ruby
<heftig>
Spooner: no, you can use def
lggr has quit [Ping timeout: 260 seconds]
joeycarmello has quit [Read error: Connection timed out]
clj_newb has joined #ruby
<Spooner>
Oh right, sorry. See, bad advice again! My record is not tarnished!
joeycarmello has joined #ruby
<yaymukund>
hmm I'm gonna go with debatable :p I should read some more then.
ph^_ has joined #ruby
<Spooner>
yaymukund : Probably doesn't make a huge difference then. I was only arguing against using text eval compared to non-dynamic code.
ph^_ has quit [Read error: Connection reset by peer]
<workmad3>
yaymukund: they work slightly differently, basically
ph^ has joined #ruby
lggr has joined #ruby
ph^ has quit [Remote host closed the connection]
<workmad3>
yaymukund: and have different performance characteristics (like the closure/non-closure that heftig mentioned)
Morkel has quit [Quit: Morkel]
<yaymukund>
yup, I'm going metaprogramming for the first time so I probably want to know the subtleties and performance...what you said :p
<workmad3>
yaymukund: you can also do 'def some_obj.some_method' to define a method on a specific object
ph^ has joined #ruby
ph^ has quit [Read error: Connection reset by peer]
<yaymukund>
workmad3: huh, never seen that one before.
<yaymukund>
oh but it's on that specific instance
ph^ has joined #ruby
<workmad3>
yaymukund: yeah, it's a syntax for defining methods on the singleton class of an object
<Spooner>
yaymukund : You probably have seen it: def self.frog (which adds the method on the class, which is self there).
<workmad3>
yaymukund: and I bet you have seen it ^^
cantonic has quit [Quit: cantonic]
<yaymukund>
hah, nifty
jeffreybaird has joined #ruby
ph^ has quit [Remote host closed the connection]
joeycarmello has quit [Ping timeout: 246 seconds]
tchebb has joined #ruby
<yaymukund>
is it like define_singleton_method in ruby 1.9?
swarley has quit [Ping timeout: 240 seconds]
<workmad3>
yaymukund: except that it doesn't create a closure
<yaymukund>
oh gotcha
<yaymukund>
def is to define_method as def self.method is to define_singleton_method
<yaymukund>
roughly
<workmad3>
yaymukund: roughly :)
ph^ has joined #ruby
ph^ has quit [Remote host closed the connection]
lggr has quit [Ping timeout: 240 seconds]
joofsh has joined #ruby
ph^ has joined #ruby
cantonic has joined #ruby
elico has quit [Quit: elico]
ph^ has quit [Remote host closed the connection]
daniel_- has quit [Quit: WeeChat 0.3.9]
lggr has joined #ruby
ph^ has joined #ruby
ph^ has quit [Remote host closed the connection]
daniel_- has joined #ruby
daniel_- has joined #ruby
daniel_- has quit [Changing host]
v0n has quit [Quit: Leaving]
xcvd`` has quit [Quit: Leaving]
[Neurotic] has joined #ruby
ph^ has joined #ruby
jeffreybaird has quit [Quit: jeffreybaird]
workmad3 has quit [Ping timeout: 246 seconds]
wedtm is now known as wedtm|away
emergion has joined #ruby
yaymukund has quit [Ping timeout: 245 seconds]
bttf has joined #ruby
uris_ has joined #ruby
lggr has quit [Ping timeout: 248 seconds]
elico has joined #ruby
emergion has quit [Client Quit]
<bttf>
so i installed rvm using sudo to do a system-wide installation of 1.9.3; i set it as the default ruby version ... now when i try to run my rails application on apache, i get errors from routines getting ran from my ruby1.8 installation, what gives?
bradhe has joined #ruby
Takehiro has joined #ruby
ph^ has quit [Remote host closed the connection]
<pnbeast>
bttf: Are you using a Linux distribution? Did you step outside the package management system of that distribution for your 1.9.3 install?
<bttf>
yes im using debian squeeze and yes i did
ph^ has joined #ruby
lggr has joined #ruby
<bttf>
i dl'ed rvm using curl
<bttf>
debian squeeze repo
<bttf>
repo's did not have ruby1.9.3 available ...
ph^ has quit [Remote host closed the connection]
<pnbeast>
bttf: I don't have a good solution for you, but this is a large part of why package management systems exist. Maybe you can re-install the system version of Ruby to at least get that back - dunno.
ebobby has joined #ruby
bradhe_ has joined #ruby
ph^ has joined #ruby
<bttf>
pnbeast: ruby1.9.3 is required to use the latest rails
ebobby is now known as Guest23298
<bttf>
i guess you have a point though
alanp has quit [Ping timeout: 255 seconds]
ph^ has quit [Read error: Connection reset by peer]
Virunga has quit [Remote host closed the connection]
<bttf>
i guess i will have to install an older version of redmine/ruby/rails that will be compatiable with this linux distro
alanp has joined #ruby
bradhe has quit [Read error: Connection reset by peer]
ph^ has joined #ruby
ph^ has quit [Remote host closed the connection]
ph^ has joined #ruby
Guest23298 has quit [Client Quit]
lggr has quit [Ping timeout: 244 seconds]
mneorr has quit [Remote host closed the connection]
hsbt_away is now known as hsbt
nemesit has quit [Quit: Leaving...]
Averna has joined #ruby
lggr has joined #ruby
wpaulson has joined #ruby
ph^ has quit [Ping timeout: 255 seconds]
ngoldman has quit [Remote host closed the connection]
<Spooner>
bttf : Well, you could still try installing in the home dir, not system, with RVM. Or use rbenv and rbenv_install.
chichou_ has quit [Remote host closed the connection]
lggr has joined #ruby
bttf has quit [Quit: Lost terminal]
justinmcp has joined #ruby
cantonic_ has joined #ruby
chichou has joined #ruby
dangerousdave has quit [Quit: Leaving...]
locriani has joined #ruby
cantonic has quit [Ping timeout: 246 seconds]
cantonic_ is now known as cantonic
healpay has quit [Ping timeout: 246 seconds]
hsbt is now known as hsbt_away
lggr has quit [Ping timeout: 255 seconds]
hotovson has quit [Remote host closed the connection]
bradhe_ has quit [Remote host closed the connection]
kevinw has quit [Read error: Connection reset by peer]
andrewhl has joined #ruby
quest88 has joined #ruby
vlad_starkov has joined #ruby
bradhe has joined #ruby
saschagehlich has quit [Quit: saschagehlich]
lggr has joined #ruby
Takehiro has quit [Remote host closed the connection]
pjb1 has quit [Quit: pjb1]
mercwithamouth has joined #ruby
vlad_starkov has quit [Read error: No route to host]
icole has joined #ruby
postmodern has joined #ruby
frogprince_mac has quit [Quit: Leaving...]
lggr has quit [Ping timeout: 240 seconds]
<rking>
Hrm. Anyone know of an example gem that has a conditional dependency on another gem, depending on OS?
icole has quit [Ping timeout: 255 seconds]
lggr has joined #ruby
NiteRain has quit [Ping timeout: 246 seconds]
nignaztic has quit [Ping timeout: 265 seconds]
akafurious has joined #ruby
alanp_ has joined #ruby
alanp_ has quit [Read error: Connection reset by peer]
alanp has quit [Read error: Connection reset by peer]
alanp has joined #ruby
workmad3 has joined #ruby
pac1 has quit [Quit: I got it one line of code at a time]
JonnieCache has quit [Ping timeout: 246 seconds]
yaymukund has joined #ruby
lggr has quit [Ping timeout: 246 seconds]
justinmcp has quit [Remote host closed the connection]
whowantstolivefo has quit [Quit: quit]
pac1 has joined #ruby
booyakah has quit [Ping timeout: 246 seconds]
lggr has joined #ruby
booyakah has joined #ruby
Liquid_X has quit [Ping timeout: 260 seconds]
rburton- has joined #ruby
xaq has joined #ruby
kaawee has joined #ruby
alanp_ has joined #ruby
alanp has quit [Read error: Connection reset by peer]
nignaztic has joined #ruby
reset has quit [Quit: Leaving...]
Liquid_X has joined #ruby
lggr has quit [Ping timeout: 260 seconds]
headius has quit [Quit: headius]
thmzlt has joined #ruby
lggr has joined #ruby
nyrb has joined #ruby
<ryanf>
you can release different gems tagged by os, right?
<ryanf>
I mean, different copies of the same gem
<Spaceghostc2c>
Yeah. Or you can release one gem with the ability to work on all platforms with different code.
melzz has joined #ruby
nyrb has quit [Remote host closed the connection]
levabalkin has joined #ruby
<ryanf>
Spaceghostc2c: yeah, in this case I think the issue isn't with the gem's own code, but with needing to depend on different other gems depending on what platform you're on
ZenGuy311 has joined #ruby
<ryanf>
it seems like in practice people usually just make it an undeclared dependency
Takehiro has joined #ruby
josh^ has joined #ruby
<profx_>
how can I do to: something.type and have hash returned ?
nari_ has joined #ruby
timonv has quit [Remote host closed the connection]
Nisstyre has quit [Ping timeout: 256 seconds]
kaawee has quit [Ping timeout: 245 seconds]
lggr has quit [Ping timeout: 244 seconds]
bradhe has quit [Remote host closed the connection]
<rking>
ryanf: But if I do that, it won't pull it in for the non-stupid OSs, right?
<rking>
(The non-declared dep)
tommyvyo has quit [Quit: Computer has gone to sleep.]
<peterhellberg>
There are some room for improvement when it comes to the .gemspec format
jamjam has quit [Ping timeout: 246 seconds]
hsbt_away is now known as hsbt
<rking>
peterhellberg: That just says "use Bundler", basically.
Takehiro has quit [Ping timeout: 276 seconds]
<peterhellberg>
Yeah, unfortunately
tommyvyo has quit [Client Quit]
<peterhellberg>
net-ssh is having this issue (having a jRuby-specific dependency in the main .gemspec isn’t that great)
nignaztic has quit [Ping timeout: 240 seconds]
TheFuzzball has joined #ruby
<rking>
Which, the thing about that is that it's not even right: when you use Bundler it'll calculate the Gemfile.lock from whatever machine runs it
kaawee has joined #ruby
xaq_ has joined #ruby
<peterhellberg>
bson has a separate .java.gemspec for jRuby
hbpoison has quit [Ping timeout: 245 seconds]
<rking>
What I'm doing to solve that is make a bundler/ dir that ends up getting Gemfile.lock.osx and Gemfile.lock.lnx, then having the devs symlink to whichever one is appropriate, then just let the other OS people know if it's time to redo the "bundle update".
<rking>
I'd rather do that then push OS-specific gems.
r0bby has joined #ruby
<rking>
ryanf: Guard should do that for rb-inotify + rb-fsevent.
icole has joined #ruby
lggr has quit [Ping timeout: 256 seconds]
<ryanf>
I can't picture that working well with bundler at all
<rking>
Bundler is its own problem.
r0bby has quit [Read error: Connection reset by peer]
whowantstolivefo has quit [Client Quit]
<ryanf>
releasing a gem that doesn't work in a bundler context is kind of your problem
<ryanf>
since almost everyone uses it
dagnachewa has joined #ruby
<rking>
(Specifically: It'd be nice to add platform-specific checks to Gemfile.lock, but the way it's implemented, bundler would blow up if you tried to extend new language onto the Gemfile.lock itself)
r0bby has joined #ruby
r0bby has quit [Remote host closed the connection]
<rking>
Nono, it's not that it wouldn't work for Bundler.
<ryanf>
it seems like it wouldn't. if you don't declare the dependency in-band, bundler won't let you load it, right?
<rking>
It's just that you'd still have to solve the problem of platform-specific Gemfile.lock stuff, which I think the bundler/Gemfile.lock.{osx,lnx,win} solution is Ok ish.
<rking>
Ahh crap you're right.
Takehiro has joined #ruby
<ryanf>
doesn't rubygems have the concept of platform-specific gems though?
<rking>
I think so
<ryanf>
it definitely has something like that, but I can't find much evidence or information about it online
<peterhellberg>
Yes, it is perfectly fine to release separate gems for separate platforms
moshee has quit [Ping timeout: 246 seconds]
<Spaceghostc2c>
Yeah, but you don't have to. :D
lggr has joined #ruby
moshee has joined #ruby
moshee has quit [Changing host]
moshee has joined #ruby
<peterhellberg>
It works just fine, and you get the correct version for your platform on "gem install"
vlad_starkov has joined #ruby
<rking>
You just set the #platform = 'whatever' then it "gem build"s for that platform, then you can push that alongside your os-unspecific one?
<ryanf>
that sounds like the best approach, as long as it lets you have different deps for the different platforms
ph^ has joined #ruby
<peterhellberg>
Probably not a good example though, since Apple has stopped putting Sudden Motion Sensors in their laptops :)
whowantstolivefo has quit [Client Quit]
zii has quit [Read error: Connection reset by peer]
<rking>
peterhellberg: So you're using Gem::Platform::CURRENT, meaning you manually gem build && push from each platform?
<rking>
ryanf: Actually, yeah. There's no reason Guard can't do this.
<rking>
ryanf: Though, wait
<rking>
The thing with guard is that not everbody has libinotify/libfsevent or whatever as a dep.
<rking>
OK, I gotit.
<peterhellberg>
Kinetosis is a highly OSX specific gem, so that is why I was using Gem::Platform::CURRENT
Takehiro has quit [Ping timeout: 276 seconds]
<rking>
Make a 3rd gem, fsnotifyevent, that does the platform-specific uploads.
<rking>
Then Guard could have guard-fsnotifyevent as its optional dep.
vlad_starkov has quit [Ping timeout: 252 seconds]
<rking>
peterhellberg: Right. But one could imagine a build process that looped through, setting that to something else, then pushing each of those .gem's, no?
<ryanf>
yeah, that sounds reasonable. it could mess up people's Gemfile.locks, but that problem already exists with the current guard approach
<ryanf>
basically this whole thing is a huge mess
<peterhellberg>
rking: Sure thing
<peterhellberg>
Well, time for bed now. Good luck :)
lggr has quit [Ping timeout: 252 seconds]
xaq has joined #ruby
bradhe has quit [Remote host closed the connection]
<peterhellberg>
I wrote my own wrapper for rb-fsevent recently, just to have _something_ that would work under Mountain Lion… kicker and guard was quite unstable for me, but that might have changed in the last couple of weeks
conor_ireland has joined #ruby
<rking>
ryanf: How would it mess up their Gemfile.lock's?
lggr has joined #ruby
conor_ireland has quit [Client Quit]
bitri has quit [Quit: Computer has gone to sleep.]
manizzle has joined #ruby
ph^ has quit [Ping timeout: 245 seconds]
tommyvyo has joined #ruby
sambio has joined #ruby
<ryanf>
if you have a project that multiple people are working on, and you're tracking your .lock, it will flip back and forth when people bundle install on different platforms, right?
<ryanf>
but honestly I have no idea how to solve that problem with guard and the notify gems as it is
<tommylommykins>
hmm
<tommylommykins>
is there a shorthand for the block {|thing| thing}?
<ryanf>
no
<tommylommykins>
D:
<ryanf>
{|o|o} :)
<rking>
ryanf: But it won't.
thmzlt has quit [Remote host closed the connection]
justinmcp has quit [Remote host closed the connection]
<tommylommykins>
hmm
<tommylommykins>
actually, maybe I could just remove the block and use the enumerator returned in this case \0/
<rking>
ryanf: E.g. pry could stop doing the conditional gem 'rb-inotify' thing and just depend on 'rb-fseventinotify' only.
<ryanf>
rking: why not? won't the bit where it says the dependencies of fsnotifyevent change?
bier has quit [Ping timeout: 265 seconds]
<ryanf>
yeah, but the .lock includes versions of dependencies-of-dependencies too
<ryanf>
it's fine for pry because we're a library and therefore don't track our .lock
<ryanf>
but for applications it would still suck
vlad_sta_ has quit [Remote host closed the connection]
<peterhellberg>
tommylommykins: It is unfortunate that anaphora isn’t natively supported in Ruby, but this discussion comes up once in a while :)
lggr has quit [Ping timeout: 246 seconds]
<ryanf>
but yes, i agree that would be a nice way to handle it in situations where you don't have to track the lock file
<rking>
ryanf: Does the .lock include the platform name?
<ryanf>
I don't know
steffes has quit [Remote host closed the connection]
<ryanf>
but even if it doesn't, the bit specifying the version of rb-inotify or whatever would still be changing
<rking>
No
<rking>
Pry wouldn't mention rb-inotify anywhere.
<ryanf>
it doesn't matter if pry does. I'm talking about the Gemfile.lock of the end user
<rking>
It wouldn't either.
<ryanf>
even if the user doesn't explicitly type "rb-inotify" anywhere, the lock is a complete list of every single dependency, dependency-of-dependency, etc
<ryanf>
which will necessarily include the platform-specific notification gem
<rking>
I'm proposing a new, tiny gem that only does one thing: its gemspec is platform-specific to depend on rb-inotify or rb-fsevent
<ryanf>
I understand that
<ryanf>
but the lock will still specify the version of whatever gem that gem is depending on
<rking>
Riiight.
<rking>
Doggonnit.
<ryanf>
it's basically not a solvable problem without having some more granular way of specifying which deps the lock file should care about
<ryanf>
or not tracking the lock, but that would be really painful for other reasons
lggr has joined #ruby
nari_ has joined #ruby
<rking>
OK, then this goes back to my original thought on this one.
<rking>
Is that rb-fseventify should just compile different C stuff.
<ryanf>
yeah, I just realized that while I was afk :)
<rking>
In general I find it a bit annoying that there's not such a thing as POSIX+ that defines a common API to solve things like inotify vs. fsevent, but there's no reason we can't handle that at a different language level.
<ryanf>
if you just vendor all three notification gems into one and conditionally compile/load the right one, you're good
<rking>
I just didn't want to propose that because it would be my first extconf.rb if they say, "OK cool. Pull req it."
adam_ has joined #ruby
<rking>
All 3? 3rd == poll implementation?
<ryanf>
oh, I thought there was one for windows too
<ryanf>
all 2 then
Foxandxss has joined #ruby
<rking>
Maybe.
<ryanf>
plus a no-op for systems that don't support inotify or fsevent
xaq has quit [Remote host closed the connection]
<ryanf>
and implementations that aren't compatible with those gems, etc
ForevernadeAFK is now known as Forevernade
<rking>
I have to chug four energy drinks back-to-back to care what happens on Windows.
<rking>
Yeah, the no-op being its existing polling stuff.
<ryanf>
the polling implementation doesn't have to live in that gem, but you still need to make other systems not mind installing the useless gem for this to work properly
<ryanf>
yeah
<ryanf>
whatever
<ryanf>
I guess for the gem to be useful outside guard, it might as well have the polling fallback built in
<rking>
Right
<rking>
I was thinking of putting the extconf in guard itself, but then it loses that "outside of guard" factor.
lggr has quit [Ping timeout: 248 seconds]
<ryanf>
yeah you probably don't want to bloat up the guard repo with two different platform-specific c extensions
wargasm has quit [Read error: Connection reset by peer]
wargasm has joined #ruby
<rking>
Hehe, the bloat aspect isn't even a concern for me.
<rking>
You still have to download the code.
cakehero has joined #ruby
lggr has joined #ruby
<rking>
And as epitron is quick to point out, breaking things into sub-gems, though appealing because of DRY and proper organization, ends up having a big performance hit due to rubygems stuffing $LOAD_PATH full.
<ryanf>
yeah
<rking>
ryanf: Thanks for talking this through. I was going to file a much dumber Guard issue.
<ryanf>
no problem
bier has joined #ruby
<ryanf>
that jruby bug turned out not to be our fault btw
<ryanf>
how are your 1.8 problems?
peterhellberg has quit [Remote host closed the connection]
jjang has joined #ruby
lkba has quit [Ping timeout: 276 seconds]
lggr has quit [Ping timeout: 240 seconds]
<rking>
Haven't looked yet.
tbbach has joined #ruby
<rking>
And the kids are back so my session is ending. ☺
Guest84060 has joined #ruby
hbpoison has joined #ruby
mohits has quit [Read error: Connection reset by peer]
lggr has joined #ruby
tbbach has quit [Quit: Bye]
adeponte has quit [Ping timeout: 244 seconds]
hbpoison has quit [Ping timeout: 246 seconds]
Guest84060 has quit []
somazero has quit [Ping timeout: 245 seconds]
<Synthead>
is there a way I can make dynamic URLs for doing GET requests?
<Synthead>
without doing it by hand?
<Spaceghostc2c>
'dynamic urls'?
reuf has joined #ruby
lggr has quit [Ping timeout: 245 seconds]
fantazo has quit [Read error: Operation timed out]