<friskd>
One of the main problems i'm having w/ OpenUri is that it does doc exceptions, and it doesn't seem to handle 302 redirects that happen inside a meta tag..
wpaulson has joined #ruby
<friskd>
Have you all come across a better drop in replacement.
<aces1up>
I have a threading question, I have a class that has a class instance variable called @lookup.. Each thread only accesses its corresponding key in lookup, so do I need to protext access to @lookup for thread saftey in this case?
<pnbeast>
friskd: I'm sorry - I'm not competent to even consider helping you with open-uri. Maybe someone else.
advorak has joined #ruby
noyb has joined #ruby
<waxjar>
if you're dealing with some kind of 3rd party API, look at HTTParty
<friskd>
ok tnx pnbeast
JonnieCache has joined #ruby
lggr has quit [Ping timeout: 245 seconds]
chrisramon has joined #ruby
tpe11etier has joined #ruby
lggr has joined #ruby
<friskd>
When an exception is thrown and i have 'e' that i can access
wpaulson has quit [Ping timeout: 240 seconds]
<friskd>
How can i see what members of that object are available?
montyboy has joined #ruby
ph^ has joined #ruby
noyb has quit [Ping timeout: 245 seconds]
tjbiddle has joined #ruby
montyboy has quit [Client Quit]
noyb has joined #ruby
nignaztic has joined #ruby
artnez has quit [Quit: artnez]
Yomero has quit [Ping timeout: 260 seconds]
advorak has quit [Quit: This computer has gone to sleep]
somazero has joined #ruby
<friskd>
A ha! instance_variables
<friskd>
puts e.instance_variables
lggr has quit [Ping timeout: 245 seconds]
lggr has joined #ruby
irleif has quit [Quit: Computer has gone to sleep.]
seich has quit [Ping timeout: 260 seconds]
FifthWall has quit [Quit: Goodbye everyone]
slainer68 has joined #ruby
irleif has joined #ruby
lggr has quit [Ping timeout: 260 seconds]
ph^ has quit [Ping timeout: 245 seconds]
lggr has joined #ruby
chrisramon has quit [Ping timeout: 245 seconds]
seich- has joined #ruby
Vert has joined #ruby
dagnachewa has quit [Remote host closed the connection]
<Synthead>
how can I download the content of something from a URL into a variable?
slainer68 has quit [Ping timeout: 276 seconds]
<friskd>
Is there a quick function to see if an object has an attribute defined?
<friskd>
like if o.has_attribute
<Synthead>
ah, I think I got it
bradhe has quit [Ping timeout: 256 seconds]
<waxjar>
friskd, do you mean instance variables?
dagnachewa has joined #ruby
<friskd>
Yes.
<waxjar>
if so: #respond_to?
<friskd>
googling respond_to
lggr has joined #ruby
<friskd>
worked like a charm.
<friskd>
tnx waxjar
<waxjar>
:)
dagnachewa has quit [Remote host closed the connection]
irleif has quit [Quit: Computer has gone to sleep.]
lggr has quit [Ping timeout: 255 seconds]
g-ram has joined #ruby
yshh has quit [Remote host closed the connection]
xorgnak has joined #ruby
lggr has joined #ruby
shadewind has joined #ruby
kieppie has joined #ruby
<shadewind>
is it common to avoid the weird Perl-like global variables? for example, do people usually use the MatchData object returned by Regexp.match instead of the associated global variables?
<kieppie>
hi guys.
xorgnak has quit [Remote host closed the connection]
<Spooner>
shadewind : People use both. I tend to just use $magics though, although they always make me feel dirty.
g-ram has quit [Quit: Computer has gone to sleep.]
<ryanf>
yeah, it varies
gabrielrotbart has quit [Remote host closed the connection]
<ryanf>
personally I almost always use the $ vars
lggr has quit [Ping timeout: 240 seconds]
<shadewind>
can people read other peoples ruby code?
<ryanf>
yes
<shadewind>
;)
g-ram has joined #ruby
<kieppie>
I'm *totally* ignorant re Ruby/RoR, and have fired up a BitNami instance of a Redmine in a VM, to keep thing simple. I want to install a plugin, but it requires RoR 1.9.3 & I'm running RoR 1.8.7 . what do I do to be able to run with current stable releases all round?
<shadewind>
there are many ways to do things in Ruby, it seems
rTypo has quit [Quit: WeeChat 0.3.9]
<ryanf>
kieppie: you're talking about the version of ruby, not the version of rails, fyi
<ryanf>
shadewind: yep
<shadewind>
I guess I'll simply do what makes sense to me and completely ignore any notions of best practices
<kieppie>
ryanf - it's all greek to me. it's ion a debian, so wished it was as simple as apt-get install, but there seems to be a lot more to it than just that
<ryanf>
one tilts to the left!
<Spooner>
I can tell them apart fine, ryanf, but beyond that....
<ryanf>
kieppie: sorry, I really have no idea what the best approach is given that you're using a pre-packaged vm
<ryanf>
under normal circumstances, the standard recommendation would probably be for you to use rvm to install ruby 1.9.3
<shadewind>
that's always what I find to be the trickiest when learning a new language, finding out what is considered "good practice"
axl_ has quit [Quit: axl_]
<shadewind>
or rather, learning the idiomatic way to do things
<shadewind>
not just pick a random one
<ryanf>
shadewind: there are various ruby style guides that are mostly a pretty accurate reflection of what people do in real life
xorgnak has quit [Remote host closed the connection]
yshh has joined #ruby
xorgnak has joined #ruby
<shadewind>
$` and $'... you gotta be kidding me :)
<Spooner>
If you animate them, it looks like the dollar is waving at you, shadewind
<shadewind>
Spooner: it suddenly seems like a brilliant naming convention
lggr has joined #ruby
hoofman has joined #ruby
<Spooner>
shadewind : I actually use $1..9 a lot, but I generally start thinking I should be using matchdata if I need to use the other crap.
<profx_>
so parameters in a def initialize are comma separated, but when you call it, they need to be separated by spaces (not commas) ?
<Spooner>
Mainly because I can remember what $1 actually represents.
<Spooner>
profx_ : No, it is just the same on the call.
<profx_>
hmmm
<profx_>
im trying the trybury.org site
<Synthead>
they're all just identifiers ... I mean, who came up with '#' for root?
axl_ has joined #ruby
<profx_>
and having issues when I get to classes
artnez has joined #ruby
Takehiro has joined #ruby
zeromodu_ has joined #ruby
<Spooner>
However, you can omit the parens. def frog(x, y) can be called with x.frog 1, 2
<profx_>
ah
zeromodulus has quit [Ping timeout: 246 seconds]
hoofman has quit [Read error: Connection reset by peer]
gabrielrotbart has joined #ruby
atmosx has joined #ruby
dax has joined #ruby
adam_ is now known as stantona
lggr has quit [Ping timeout: 265 seconds]
monkegjinni has joined #ruby
seoaqua has joined #ruby
lggr has joined #ruby
Azure has quit [Ping timeout: 245 seconds]
Takehiro has quit [Ping timeout: 248 seconds]
Azure has joined #ruby
IrishGringo has joined #ruby
ryanlecompte has joined #ruby
ph^ has quit [Ping timeout: 260 seconds]
noyb has quit [Ping timeout: 245 seconds]
zeromodu_ has quit [Ping timeout: 245 seconds]
akem has quit [Read error: Connection reset by peer]
akem has joined #ruby
lggr has quit [Ping timeout: 248 seconds]
<Synthead>
can I do puts `bsdtar xvf %s` % file ?
zeromodulus has joined #ruby
lggr has joined #ruby
cakehero has quit [Quit: Computer has gone to sleep.]
ejnahc has quit [Remote host closed the connection]
adeponte has quit [Remote host closed the connection]
ejnahc has joined #ruby
baroquebobcat has joined #ruby
cakehero has joined #ruby
lggr has quit [Ping timeout: 244 seconds]
nilg has quit [Ping timeout: 248 seconds]
<Spooner>
Synthead Why don't you try it in irb/pry?
<Synthead>
Spooner: it doesn't work
<Spooner>
However, in Ruby, it is usual to: puts `bsdtar xvf #{file}`
lggr has joined #ruby
<Spooner>
You only really want to use printf-y stuff when you want formatting.
<Spooner>
Synthead : Yeah, I'd guess that the backticks would run before the string was passed through %, so you'd be replacing on the output, not the input.
<Synthead>
Spooner: ooh, good catch
postmodern has quit [Ping timeout: 246 seconds]
<Spooner>
Synthead : Really, using #{} interpolation is a lot nicer than using printf unless you want formatting. And you can use #@frog for ivars, which is even nicer.
lggr has quit [Ping timeout: 240 seconds]
gabrielrotbart has quit [Remote host closed the connection]
moshee has quit [Ping timeout: 255 seconds]
moshee has joined #ruby
moshee has quit [Changing host]
moshee has joined #ruby
lggr has joined #ruby
seoaqua has quit [Ping timeout: 272 seconds]
ryanlecompte has quit [Remote host closed the connection]
irleif has joined #ruby
stantona has quit [Quit: leaving]
robozahn has quit [Ping timeout: 240 seconds]
reset has quit [Quit: Leaving...]
robozahn has joined #ruby
lggr has quit [Ping timeout: 276 seconds]
ryanlecompte has joined #ruby
lggr has joined #ruby
jeffreybaird has joined #ruby
postmodern has joined #ruby
cakehero has quit [Quit: Computer has gone to sleep.]
<harushimo>
I'm not understanding what to use there
vitoravelino is now known as vitoravelino`afk
jgrevich_ has joined #ruby
ZubKonst_ has quit [Ping timeout: 265 seconds]
jgrevich has quit [Ping timeout: 245 seconds]
jgrevich_ is now known as jgrevich
<harushimo>
any suggestions
<harushimo>
this has been bugging me
<waxjar>
class eval takes a block for an argument, you give it a String
<harushimo>
okay
<harushimo>
I'm trying to get the sample output on the bottome
<waxjar>
sorry, actually you give it nothing, because that's a comment
<harushimo>
right
<harushimo>
I'm working on it
LouisGB has quit []
<waxjar>
is #bar_history supposed to give you a list of previous values?
<harushimo>
%q{def foo = bar end}
Neesan has left #ruby [#ruby]
<harushimo>
yes
<harushimo>
is that right?
<harushimo>
is that what I'm suppose to use for my class eval method
lggr has quit [Ping timeout: 245 seconds]
<waxjar>
i think what you're supposed to do is define a method called attr_name= that sets the value of the attribute or, if it has a value already, add that to the history and replace it
cj3kim has joined #ruby
<waxjar>
you can do that using metaprogramming and that's where class_eval comes in
<Spooner>
waxjar : It is a standard problem. the interwebs are filled with people asking for solutions right now ;)
lggr has joined #ruby
<waxjar>
ah, i'm not familiar with it
<harushimo>
me either
<waxjar>
haha
<Spooner>
harushimo is the 3rd person needing to do it in here this week ;)
rakl has joined #ruby
<harushimo>
really
<harushimo>
I've been working on this for two days
<harushimo>
I'm haven't been able to do dent in ti
cakehero has quit [Quit: Computer has gone to sleep.]
melzz has quit [Remote host closed the connection]
hoofman has joined #ruby
Bosox20051 has quit [Remote host closed the connection]
<harushimo>
it only shows the skeleton code
one8zero has quit [Read error: Operation timed out]
one8zero_ is now known as one8zero
<harushimo>
which I've been modifiying
<Spooner>
If you want a solution, there are about 100 in pasties, but I'm assuming you want to do it yourself ;)
<harushimo>
I want to learn it
<harushimo>
that is why I'm asking the questions
<Spooner>
Yes,I know.
radic has joined #ruby
lggr has quit [Ping timeout: 240 seconds]
<harushimo>
I'm trying to understand what to pass the class eval
<Spooner>
A string, as it clearly asks for.
<waxjar>
google for something like ruby metaprogramming define method or something, there's probably an article that explains it quite well
<harushimo>
I know there is a string
<Spooner>
You are supposed to generate a string which is then evaluated as code.
<Spooner>
And you have to implement the setter method for the attribute in that code.
wedtm|away is now known as wedtm
<harushimo>
ok
lggr has joined #ruby
<harushimo>
def attr_name = foo end
<harushimo>
like that
<profx_>
hey harushimo, im working on this guy as well
radic_ has quit [Ping timeout: 272 seconds]
<profx_>
did you get the other questions, before this one ?
<harushimo>
I finished 4 parts
<harushimo>
I'm on part 5
<profx_>
did you do recursion for the tournament ?
<Spooner>
Where are you? All in the same class or is it a widely used problem?
<harushimo>
yes I did use recursion
<profx_>
Spooner: in a Berkley course
<harushimo>
it worked quite nicely
<profx_>
harushimo: mind if I see what you did ?
<profx_>
i found an answer online, but it made no sense to me, what-so-ever
jenrzzz has joined #ruby
<harushimo>
if you show me, i can guide threw it
<harushimo>
the answer online made sense to me
havenn has joined #ruby
lggr has quit [Ping timeout: 240 seconds]
<profx_>
oh, so yours was probably done simliarly then
<harushimo>
yeah
<profx_>
k, dont worry about it then
<Spooner>
There'll be plenty of answers online. Problem is that if you don't know how to solve it, you don't know which answer isn't crap (even if it is technically right). I remember when people didn't just look everything up online and you had to submit your answer before you could run the acceptance tests on them...*sounds of violins*
<profx_>
i doubt im submitting it
tk___ has joined #ruby
<harushimo>
I've been using zed shaw's book
<harushimo>
too
<harushimo>
good book
cj3kim has quit [Quit: Leaving]
pac1 has quit [Remote host closed the connection]
<harushimo>
I'm not taking this certification. I'm taking it to learn
<profx_>
there a link to it on the resources page ?
<profx_>
harushimo: same here
manizzle has quit [Read error: No route to host]
pnbeast has left #ruby [#ruby]
lggr has joined #ruby
atmosx has quit [Quit: WeeChat 0.3.8]
dagnachewa has joined #ruby
<harushimo>
yeah
<harushimo>
I don't understand class eval method string. I'm trying to understand because when I look at the ruby docs. One of example, you define function inside the eval method
<profx_>
i got really lost on that one too
<profx_>
im trying to understand methods, classes atm
<waxjar>
the string you pass to it is a piece of code that gets evaluated (hence eval) within the scope of a class
<Spooner>
You can do it with a string or with code. It runs the string/code in the context of the class.
<Spooner>
You can, however, use normal string interpolation in an evalled string, so... you can effectively generate a method with a dynamic name.
lggr has quit [Ping timeout: 256 seconds]
<harushimo>
right
<harushimo>
I'm trying to return a list of elements as you saw on my gist
<harushimo>
in order to do that, I would think its from foo
<Spooner>
waxjar : Problem is that they are asked to do it with a string, not a block. If you want to do it with code, then you'd use define_method, not def, so you could name the methods dynamically.
havenn has quit [Ping timeout: 240 seconds]
<profx_>
harushimo: did you mean: Rails Is A Ghetto ?
Guest22757 has quit [Ping timeout: 246 seconds]
<profx_>
or what book ?
<harushimo>
learn ruby the hard way by zed shaw
<harushimo>
good book
<waxjar>
i meant it more as an illustrating to what class_eval does
<harushimo>
I'm seeing that now
<profx_>
thanks harushimo
lggr has joined #ruby
<harushimo>
I used that book before I started this course
<harushimo>
it gave me some exposure
* profx_
wishes he had it a few weeks back
melzz has joined #ruby
Guest22757 has joined #ruby
seoaqua has quit [Ping timeout: 260 seconds]
hbpoison has joined #ruby
wedtm is now known as wedtm|away
rburton- has joined #ruby
dakine has quit [Quit: Leaving]
baroquebobcat has quit [Quit: baroquebobcat]
andrewhl has quit [Remote host closed the connection]
lledet has quit [Quit: lledet]
lggr has quit [Ping timeout: 246 seconds]
manizzle has joined #ruby
ph^ has joined #ruby
<aces1up>
anyone here familiar with capybara or poltergeist? I have a few questions.
pskosinski has quit [Remote host closed the connection]
lggr has joined #ruby
<profx_>
harushimo: what time to we have to pass the assignment in at ? the test ?
<sent-hil>
aces1up: I've used capybara a couple times, not very proficient with it
<profx_>
i think its midnight my local time, but just not sure
<sent-hil>
aces1up: btw, you should just
<harushimo>
its due monday 0ct 15 midnight
<sent-hil>
oops, wrong person
<aces1up>
sent-hil do you know how its sessions work? I'm just including the capybara:dsl into my class. how do multiple sessions work when that happens, and specifically I'm using it with phantom js
jerius has joined #ruby
Vinz_ is now known as Vinz_`
digerati_ has quit [Quit: leaving]
<sent-hil>
aces1up: what's phantomjs
JonnieCache has joined #ruby
<sent-hil>
mvc client framework like backbone?
lggr has quit [Ping timeout: 272 seconds]
<aces1up>
sent-hil headless browser based on qtwebkit
<profx_>
so Symbols are used when you want more (faster) efficient code and you are perhaps reusing the same variable multiple times ?
<aces1up>
used for testing, can run javascript and everything.
hbpoison has quit [Ping timeout: 246 seconds]
lggr has joined #ruby
vlad_starkov has joined #ruby
manizzle has quit [Remote host closed the connection]
mercwithamouth has joined #ruby
<waxjar>
a Symbol is not a variable profx_, it a value. it tends to make programs faster because it's only stored in memory once
xaq has quit [Remote host closed the connection]
<profx_>
the Symbol is stored in a variable, else you couldn't do anything with it
<profx_>
but I understand
<profx_>
also, they cannot be overwritten
<profx_>
but they can be changed ?
<profx_>
puts :hello << :" world" fails
JonnieCache has quit [Ping timeout: 248 seconds]
Tomasso has quit [Ping timeout: 256 seconds]
ph^ has quit [Ping timeout: 272 seconds]
vlad_starkov has quit [Ping timeout: 245 seconds]
<waxjar>
that's because a symbol doesn't have a #<< method
lggr has quit [Ping timeout: 260 seconds]
<profx_>
but can it be changed ?
<Spooner>
You don't overwrite values, you overwrite variables. You need to sort out the difference.
Takehiro has joined #ruby
<profx_>
Spooner: trying to understand it, thats for sure
<profx_>
in here, I see that they cannot be overwritten
<Spooner>
A varaiable is a bucket. A value is something you put in a bucket. A string is water, a symbol is ice ;)
<profx_>
but they are not like a CONSTANT (Java)
<waxjar>
profx_, if you do this: x = "foo"; y = "foo", you made two instances of a String, they're not the same object though they share the same value
<waxjar>
if you do this: x = :foo, y = :foo, you stored the same object in both x and y
<profx_>
nice Spooner
lggr has joined #ruby
<profx_>
waxjar, yep, the same space in memory, x and y just point to the same space
<waxjar>
does that make sense?
<profx_>
yes, but can that value be changed O_o
dethkrieg has quit []
<waxjar>
no
jeffreybaird has quit [Quit: jeffreybaird]
<profx_>
ok, thank you
<waxjar>
you can overwrite x and y of course, as they're just ordinary variables
swarley has quit [Quit: Leaving]
<waxjar>
but you can't turn :x into :y
<profx_>
cannot be overwritten does not make me think: so this can never be changed
miso1337 has quit [Quit: afk]
Takehiro has quit [Ping timeout: 248 seconds]
vitor-br has quit [Remote host closed the connection]
miso1337 has joined #ruby
kyletcarey has quit [Quit: leaving]
chrishunt has quit [Ping timeout: 245 seconds]
kyletcarey has joined #ruby
lggr has quit [Ping timeout: 256 seconds]
kyletcarey has left #ruby [#ruby]
tspike has joined #ruby
manizzle has joined #ruby
Guest22757 has quit [Quit: Konversation terminated!]
Guest22757 has joined #ruby
dagnachewa has quit [Remote host closed the connection]
vitor-br has joined #ruby
jerius has quit [Quit: Computer has gone to sleep.]
lggr has joined #ruby
medik- has joined #ruby
Guest22757 has quit [Ping timeout: 245 seconds]
lggr has quit [Ping timeout: 246 seconds]
blazes816 has quit [Quit: blazes816]
LucidDreamZzZz has quit [Remote host closed the connection]
LucidDreamZzZ has joined #ruby
lggr has joined #ruby
blazes816 has joined #ruby
pwightman has joined #ruby
joeycarmello has joined #ruby
xaq has joined #ruby
freeman_ has joined #ruby
freeman_ has quit [Client Quit]
lggr has quit [Ping timeout: 260 seconds]
freeman_ has joined #ruby
lledet has joined #ruby
freeman_ has quit [Client Quit]
cosmicwoodchuck has joined #ruby
lggr has joined #ruby
bradhe has quit [Remote host closed the connection]
cosmicwoodchuck has left #ruby [#ruby]
sambio has quit []
pwightman has quit [Read error: Connection reset by peer]
pwightman has quit [Read error: Connection reset by peer]
roadt has joined #ruby
pwightman has joined #ruby
lggr has joined #ruby
Spooner has quit [Ping timeout: 248 seconds]
cyong has joined #ruby
Banistergalaxy has joined #ruby
nyrb has quit [Remote host closed the connection]
<ryanf>
aces1up: @lock.synchronize(block) is passing a Proc object as a parameter to synchronize
<ryanf>
so the synchronize method would have to be defined as taking one argument and then calling ".call" on it
<ryanf>
whereas @lock.synchronize(&block) makes block the block argument of synchronize, so that synchronize would have to be defined as taking no normal arguments
mercwithamouth has quit [Ping timeout: 276 seconds]
vlad_starkov has joined #ruby
lggr has quit [Ping timeout: 244 seconds]
pwightman has quit [Read error: Connection reset by peer]
Fandekasp has joined #ruby
lggr has joined #ruby
<aces1up>
can you guard access to a class instance variable so only one thread has access to it at one time without enclosing the code that uses that variable in a sync block?
jerius has joined #ruby
pwightman has joined #ruby
k776 has joined #ruby
<k776>
I'm profiling a rails app using new relic, and I notice 30% of the request time is in GC. How can I decrease that?
vlad_starkov has quit [Ping timeout: 244 seconds]
<ryanf>
aces1up: you could define an accessor that has its own sync block, right?
synthetix has quit [Ping timeout: 245 seconds]
Takehiro has joined #ruby
jerius has quit [Client Quit]
lggr has quit [Ping timeout: 252 seconds]
a_a_g has joined #ruby
ph^ has joined #ruby
jenrzzz has quit [Ping timeout: 276 seconds]
boxy has left #ruby ["Leaving"]
lggr has joined #ruby
Takehiro has quit [Ping timeout: 248 seconds]
<aces1up>
Ryanf I believe thats what I have done.
a_a_g has quit [Client Quit]
<aces1up>
ryanf also I'm having a hard time wrapping my head around when and when I should not have mutex lock on my threads.
a_a_g has joined #ruby
<aces1up>
for instance I have a class instance var that has a @lookup variable with is a Hash.. most the time all the threads that access this hash only use the subkey assigned to them.. so Is it still necessary to use a mutex on this variable?
bradhe has quit [Remote host closed the connection]
lggr has quit [Ping timeout: 246 seconds]
pwightman has quit [Quit: Leaving.]
harushimo has quit [Quit: Leaving]
tspike has quit [Ping timeout: 276 seconds]
lggr has joined #ruby
Bosma has quit [Ping timeout: 260 seconds]
Bosox20051 has joined #ruby
jrajav has quit []
ph^ has quit [Ping timeout: 252 seconds]
xpen has joined #ruby
lggr has quit [Ping timeout: 255 seconds]
sophos has joined #ruby
nyrb has joined #ruby
Banistergalaxy has quit [Ping timeout: 240 seconds]
jenrzzz has joined #ruby
lggr has joined #ruby
<ryanf>
I think hashes are in general not threadsafe, but I am not an expert on ruby concurrency or anything
<ryanf>
but I'd guess that it is
share has joined #ruby
kuzushi has quit [Ping timeout: 246 seconds]
icole has joined #ruby
tspike has joined #ruby
nyrb has quit [Remote host closed the connection]
lggr has quit [Ping timeout: 255 seconds]
jerius has joined #ruby
ForevernadeAFK has joined #ruby
ryanlecompte has quit [Remote host closed the connection]
lggr has joined #ruby
manizzle has quit [Remote host closed the connection]
blazes816 has quit [Quit: blazes816]
yaymukund has joined #ruby
stw has joined #ruby
Forevernade has quit [Ping timeout: 245 seconds]
eldariof has quit [Ping timeout: 240 seconds]
a_a_g has quit [Quit: Leaving.]
lggr has quit [Ping timeout: 248 seconds]
jgrevich has quit [Quit: jgrevich]
Dreamer3 has quit [Ping timeout: 248 seconds]
krz has joined #ruby
lggr has joined #ruby
<sophos>
Hi Friends
<share>
hi there
<sophos>
How are you?
<sophos>
Do you know ruby?
evaryont has quit [Quit: WeeChat 0.3.9]
<share>
shut up
<share>
everybody is sleeping
<profx_>
im not
gabrielrotbart has quit [Read error: Connection reset by peer]
gabrielrotbart has joined #ruby
<share>
even the ops are taking in the ass
<profx_>
2.5 hours till submission deadline
kuzushi has joined #ruby
<sophos>
profx_ are you a musician?
<share>
"kill the pirates!"
<share>
"i cant make money of my garbage songs!"
<sophos>
i bet he is an indie musician too.
<share>
anyone teach music in school?
<sophos>
Indie music is for poor people.
<sophos>
profx_ does.
<share>
yesterday I learned the ruby song
xaq_ has joined #ruby
<sophos>
haha
havenn has joined #ruby
<sophos>
Is it good>
xaq has quit [Read error: Connection reset by peer]
<share>
rubbbbbbbbbby
<share>
worse than C plus plus
one8zero has quit [Quit: one8zero]
<share>
ruuuby even worse than rails
<sophos>
Thats damn nice song.
<share>
even but without sound is not that funny
<sophos>
lol
Dreamer3 has joined #ruby
<share>
ill post it on youtube or something
<sophos>
I wanna buy it, whilst its hot!
lggr has quit [Ping timeout: 252 seconds]
<share>
better use vimeo or WMG will take it down
<sophos>
Ruby might claim copyright.
<share>
yes
<share>
DMCA as censorship
xaq_ has quit [Remote host closed the connection]
<share>
they dont like an old programming language like C to be far superior
jenrzzz has quit [Ping timeout: 245 seconds]
lggr has joined #ruby
havenn has quit [Ping timeout: 245 seconds]
sandGorgon has joined #ruby
sandGorgon has quit [Remote host closed the connection]
ryanlecompte has joined #ruby
ph^ has joined #ruby
kil0byte has quit [Remote host closed the connection]
gabrielrotbart has quit [Read error: Connection reset by peer]
gabrielrotbart has joined #ruby
<share>
!ops
kil0byte has joined #ruby
kil0byte has quit [Remote host closed the connection]
sophos has left #ruby [".."]
lggr has quit [Ping timeout: 276 seconds]
vitor-br has quit [Ping timeout: 245 seconds]
lggr has joined #ruby
jenrzzz has joined #ruby
cyong has quit [Quit: Leaving.]
<profx_>
attr_reader is just a getter ?
<profx_>
and attr_writer is a setter ?
<Spaceghostc2c>
Yes.
<share>
bye
<Spaceghostc2c>
Read some documentation, my friend.
<share>
take care
share has left #ruby [#ruby]
Bosox20051 has quit [Remote host closed the connection]
areil has joined #ruby
tjbiddle has quit [Quit: tjbiddle]
lggr has quit [Ping timeout: 245 seconds]
Vinz_` is now known as Vinz_
himsin has quit [Ping timeout: 240 seconds]
lggr has joined #ruby
ph^ has quit [Ping timeout: 276 seconds]
hbpoison has quit [Ping timeout: 276 seconds]
vlad_starkov has joined #ruby
lggr has quit [Ping timeout: 256 seconds]
SecretAgent has quit [Quit: Changing server]
vlad_starkov has quit [Ping timeout: 245 seconds]
pwightman has joined #ruby
k776 has left #ruby [#ruby]
bradhe has joined #ruby
lggr has joined #ruby
Takehiro has joined #ruby
tspike has quit [Quit: leaving]
yxhuvud has joined #ruby
JonnieCache has joined #ruby
lggr has quit [Ping timeout: 245 seconds]
bradhe has quit [Ping timeout: 260 seconds]
Takehiro has quit [Ping timeout: 248 seconds]
gabrielr_ has joined #ruby
gabrielrotbart has quit [Read error: Connection reset by peer]
Vinz_ is now known as Vinz_`
joeycarmello has quit [Remote host closed the connection]
zeromodulus has quit [Ping timeout: 246 seconds]
lggr has joined #ruby
yaymukund has quit [Quit: leaving]
sj26 has joined #ruby
booyakah has quit [Ping timeout: 265 seconds]
snorkdude has joined #ruby
joofsh has quit [Remote host closed the connection]
lggr has quit [Ping timeout: 252 seconds]
<profx_>
true or false: Array is an instance of Class ?
lggr has joined #ruby
pwightman has quit [Quit: Leaving.]
stw has quit [Quit: Leaving.]
<bnagy>
Array.is_a? Class
<Mon_Ouie>
You can easily try those things in Pry/IRB
<profx_>
is_a? ?
ph^ has joined #ruby
awestroke has joined #ruby
lggr has quit [Ping timeout: 260 seconds]
noyb has joined #ruby
vlad_starkov has joined #ruby
Elhu has joined #ruby
S1kx has quit [Quit: Leaving]
ananthakumaran has joined #ruby
vlad_sta_ has joined #ruby
Elhu has quit [Client Quit]
lggr has joined #ruby
gabrielrotbart has joined #ruby
gabrielr_ has quit [Read error: Connection reset by peer]
vlad_sta_ has quit [Remote host closed the connection]
vlad_starkov has quit [Ping timeout: 246 seconds]
lggr has quit [Ping timeout: 245 seconds]
ph^ has quit [Ping timeout: 245 seconds]
tjbiddle has joined #ruby
bradhe has joined #ruby
seoaqua has joined #ruby
lggr has joined #ruby
ananthakumaran has quit [Quit: Leaving.]
arturaz has joined #ruby
siyusong has joined #ruby
gbaconnier has joined #ruby
tagrudev has joined #ruby
tjbiddle has quit [Client Quit]
yxhuvud has quit [Ping timeout: 252 seconds]
lggr has quit [Ping timeout: 255 seconds]
notsure_ has joined #ruby
<profx_>
what does +$ mean in a regex ?
joeycarmello has joined #ruby
AlbireoX has quit [Remote host closed the connection]
AlbireoX has joined #ruby
<Mon_Ouie>
+ is a quantifier meaning one or more of the thing before it
<reactormonk>
profx_, not much on its own - $ is eol, but + is a modifier
<Mon_Ouie>
$ means "end of line"
Vert has quit [Read error: Connection reset by peer]
brianpWins has joined #ruby
lggr has joined #ruby
<profx_>
so I should expect multiples of the one before followed by an EOL
<profx_>
thanks
<profx_>
and I am confused about ^
<profx_>
so its used to NOT look for the characters ?
<profx_>
[^ ] any single character NOT of set
<profx_>
but what if you have ^[]
<reactormonk>
profx_, beginning of line if outside []
<profx_>
ah, wow
Cache_Money has quit [Ping timeout: 252 seconds]
jenrzzz has quit [Ping timeout: 244 seconds]
<profx_>
thanks, thats helpful
bradhe has quit [Remote host closed the connection]
daniel_hinojosa has quit [Quit: Leaving.]
AlbireoX has quit [Ping timeout: 245 seconds]
notsure_ has quit [Quit: Leaving]
tonini has joined #ruby
lggr has quit [Ping timeout: 252 seconds]
joeycarmello has quit [Ping timeout: 260 seconds]
icole has quit [Remote host closed the connection]
<reactormonk>
profx_, regex are a pita to learn - but incredibly useful once done
lggr has joined #ruby
<profx_>
its like playing guitar for me, I just wish some morning I would awake, and its known
<reactormonk>
I once heard of a lisp macro that converts your (perl) regexp to lisp code
<reactormonk>
and they claim it's faster than perl regexp :-)
hbpoison has joined #ruby
freeayu__ has joined #ruby
lggr has quit [Ping timeout: 246 seconds]
scx has joined #ruby
siyusong has quit [Remote host closed the connection]
freeayu has quit [Ping timeout: 256 seconds]
lggr has joined #ruby
siyusong has joined #ruby
araujo has quit [Quit: Leaving]
manizzle has joined #ruby
ph^ has joined #ruby
ananthakumaran has joined #ruby
hemanth has quit [Read error: Connection reset by peer]
hemanth has joined #ruby
Banistergalaxy has joined #ruby
AndChat| has joined #ruby
lggr has quit [Ping timeout: 252 seconds]
a_a_g has joined #ruby
siyusong has quit [Quit: siyusong]
samuel02 has joined #ruby
Takehiro has joined #ruby
nemesit has joined #ruby
lggr has joined #ruby
answer_42 has joined #ruby
Mon_Ouie has quit [Ping timeout: 246 seconds]
IrishGringo has quit [Read error: Operation timed out]
Banistergalaxy has quit [Ping timeout: 245 seconds]
saschagehlich has joined #ruby
Erfankam has joined #ruby
AndChat- has joined #ruby
Takehiro has quit [Ping timeout: 246 seconds]
lggr has quit [Ping timeout: 245 seconds]
AndChat| has quit [Ping timeout: 245 seconds]
ph^ has quit [Ping timeout: 245 seconds]
Xeago has joined #ruby
Banistergalaxy has joined #ruby
AndChat| has joined #ruby
blazes816 has joined #ruby
lggr has joined #ruby
tjbiddle has joined #ruby
Xeago has quit [Remote host closed the connection]
AndChat- has quit [Ping timeout: 245 seconds]
fridim_ has quit [Ping timeout: 245 seconds]
Banistergalaxy has quit [Ping timeout: 260 seconds]
awestroke has quit [Remote host closed the connection]
lggr has quit [Ping timeout: 256 seconds]
baphled has quit [Ping timeout: 246 seconds]
tjbiddle has quit [Ping timeout: 246 seconds]
icole has joined #ruby
lggr has joined #ruby
yxhuvud has joined #ruby
djdb has joined #ruby
Takehiro has joined #ruby
lggr has quit [Ping timeout: 256 seconds]
<profx_>
nite all
lggr has joined #ruby
bradhe has joined #ruby
justinmcp has quit [Remote host closed the connection]
kil0byte has joined #ruby
Solnse has joined #ruby
Banistergalaxy has joined #ruby
und3f has joined #ruby
IrishGringo has joined #ruby
lggr has quit [Ping timeout: 245 seconds]
arturaz has quit [Quit: Bye]
blazes816 has quit [Quit: blazes816]
bradhe has quit [Ping timeout: 260 seconds]
AndChat| has quit [Ping timeout: 260 seconds]
Erfankam has quit [Remote host closed the connection]
slainer68 has joined #ruby
hbpoison has quit [Ping timeout: 260 seconds]
saschagehlich has quit [Read error: Connection reset by peer]
saschagehlich has joined #ruby
Banistergalaxy has quit [Ping timeout: 255 seconds]
Banistergalaxy has joined #ruby
lggr has joined #ruby
tpe11etier has quit [Quit: tpe11etier]
aganov has joined #ruby
rippa has joined #ruby
slainer68 has quit [Ping timeout: 260 seconds]
vlad_starkov has joined #ruby
georgi has joined #ruby
<Fandekasp>
hi there. I have an error "uninitialized constant Open3 (NameError)". I tried to "gem install open311; bundle install" and reexecute "bundle exec script/setup_vagrant.rb" (trying to install barkeep), but I keep getting the same error. I probably didn't install the right package for Open3, but how do I find it ?
fatninja has joined #ruby
icole has quit [Remote host closed the connection]
<Fandekasp>
that's weird, ruby standard library means it should be already available
icole has quit [Read error: Connection reset by peer]
zmo_ has joined #ruby
fixl has joined #ruby
vlad_starkov has quit [Ping timeout: 245 seconds]
hvq has joined #ruby
lggr has joined #ruby
maesbn has joined #ruby
<hvq>
hi guys, im using sinatra and have a trouble with :provides => :json. If I use this for a "post request", sinatra will parses the request from plain text to json data structure and pass the data to params, correct? but it seems that doesn't work for me, do I need to "require" any thing?
snorkdude has quit [Remote host closed the connection]
sertaconay has quit [Read error: Connection reset by peer]
<shevy>
setup-3.4.1/setup.rb
<shevy>
you only need that .rb file, the other files aren't needed
<emergion>
will then it out, thanks
<emergion>
You don't think bundler can help at all? I wonder if I could setup a gem path and use a alias to bunlder to some carefully selected options.
Averna has quit [Quit: Leaving.]
<shevy>
I dunno, bundler is rather new compared to other things. and for me, it never worked
<Xeago>
emergion: thats what I would do
<shevy>
Spooner is a big fan of it
mahmoudimus has quit [Quit: Computer has gone to sleep.]
<emergion>
Yup, I will look into it thanks for the ideas so far though...
Yomero has quit [Remote host closed the connection]
<shevy>
if you get it to work, write back here on #ruby please :)
lggr has quit [Ping timeout: 272 seconds]
<emergion>
Will post back if anyone is interested...
<Xeago>
shevy got any experience with rr, so help me maybe ;O?
sphera has quit [Ping timeout: 260 seconds]
<Xeago>
yes, call me maybe is playing in the office since 8 (nearly 3 hours now)
AndChat| has joined #ruby
mahmoudimus has joined #ruby
AndChat- has joined #ruby
Vainoharhainen has joined #ruby
emergion has quit [Quit: Computer has gone to sleep.]
workmad3 has joined #ruby
sphera has joined #ruby
Banistergalaxy has quit [Ping timeout: 255 seconds]
icole has quit [Ping timeout: 244 seconds]
ABK has joined #ruby
xpen has quit [Remote host closed the connection]
lggr has quit [Ping timeout: 255 seconds]
xpen has joined #ruby
heftig has quit [Ping timeout: 256 seconds]
emergion has joined #ruby
xpen_ has joined #ruby
hbpoison has joined #ruby
AndChat| has quit [Ping timeout: 248 seconds]
emergion has quit [Client Quit]
lggr has joined #ruby
jerius has quit [Quit: Computer has gone to sleep.]
<shevy>
rr?
<Xeago>
double ruby
<Xeago>
mocking framework
<shevy>
hmm never tried that
xpen has quit [Ping timeout: 245 seconds]
<shevy>
is it easy to learn?
<Xeago>
if you understand it, yes
<Xeago>
but I'm new to ruby aswell
<Xeago>
and never used mocks
<Xeago>
only stubs
<Xeago>
I know exactly what I want to do
<Xeago>
but don't know how to express it
Takehiro has quit [Remote host closed the connection]
lggr has quit [Ping timeout: 265 seconds]
timmow has joined #ruby
bluOxigen has quit [Ping timeout: 240 seconds]
lggr has joined #ruby
<shevy>
well I am not new to ruby but I never used mocks or stubs
vlad_starkov has joined #ruby
lkba has quit [Quit: Bye]
<Xeago>
do you behavior test your code?
ephemerian has joined #ruby
<shevy>
hmm not really :)
<shevy>
the way I test is usually by putting the tests after if __FILE__ == $PROGRAM_NAME
<Xeago>
wot
bluOxigen has joined #ruby
lggr has quit [Ping timeout: 260 seconds]
bradhe has joined #ruby
lggr has joined #ruby
JonnieCache has joined #ruby
saschagehlich has quit [Read error: Connection reset by peer]
saschagehlich has joined #ruby
WashIrving has joined #ruby
WashIrving has left #ruby [#ruby]
bradhe has quit [Ping timeout: 252 seconds]
lggr has quit [Ping timeout: 246 seconds]
lggr has joined #ruby
Jork1 has joined #ruby
SmoothSage has joined #ruby
mneorr has quit [Remote host closed the connection]
lggr has quit [Ping timeout: 252 seconds]
mneorr has joined #ruby
<workmad3>
ooh, mocks :)
<Xeago>
workmad3: got any idea how?
<workmad3>
how to what? use them? use a specific lib?
<Xeago>
using rr
<workmad3>
hmm, I've not used rr
<workmad3>
I've never really needed to move beyond rspec-mocks
<Xeago>
well that would be fine aswell
Politoed has joined #ruby
lggr has joined #ruby
JohnBat26 has joined #ruby
<Xeago>
I need to stub out a method called index which gets called on initialize (because this method does not exist due to inheritance), I also need to see if a methodcall to default_sort_rules gets called during the initialize method
<Xeago>
and that summarizes my test :3
anderse has quit [Quit: anderse]
<workmad3>
I'm not sure how the first one is a good idea
<JonnieCache>
rr is pretty sweet
<workmad3>
I'm also not sure the second one is a good idea :)
Solnse has quit []
<JonnieCache>
i used to use it before i realised i only needed rspec-mocks
<Xeago>
workmad3: explain please
<workmad3>
the whole 'mock roles not objects' idea - default_sort_roles is part of the object you're testing, not a collaborator with the object
<Xeago>
rules*
<workmad3>
so you shouldn't really mock it... that's mocking out implementation details (which leads to fragile, brittle tests and a whole lot of hatred for mocks)
<Xeago>
workmad3: the class in question has to call default_sort_rules, don't care what it returns as that differs
<Xeago>
as long as it gets called
dhruvasagar has quit [Ping timeout: 245 seconds]
<Xeago>
and actually default_sort_rules is implemented on the subclass
<workmad3>
ok... here's an idea... why not create a fake subclass as part of your test to test the inherited features?
dhruvasagar has joined #ruby
<workmad3>
and then you can run your expectations against the actual instance of the sub-class ;)
lggr has quit [Ping timeout: 272 seconds]
saschagehlich has quit [Read error: Connection reset by peer]
<Xeago>
it's what I thought initially aswell, but then I was like, but using rr and directly using the class would be sweet
<Xeago>
:3
<workmad3>
I've had much less pain doing that in the past ;)
saschagehlich has joined #ruby
<Xeago>
yea but I am willing to suffer
<Xeago>
and most certainly make all of you suffer >:)
<workmad3>
ok, the *how* within rspec would be - MyClass.any_instance.stub(:index).and_return('whatever'); MyClass.any_instance.should_receive(:default_sort_rules); MyClass.new
mahmoudimus has quit [Quit: Computer has gone to sleep.]
<JonnieCache>
yeah
<workmad3>
just not something I'd recommend because it's not a good test for mocks ;)
<JonnieCache>
thank god they added any_instance
<Xeago>
workmad3: explain
<workmad3>
Xeago: for the reasons above... mocks aren't really a good way to test the behaviour of a parent class in inheritance, it's not a good fit for the style
hvq has quit [Ping timeout: 260 seconds]
Takehiro has joined #ruby
AndChat- has quit [Ping timeout: 248 seconds]
<workmad3>
Xeago: mocks are great for isolating a specific object from the rest of the system... they're not so great for isolating an object from its implementation (well, actually they're far *too* good at doing that... it leads to tests that pass or fail when they shouldn't because you aren't testing any real code)
<Xeago>
in specific I am testing the sort method on ParamSearch
lggr has joined #ruby
<workmad3>
Xeago: in this case - you're testing some functionality that you intend to be used with inheritance without using inheritance - your test therefore relays odd information to the reader
<Xeago>
which tries it's best to get sorting rules from different sources, but eventually resorts back to default_sort_rules
<workmad3>
Xeago: and using mocks, it's much more likely that you'll get a false positive/negative down the line
matrixise has joined #ruby
<workmad3>
Xeago: it basically boils down to 'it's a fine line between testing behaviour and implementation' :)
<Xeago>
I can have a class definition in my spec file right?
<workmad3>
yup
<workmad3>
hell, you can do this in an rspec spec - 'let(:sort_class) {Class.new(MySortClassParent)}'
<workmad3>
which will give you completely new, isolated anonymous class instances for each test ;)
hbpoison has quit [Ping timeout: 245 seconds]
seoaqua has joined #ruby
<Xeago>
and I'd instantiate that as sort_class.new ?
<workmad3>
yup
c0rn_ has quit []
<Xeago>
instead of class.new the normal class klass < parent; ..; end works aswell?
<workmad3>
yeah
lggr has quit [Ping timeout: 245 seconds]
<workmad3>
it is just ruby that you're using after all, you can do all the normal ruby stuff
vlad_starkov has quit [Ping timeout: 252 seconds]
* Xeago
is new to ruby, never used let and hardly ever instantiated a class within a block
<workmad3>
Xeago: that doesn't couple your test to the implementation
<workmad3>
Xeago: you're free to implement the add method however you want
<Xeago>
adder.add(2,2).should eq 4!
fatninja has quit []
<workmad3>
that would work too :)
<Xeago>
the thing that borks it, I think is the following
<workmad3>
of course that's a super-simple, naive example
<Xeago>
stuff gets called in initialize
<workmad3>
but the idea is - you need to determine what aspects of your object are things that constitute the behaviour you actually care about
lggr has joined #ruby
yshh has quit [Remote host closed the connection]
<workmad3>
for example - do you care if it calls default_sort_options, or do you care that, if you set no other sort ordering, things get sorted as '1, 2, 3, 4'?
<Xeago>
the behaviour that I care about is the following:
<Xeago>
when unable to determine sort rules from several sources, resort to default_sort_rules
<workmad3>
Xeago: do you actually care that it defaults to 'default_sort_rules' or do you care that things end up sorted as 'item1, item2...'?
<Xeago>
different tests verify that things get sorted properly
<workmad3>
Xeago: i.e. are you actually using checking that default_sort_rules as a proxy for the actual behaviour of sorting things correctly?
<Xeago>
atm I testing that it should ask the different sources to get sort_rules
kn330 has joined #ruby
reinaldob has joined #ruby
<Xeago>
workmad3: no, I am only testing the fact that default_sort_rules gets called if it is unable to find sorting rules earlier
<workmad3>
btw, I don't know the actual answer... it might be you are, it might be you aren't... different projects, different implementations, etc. change what are collaborators and what are implementation details
dax has left #ruby [#ruby]
<Xeago>
I have different tests (already existing tests) that verify how sorting itself is supposed to work
lggr has quit [Ping timeout: 245 seconds]
<Xeago>
but I am not testing sorting, testing the origin of sorting rules :)
<workmad3>
Xeago: ok, here's a question... do you actually care?
<Xeago>
yes
<workmad3>
Xeago: you have your sorting tested
<Xeago>
yes but they don't test different origins of rules
<workmad3>
Xeago: why not add tests that test sorting with different setups for different rules?
<Xeago>
they either assume sorting is done, or pass it explicitly
<workmad3>
what is important - that specific method X is called, or that your sorting is done?
<Xeago>
there's no test that verify's the rules that are actually used (besides the effect of the rules)
lggr has joined #ruby
<workmad3>
what test do you need other than the effect of the rules being used?
<Xeago>
it might occur that the default sort rules are equal to the explicitly specified sorting rules, in which case it is not tested which should happen
<workmad3>
ok
<workmad3>
do you *care*?
<Xeago>
I feel I should
<workmad3>
as a developer, does it matter if rule X or the default rules are used if they would be identical?
<Xeago>
it does matter if they happen to be implemented in the wrong order
<workmad3>
it doesn't matter if they'd be identical
mneorr has joined #ruby
* Xeago
cares for waking up and not being hungry
<workmad3>
it does matter if they would change the sort order... so you test that the correct sort order is arrived at
<workmad3>
at least, that's my view :)
<Xeago>
I can't test all the different sort rules, but I can test their origins
heftig has joined #ruby
<Xeago>
as those are fixed
<workmad3>
you don't test all the sort rules
<workmad3>
you test enough to be confident that the implementation is correct
margle has joined #ruby
<Xeago>
which I can't really do
Mil_ has joined #ruby
ananthakumaran has quit [Read error: Operation timed out]
<Xeago>
but alas, I think I have to lower that required level of confidence
<Xeago>
as it feels awkward and odd to implement this test
<workmad3>
would testing the algorithm that determines the source increase your confidence that the actual sorting will be correct?
ananthakumaran has joined #ruby
lggr has quit [Ping timeout: 260 seconds]
dhruvasagar has quit [Ping timeout: 252 seconds]
<Xeago>
yes, but not relevant/required
<workmad3>
ah, now that's something else - if something is awkward and odd to test, then either a) you're testing something that's badly designed, or b) you're writing bad tests ;)
<Xeago>
been writing that test for about an hour now so
<workmad3>
bad tests could be ones that are badly isolated, or testing implementation
dhruvasagar has joined #ruby
fermion has joined #ruby
<workmad3>
so in that situation, I'd step back, determine what is making the test difficult to write and see if I can change that... maybe there are two things that are too heavily coupled
<workmad3>
maybe you're testing implementation more than behaviour...
<workmad3>
maybe you're testing too much... or you're writing the wrong sort of test (you're writing a developer test where you actually want an acceptance test, or you were trying to write a unit test that's conflating into an integration test)
lggr has joined #ruby
<workmad3>
there's lots of things that a hard to test bit of the system can tell you ;)
xpen_ has quit [Remote host closed the connection]
<workmad3>
Xeago: my suspicion is that the method you have there is being a PITA to test because it's working at too many levels of abstraction
sterNiX has quit [Ping timeout: 245 seconds]
<Xeago>
could you define too many, and the levels itself?
<Xeago>
sorry for hammering you this much, but this is really helpfull!
<workmad3>
Xeago: well, > 1 is too many levels of abstraction in a method ;)
lggr has quit [Ping timeout: 252 seconds]
jrajav has joined #ruby
<workmad3>
Xeago: and in this case, you've pushed out things like default sort ordering in some places, but not in others, you're jumping right down into typecasting and right up into determining fallback options for sort options
<Xeago>
but not in which others?
kieppie has quit [Quit: Leaving.]
<workmad3>
Xeago: line 13 and line 17, you're determining the default sort order within the method, but line 20 you've pushed that information out into default_sort_rules
lggr has joined #ruby
<workmad3>
Xeago: and line 16 just seems confused... you've checked if @params[:sort] is present, but then you go and use @params[:sort_desc]
<Xeago>
wops 16 is an error >.<
<workmad3>
Xeago: so if you reach that code, you've actually just guaranteed that keys is nil ;)
emergion has quit [Quit: Computer has gone to sleep.]
<workmad3>
Xeago: but that's not immediately obvious because you're trying to hold in your head both the structure of the params hash, the algorithm for determining the order and ensuring the keys and order get forced into an array ;)
Mil_ has quit [Remote host closed the connection]
<workmad3>
Xeago: it's quite a confused method from my reading, for all that it's only 20 lines ;)
<Xeago>
it was part of a 180line method, not my code
miso1337 has quit [Quit: afk]
<Xeago>
I am chunking it now
<workmad3>
Xeago: right, do you have a behaviour test for the entire 180 line method?
<Xeago>
no
<workmad3>
Xeago: ok
<Xeago>
and it doesn't work
<Xeago>
that's the problem, they dumped it on me
<workmad3>
Xeago: stop what you're doing and get that written and demonstrating *why* it doesn't work
<workmad3>
Xeago: throw away your current chunking
<Xeago>
the chunking allowed me to understand what was going on
<workmad3>
Xeago: because you've basically just admitted that you actually have no idea if what you're doing is correct or not :)
<workmad3>
Xeago: ok, that's fine... treat this as a spike then
lggr has quit [Ping timeout: 245 seconds]
<workmad3>
Xeago: chunk, get a handle on what the method is doing
<Xeago>
I have a spec document, if I manually check it
<Xeago>
(besides line 16) it was compliant
<workmad3>
Xeago: but once you've worked out what is actually happened *throw away the code*
<workmad3>
Xeago: and while you can write some tests to verify assumptions, don't try and write comprehensive test coverage
<Xeago>
well I was basically writing tests for the spec document I have
manizzle has joined #ruby
<workmad3>
Xeago: and certainly don't get bogged down - if a test is taking more than 5 minutes to write, just stop trying
<Xeago>
5 minutes is short, don't have experience with rspec nor rr, and not really with ruby either
<workmad3>
Xeago: for the complete method - write 1, maybe 2, tests based on the document
<workmad3>
Xeago: that show what it should do
<workmad3>
Xeago: again, don't worry about being comprehensive... you currently just care about making sure you haven't severely borked things ;)
<Xeago>
thing is, if you don't specify any options, you hit the path the developer only ran
<workmad3>
Xeago: ok, maybe 10 minutes then
<Xeago>
and that works
<Xeago>
and I made a spec for that
<Xeago>
and that works
<Xeago>
but that is far from comprehensive
<workmad3>
you don't care about comprehensive yet
<workmad3>
you're trying to understand the problem
<Xeago>
it only verifies, if I ask my database for results, I should get results
<Xeago>
s/base/store
<workmad3>
comprehensive testing is the *last* thing to do, not the first
<Xeago>
I am not doing comprehensive testing yet, afaik
<Jork1>
is reduce and inject the same thing?
<Xeago>
trying to test a standalone unit
<workmad3>
you're trying to
sterNiX has joined #ruby
<workmad3>
you're trying to completely test something you chunked into a separate method at a time when you're understanding the method
<workmad3>
and seriously... don't bother
lggr has joined #ruby
<JonnieCache>
Jork1: yes
<JonnieCache>
Jork1: that confused me as well
<Xeago>
on a side note, workmad3, I would like to credit you in my graduation documentation, can I and if so how?
<workmad3>
Xeago: you can if you want
<Jork1>
JonnieCache: yeah, strange… thank you!
frederic has joined #ruby
<workmad3>
Xeago: wouldn't be the first time :P
<Xeago>
how can I credit you then?
<JonnieCache>
Jork1: inject is a term from another language
<JonnieCache>
Jork1: probably smalltalk or something
<Xeago>
using your real name form whois?
hbpoison has quit [Ping timeout: 245 seconds]
<Jork1>
JonnieCache: I learned inject when learning ruby, and now i saw a code with reduce and confused me...
<xbayrockx>
i a starting a new software engineer position in a few months, am looking for a programming project to get me in the mood, any suggestions? something military/defence related would be appropriate
<workmad3>
Xeago: still, back to the issue at hand - right now, your primary concern is understanding the method so you can refactor it effectively
slainer6_ has quit [Remote host closed the connection]
<workmad3>
Xeago: I'd throw away trying to mock it, any tools you aren't confident with to use quickly yet... they're just distractions
<Xeago>
I understand the method now (after seperating different concerns to seperate methods)
<workmad3>
Xeago: ok, so now you understand it - throw away your separation
<JonnieCache>
xbayrockx: make a worms clone
<Xeago>
I think I will follow your advice of only testing example imput
<Xeago>
workmad3: which seperation?
<workmad3>
Xeago: and make sure you have 2 or 3 tests that test the entire thing
<workmad3>
Xeago: your chunking into separate methods
lggr has quit [Ping timeout: 246 seconds]
<Xeago>
and beeing back to the 180 line method, that thing is unreadable!
dhruvasagar has quit [Ping timeout: 240 seconds]
<workmad3>
Xeago: but now you know what it does, you can write 2 or 3 tests and then refactor it properly ;)
<workmad3>
Xeago: rather than a refactoring that was driven by a need to understand an untested method
mneorr has quit [Ping timeout: 245 seconds]
<workmad3>
Xeago: what you just did was a 'spike' - a short foray into a codebase in order to understand it. They're great, but it's important to throw away any code from them
dhruvasagar has joined #ruby
<Xeago>
I am not sure I will end up with different code if I do it again
frederic has quit [Read error: Connection reset by peer]
<workmad3>
Xeago: because that code was being driven by the wrong priorities - gaining initial understanding
<Xeago>
but ill stash this for now
<workmad3>
Xeago: sometimes happens, but not often
lggr has joined #ruby
<workmad3>
Xeago: once you've gotten that understanding of the method, you frequently find that your first division of concerns isn't actually what you want and revisiting it brings out a nicer design ;)
mneorr has joined #ruby
nari_ has quit [Ping timeout: 245 seconds]
<workmad3>
Xeago: ok, so you stash your code, you have 2, maybe 3, tests for the thing as a whole (in your case, one showing the 'working' path, one showing a failure path)
hsbt_away is now known as hsbt
<Xeago>
there were 50 lines that dealt with sorting based on some inputs
<workmad3>
Xeago: I'd probably suggest next that you fix the bug in any way possible (hacky code, etc) just so that you have passing tests
<Xeago>
at the moment the concern of getting the specific rules is seperated from applying the sorting
<Xeago>
was*
<workmad3>
Xeago: then step away for 10 minutes, get a coffee (or tea) and basically let your brain mull over the problem without actively thinking about it
<workmad3>
Xeago: once you've done that, go back to the method and restart your refactoring
<workmad3>
Xeago: but now you know what's happening, you'll definitely be going faster (I find reimplementing something can be up to 10x faster than the first attempt)
<Xeago>
tea > tests (what kind of tests?) > refactor
<Xeago>
right?
<workmad3>
yeah
tpe11etier has joined #ruby
<workmad3>
when refactoring, don't worry too much about testing every detail either... your concern is not in changing behaviour, it's about restructuring the code
lggr has quit [Ping timeout: 246 seconds]
<Xeago>
just speculating
<workmad3>
keep an eye out for 'sections' that all deal with the same thing - those are probably targets for new classes
frederic has joined #ruby
<Xeago>
would it be better to test like this
rakl has quit [Quit: sleeping]
<Xeago>
pass no options, verify the resulting ordering
<Xeago>
pass options verify the resulting ordering
<workmad3>
Xeago: I'd do both
<Xeago>
pass options that explicitly conflict with ordering specified in the mockclass, and verify the resulting ordering
<workmad3>
Xeago: in separate tests
tpe11etier has quit [Client Quit]
<Xeago>
each line was a seperate test
<Xeago>
tho, not certain about the third
<workmad3>
Xeago: great :) but I wouldn't mock at this point (unless by 'mock class' you mean your fake test implementation of a sort class?)
<workmad3>
Xeago: language is important here btw :) stubs != mocks != fakes != spies
lggr has joined #ruby
reuf has quit [Quit: Leaving]
<Xeago>
we called it mockclass earlier
<Xeago>
guess I should've called it subclass
<workmad3>
hmm, I think I called it a fake subclass
<workmad3>
if not, I'm sorry
<workmad3>
basically, it's a fake implementation
<Xeago>
sorry for confusion, might me my error
<workmad3>
similar in idea to using an in-memory database as a fake database for testing purposes :)
<Xeago>
mocking Tire,
<workmad3>
something that kind of does the job but not how you really want it to :)
<workmad3>
but it's good enough to test your behaviour :)
Mon_Ouie has joined #ruby
<Xeago>
Tire was easy to mock
<workmad3>
did you actually mock tire? bad Xeago :P
<workmad3>
'only mock types you own'
sspiff has quit [Remote host closed the connection]
cuttooth has quit [Remote host closed the connection]
<Xeago>
urgh, needed to not use elasticsearch for everything ;P
<Xeago>
even tho it is fast
<workmad3>
which is fair enough
<workmad3>
but you can write an interface around it, then mock your interface
<Xeago>
I implemented my mock as a tire-contrib extension
noxoc has joined #ruby
<workmad3>
which also means that if the Tire interface changes (which is quite likely, interface change is quite common in ruby projects) then you have *one* place to change it
kil0byte_ has joined #ruby
<workmad3>
and that's also down into why you shouldn't mock types you don't own
<workmad3>
because if the interface changes - you're mocking the wrong interface, your own tests will pass but your code will be broken
<Xeago>
I doubt the internal representation of stuff that Tire uses will change
<Xeago>
moreso, it will add stuff
lggr has quit [Ping timeout: 245 seconds]
<workmad3>
you can't depend on that
`brendan has quit [Ping timeout: 260 seconds]
monkegjinni has joined #ruby
<workmad3>
or rather, you shouldn't depend on it ;)
sspiff has joined #ruby
sspiff has joined #ruby
<workmad3>
you're probably right... for the forseeable future while you're on the project
mneorr_ has joined #ruby
arietis has joined #ruby
heftig has quit [Quit: leaving]
<Xeago>
would you recommend just using tire, and having a bit slower tests
<Xeago>
(1sec vs 3-4, depending on index size)
lggr has joined #ruby
<workmad3>
I'd recommend both
kil0byte has quit [Ping timeout: 255 seconds]
<workmad3>
for your internal tests, have a wrapper that you can provide a fake or mock implementation of
<workmad3>
for your integration and acceptance tests, use tire itself
<workmad3>
different levels of test have different constraints ;)
<Xeago>
only using the mock for unit tests
dhruvasagar has quit [Ping timeout: 276 seconds]
<workmad3>
ok, so right now what you've basically implied is that your wrapper of tire is method-identical to Tire itself
dhruvasagar has joined #ruby
emergion has joined #ruby
<Xeago>
it hooks into the perform method of tire
mneorr has quit [Ping timeout: 255 seconds]
<Xeago>
uses the ivars from that and does it stuff
<workmad3>
ewww
<workmad3>
that's even worse than just mocking out the entire Tire module
<workmad3>
it might be a smaller surface area, but it's relying on a huge amount of implementation detail
<Xeago>
yea :\
<Xeago>
I guess I should just use tire, and have a slower test, gives me more time to loosen my wrists
<workmad3>
if you wanted it to just not make requests, I'd have said isolate at the actual system boundary - the HTTP request
chussenot has quit [Quit: chussenot]
<workmad3>
webmock or fakeweb
<Xeago>
and then parsing the json or what?
<Xeago>
as perform directly calls the httpclient that is configured in tire
lggr has quit [Ping timeout: 252 seconds]
<workmad3>
webmock will let you say 'catch this HTTP request and return this data'
<workmad3>
as will fakeweb
<workmad3>
so as part of your test setup, you can say 'you should return this data'
<Xeago>
hm that is more easy doable than I expected
<workmad3>
and then the Tire library will get that as the response, handle it however it normally do
<workmad3>
*would
<Xeago>
I could just run it slowly some times
graeme has quit [Read error: Connection reset by peer]
<Xeago>
get the result and define it in there
<Xeago>
sounds way better
<workmad3>
and you've isolated your test at the boundary of your system, rather than an arbitrary internal boundary ;)
graeme has joined #ruby
lggr has joined #ruby
<Xeago>
not an arbitrary boundary, app - library
<workmad3>
it would still be a good idea to have an interface object for use within your app btw
<Xeago>
more thee is needed, bundle is slow
<workmad3>
Xeago: it's quite arbitrary because you haven't contained that boundary within a single place in your app ;)
sterNiX has quit [Ping timeout: 260 seconds]
<workmad3>
Xeago: or at least, I assume you haven't, from what you've said
hsbt is now known as hsbt_away
<workmad3>
Xeago: incidentally, I'd highly recommend you read through 'Growing Object Oriented Software Guided by Tests'
Sausie has joined #ruby
<Xeago>
I can decide to use it by calling STUB_TIRE or STUB(TIRE) from anywhere within a describe
<Sausie>
Xeago: asl?
<Xeago>
asl?
<Sausie>
anyone wanna cam?
<Sausie>
Xeago: u got cam?
<Sausie>
asl please
<JonnieCache>
lol
<workmad3>
Xeago: ignore Sausie, it's a troll
<workmad3>
Xeago: probably a sexchat trollbot...
<Sausie>
:D
hsbt_away is now known as hsbt
<Xeago>
yea figured as soon as I found the abbreviation of that
<JonnieCache>
i havent heard the phrase asl since i was about 12 or something
<workmad3>
Xeago: and for future reference 'asl' is 'age, sex, location'
<workmad3>
JonnieCache: yeah, I wondered if it was a reference to an obscure language forst :)
<workmad3>
*first
lggr has quit [Ping timeout: 260 seconds]
<Xeago>
20 bucks, good I got voucher!
Sausie has left #ruby [#ruby]
<Xeago>
okay, dropped the mock for Tire
<Xeago>
does webmock support post body's for get?
<Xeago>
can't see it in a quick glanc eover the doc
slainer68 has joined #ruby
kil0byte_ has quit [Ping timeout: 246 seconds]
<JonnieCache>
Xeago: for mocking web services have a look at vcr
stw has joined #ruby
peterhellberg has joined #ruby
lggr has joined #ruby
Guest22757 has quit [Read error: Operation timed out]
Elhu has quit [Quit: Computer has gone to sleep.]
kil0byte has joined #ruby
AndChat| has joined #ruby
nignaztic has quit [Quit: WeeChat 0.3.7]
AndChat- has joined #ruby
<Xeago>
quick test, it does support getbody's
<Xeago>
would you recommend storing results in a file
<Xeago>
or with code?
<Xeago>
in*
lggr has quit [Ping timeout: 246 seconds]
<Xeago>
and where should I put the endpoints I am stubbing
<Xeago>
as it's going to be a list
fermion has quit [Read error: Operation timed out]
Axsuul has quit [Ping timeout: 246 seconds]
<Xeago>
spec/helper?
reset has quit [Quit: Leaving...]
Banistergalaxy has quit [Ping timeout: 255 seconds]
mneorr_ has quit [Read error: Connection reset by peer]
mneorr has joined #ruby
lggr has joined #ruby
AndChat| has quit [Read error: Connection reset by peer]
<JonnieCache>
Xeago: look at vcr man its a wrapper around webmock and the like which takes care of that stuff
slainer68 has quit [Ping timeout: 246 seconds]
<JonnieCache>
its terribly clever, too clever to explain here
<Xeago>
yuck, someone at my work once tweeted: "Sometimes I drool at work. Because my code is delicious", this is what he puts in production "if render_job.valid?\n p render_job"
vitoravelino`afk has quit [Remote host closed the connection]
krawchyk has joined #ruby
kil0byte_ has quit [Ping timeout: 246 seconds]
mneorr has quit [Remote host closed the connection]
graeme has joined #ruby
vitoravelino has joined #ruby
vitoravelino has quit [Changing host]
vitoravelino has joined #ruby
wmoxam has quit [Quit: leaving]
fridim_ has joined #ruby
lggr has quit [Ping timeout: 260 seconds]
<Xeago>
should I have attr_reader :symbols, if I override the generated readers anyway?
moshee has quit [Ping timeout: 265 seconds]
<Spooner>
xeago nope.
moshee has joined #ruby
wmoxam has joined #ruby
jenrzzz has quit [Ping timeout: 252 seconds]
<Xeago>
reasoning?
kil0byte has joined #ruby
<Xeago>
I thought I once read, keep it because it is at the top and readers will immediately know they can call those properties on your class
<Spooner>
It is redundant ;)
<pothibo>
they're the same
brtdv has joined #ruby
lggr has joined #ruby
<Spooner>
No, because users should be reading docs, not source, to see what methods to call.
Uranio has joined #ruby
<pothibo>
That's a blunt assumption Spooner
<JonnieCache>
Xeago: what is your objection to that code
booyakah has joined #ruby
booyakah has joined #ruby
booyakah has quit [Changing host]
<Xeago>
it's a web app that prints to console in production which is /dev/null'ed
acrocity has quit [Quit: leaving...]
<Xeago>
could you post your load averages?
replore_ has joined #ruby
<Xeago>
I'm constantly around 2.4 when developing (dual core machine), I think that is too high, right?
<pothibo>
JonnieCache: while the code is perfectly valid, it's not the general definition of beautiful..
acrocity_ has joined #ruby
<Spooner>
pothibo : On the other hand, what you should be doing (rather than what you shouldn't be doing) is adding yard tags to mark those manual attribute accessors as such, rather than just as general methods. Not unsurprisingly, this involves putting extra lines at the top of your code that people can see if they want to.
lggr has quit [Ping timeout: 248 seconds]
<Xeago>
Spooner: i've never heard of yard tags before
<workmad3>
Xeago: I say no for a different reason to Spooner... if you have so much code in a class that another dev can't see that you have X, Y and Z setters, then having an 'attr_reader :symbols' as 'documentation' is a low priority concern :P
<Xeago>
I've decided on using TomDoc, but is unclear what to do for attribute accessors
<pothibo>
Spooner: I was referring to "People should not read source, they should read docs" which implies that 1. there's doc available 2. It is accurate 3. It has enough information so it's easier to understand than the actual source
<Spooner>
pothibo : There would be doc available if it is a gem (automatically on yardoc) and if not, then it would be available if the user can type "yard doc". It is also available if you look at the object in pry or just use MyClass.public_instance_methods(false) - it isn't secret information by any means.
lggr has joined #ruby
tommyvyo_ has joined #ruby
tommyvyo_ has quit [Changing host]
tommyvyo_ has joined #ruby
Elhu has joined #ruby
<Spooner>
pothibo : I'm not saying there aren't very valid reasons for reading source, I'm saying that if you want to know what attributes are available, then docs (even without any manual documentation) are a much better source of that information.
matrixise has quit [Ping timeout: 255 seconds]
bradhe has joined #ruby
chrisja has joined #ruby
acrocity- has joined #ruby
<Spooner>
Unless you don't know how to use protected, etc, so everything looks public, but again, that is a general problem. Anyway, if I saw attr_reader :frog at the top of code, I'd assume it wasn't implemented manually, which might confuse me if I was wanting to edit the source, for example.
kil0byte_ has joined #ruby
und3f has quit [Read error: Connection reset by peer]
monkegjinni has quit [Read error: Connection reset by peer]
monkegjinni has joined #ruby
<pothibo>
Spooner: There again I disagree with you since in ruby there's usually so much meta programming that accessors are sometimes hidden in the actual source (which makes the doc equally useless). Anyway, you read the doc, I read the source. The world continue spinning
kn330 has quit [Ping timeout: 248 seconds]
lggr has quit [Ping timeout: 265 seconds]
<pothibo>
Spooner: I agree with you on this one however dual implementation is confusing
<Xeago>
pothibo: tomdoc allows you to easily generate documentaiton for meta programmed methods
hsbt is now known as hsbt_away
acrocity_ has quit [Ping timeout: 246 seconds]
<Xeago>
I decided the following: don't put it in attr_reader, put initialize at the top, directly under that def accessormethods
kil0byte has quit [Ping timeout: 252 seconds]
lggr has joined #ruby
bradhe has quit [Ping timeout: 260 seconds]
emergion has quit [Quit: Computer has gone to sleep.]
hsbt_away is now known as hsbt
matrixise has joined #ruby
robertotauille has joined #ruby
reisl has joined #ruby
kn330 has joined #ruby
lggr has quit [Ping timeout: 276 seconds]
dr_bob has quit [Quit: Leaving.]
Krists has joined #ruby
lggr has joined #ruby
kil0byte_ has quit [Ping timeout: 255 seconds]
larissa has quit [Ping timeout: 240 seconds]
<JonnieCache>
define all your accessors by calling define_method in a loop over an array of variable names :)
dr_bob has joined #ruby
<JonnieCache>
fuck automatic documentation :P
dr_bob has left #ruby [#ruby]
dr_bob has joined #ruby
areil has quit [Ping timeout: 245 seconds]
samphippen has joined #ruby
akem has quit [Read error: Connection reset by peer]
akemEikko has joined #ruby
kil0byte has joined #ruby
geekbri has joined #ruby
lggr has quit [Ping timeout: 265 seconds]
akemEikko has quit [Max SendQ exceeded]
akemEikko has joined #ruby
lggr has joined #ruby
fridim_ has quit [Ping timeout: 265 seconds]
cantonic_ has joined #ruby
d2dchat has joined #ruby
sertaconay has joined #ruby
heftig has quit [Quit: leaving]
DefV has quit [Read error: Connection reset by peer]
axl_ has joined #ruby
hvq has joined #ruby
cantonic has quit [Ping timeout: 252 seconds]
cantonic_ is now known as cantonic
DefV has joined #ruby
und3f has joined #ruby
gmcabrita has joined #ruby
pothibo has quit [Quit: pothibo]
Virunga has joined #ruby
lggr has quit [Ping timeout: 276 seconds]
akem has joined #ruby
iamjarvo has joined #ruby
akemEikko has quit [Read error: Connection reset by peer]
lggr has joined #ruby
answer_42 has quit [Remote host closed the connection]
krawchyk_ has joined #ruby
axl_ has quit [Ping timeout: 244 seconds]
binaryplease has joined #ruby
rippa has joined #ruby
dpk has joined #ruby
binaryplease has quit [Client Quit]
miso1337 has quit [Quit: afk]
krawchyk has quit [Read error: Operation timed out]
Zai has quit [Read error: Connection reset by peer]
<profx_>
ill check back tonight
<bnagy>
it's missing dev tools
melzz has quit [Remote host closed the connection]
<Spooner>
No c compiler is going to make compiling harder.
one8zero has quit [Ping timeout: 260 seconds]
<bnagy>
install dev tools
<hoelzro>
it appears you have no compiler installed.
<bnagy>
xcode is a good option :S
<Xeago>
it is recommended to install xcode-commandline-tools
samphippen has joined #ruby
dr_bob has quit [Quit: Leaving.]
<Xeago>
tho, weird that rbenv requires gcc
g-ram has joined #ruby
lggr has joined #ruby
daniel_- has joined #ruby
<bnagy>
why?
axl_ has quit [Remote host closed the connection]
joeycarmello has quit [Remote host closed the connection]
<Xeago>
rvm*
<workmad3>
Xeago: why is it weird that a tool for compiling ruby from source requires a compiler?
<Xeago>
didn't look at it that way
schickung has joined #ruby
<workmad3>
;)
<bnagy>
I think it's weird that rvm requires ruby
dr_bob has joined #ruby
axl_ has joined #ruby
<Spooner>
I find it odd that Ruby requires a some sort of computational device.
<Hanmac>
bnagy yeah you need ruby to compile ruby :P
<bnagy>
totally makes sense, right Hanmac?
<workmad3>
bnagy: you need gcc to compile gcc...
<Xeago>
I used ruby-build for that
<Mon_Ouie>
But does RVM still need Ruby to build a Ruby that doesn't?
ph^ has joined #ruby
<Mon_Ouie>
workmad3: Actually, all you need is a C compiler — not GCC :p
<Spooner>
I'm pretty sure I've installed with RVM without needing Ruby installed.
<workmad3>
Mon_Ouie: ssh :P
<bnagy>
workmad3: I always used cc to compile gcc :/
georgi has quit [Ping timeout: 244 seconds]
mmitchell has joined #ruby
<workmad3>
bnagy: still, why aren't you complaining about the oddness of needing a C compiler to compile a C compiler?
<bnagy>
Spooner: positive? Cause most *nixalikes have a busted old 1.8 of some kind
<workmad3>
and no, you don't need ruby pre-installed
<bnagy>
workmad3: because one makes sense, the other is retarded
<bnagy>
you used to
<workmad3>
if there's no ruby that can bootstrap the 1.9 process, then rvm installs one
lggr has quit [Ping timeout: 260 seconds]
<Xeago>
I like that llvm-gcc uses gcc but refers to cc for commandline options..
<Spooner>
Well, maybe. I'm talking about a lubuntu (minimal ubuntu) which I assumed wouldn't have unnecessary crap like Ruby pre-installed.
<workmad3>
and rvm is starting to provide binary installs too now
<workmad3>
(says the guy using rbfu :) )
<bnagy>
lol
<Xeago>
workmad3: rbfu vs rbenv, your thoguhts?
<workmad3>
Xeago: meh
mmitchel_ has joined #ruby
<workmad3>
Xeago: rbfu was intriguing at a time I was considering moving away from rvm
<bnagy>
I didn't see much in rbfu that's not in rbenv, like it's not _that_ much lighter
<workmad3>
Xeago: that's about all the thought that went into the process
<Xeago>
aight
<bnagy>
but first time I installed rbenv it did what I thought it should do, so I was done browsing
<Xeago>
fair enough
<bnagy>
you can load up rbenv with gemset-ishs and crap I think
<bnagy>
btu I don't do any of that
<workmad3>
bnagy: the whole point of rbfu isn't to have things that aren't in other managers
<workmad3>
bnagy: it was to be the absolute minimum
mmitchell has quit [Ping timeout: 245 seconds]
<workmad3>
bnagy: and the code-base seems a fair bit smaller and less complicated than even rbenv :P
<Xeago>
might check it out
<Xeago>
seems to do everything I do with rbenv at the moment
lggr has joined #ruby
freezey has joined #ruby
Takehiro_ has quit [Remote host closed the connection]
daniel_-_ has joined #ruby
jerius has joined #ruby
<bnagy>
banister`sleep: fwiw I use the diff match patch stuff and it is very good - the C++ wrapped ruby gem is new
daniel_- has quit [Read error: Operation timed out]
<bnagy>
banister`sleep: but I bet you it won't handle binary strings, cause afair it uses Qt
binaryplease has quit [Quit: WeeChat 0.3.9]
mikepack has joined #ruby
postmodern has quit [Quit: Leaving]
<ksk>
is there an opposite of "chom" - to remove stuff from the beginning of a string like in: 'abc123'.chomp('123')
zenformatics has quit [Remote host closed the connection]
<Xeago>
workmad3: does rbfu override cd outside of zsh?
bluenemo has quit [Remote host closed the connection]
lggr has quit [Ping timeout: 252 seconds]
jlwestsr has joined #ruby
<ksk>
got it, thanks
ph^ has quit [Remote host closed the connection]
duracrisis has quit [Quit: Leaving]
lggr has joined #ruby
glupo has joined #ruby
Hanmac has quit [Ping timeout: 256 seconds]
<Spooner>
ksk s = 'abc123'; s[/^abc/] = '' - oh, too late.
DrShoggoth has joined #ruby
jprovazn is now known as jprovazn_away
<ksk>
thanks anyways Spooner :)
chussenot has joined #ruby
mahmoudimus has joined #ruby
nitti has quit [Remote host closed the connection]
MissionCritical has quit [Ping timeout: 246 seconds]
lggr has quit [Ping timeout: 252 seconds]
beit has joined #ruby
Banistergalaxy has joined #ruby
roadt has quit [Ping timeout: 245 seconds]
maesbn has quit [Remote host closed the connection]
lggr has joined #ruby
sent-hil has joined #ruby
vectorshelve has joined #ruby
mahmoudimus has quit [Ping timeout: 248 seconds]
AndChat- has quit [Ping timeout: 246 seconds]
chimay has joined #ruby
awarner has quit [Remote host closed the connection]
lggr has quit [Ping timeout: 246 seconds]
bartj3 has quit []
mahmoudimus has joined #ruby
heftig has joined #ruby
dr_bob has quit [Quit: Leaving.]
mikepack has quit [Remote host closed the connection]
danguita has joined #ruby
sertaconay has quit [Quit: No Ping reply in 180 seconds.]
lggr has joined #ruby
robertotauill has joined #ruby
deryl has joined #ruby
deryl has quit [Client Quit]
baroquebobcat has joined #ruby
ddd has joined #ruby
tfrew has joined #ruby
morozovm has joined #ruby
squareduck has joined #ruby
nitti has joined #ruby
<tfrew>
Hello, I am trying to use the daemons Gem for a background ampq worker. I can start my process manually without daemons and the RAILS_ENV is picked up. Launching with daemons and using -- -e staging has no effect
<tfrew>
what am I missing to pick up the RAILS_ENV when launching my process via the daemons gem?
<Spooner>
tfrew : ask in #rubyonrails
zommi has quit [*.net *.split]
robertotauille has quit [*.net *.split]
KillerFox has quit [*.net *.split]
ananthakumaran has joined #ruby
lggr has quit [Ping timeout: 260 seconds]
hoelzro is now known as hoelzro|away
havenn has joined #ruby
lggr has joined #ruby
<ddd>
tfrew: probably have to check the value of ENV['RAILS_ENV'] in your ruby script
dangerousdave has joined #ruby
cbuxton has joined #ruby
jerius has quit [Quit: Computer has gone to sleep.]
chrisramon has joined #ruby
mahmoudimus has quit [Quit: Computer has gone to sleep.]
chrishunt has quit [Ping timeout: 260 seconds]
himsin has quit [Ping timeout: 246 seconds]
<workmad3>
tfrew: I suspect that Daemons will use some form of daemonising tool in your OS, which frequently don't pull across your environment
chrisramon has left #ruby [#ruby]
cbuxton has quit [Client Quit]
cakehero has quit [Quit: Computer has gone to sleep.]
lggr has quit [Ping timeout: 276 seconds]
roadt has joined #ruby
MissionCritical has joined #ruby
troessner has joined #ruby
akem has joined #ruby
nga4 has joined #ruby
chussenot has quit [Quit: chussenot]
dakine has joined #ruby
chussenot has joined #ruby
chussenot has quit [Read error: Connection reset by peer]
chussenot_ has joined #ruby
lggr has joined #ruby
daniel_-_ has quit [Ping timeout: 245 seconds]
hotovson_ has joined #ruby
mahmoudimus has joined #ruby
KillerFox has joined #ruby
chussenot_ has quit [Remote host closed the connection]
dr_bob has joined #ruby
starship_ has joined #ruby
daniel_-_ has joined #ruby
katrina has joined #ruby
dr_bob has quit [Client Quit]
zmo_ has quit [Ping timeout: 246 seconds]
daniel_-_ has quit [Client Quit]
himsin has joined #ruby
jrajav has joined #ruby
lggr has quit [Ping timeout: 265 seconds]
starship_ has quit [Changing host]
starship_ has joined #ruby
starship is now known as Guest74193
Guest74193 has quit [Killed (brooks.freenode.net (Nickname regained by services))]
starship_ is now known as starship
chussenot has joined #ruby
Guest74193 has joined #ruby
abionic has quit [Ping timeout: 245 seconds]
lggr has joined #ruby
tjbiddle has joined #ruby
Coolhand has quit [Ping timeout: 244 seconds]
JohnBat26 has quit [Ping timeout: 252 seconds]
mahmoudimus has quit [Quit: Computer has gone to sleep.]
x82_nicole has joined #ruby
graeme has quit [Quit: graeme]
hashpuppy has quit [Quit: hashpuppy]
h4mz1d has joined #ruby
mando has joined #ruby
straind has joined #ruby
jasond has joined #ruby
Tearan has joined #ruby
arturaz has quit [Ping timeout: 265 seconds]
morozovm has quit [Read error: No route to host]
morozovm has joined #ruby
graeme has joined #ruby
blazes816 has joined #ruby
lggr has quit [Ping timeout: 255 seconds]
Servidorv has joined #ruby
PragCypher has quit [Read error: Connection reset by peer]
eldariof has quit []
PragCypher has joined #ruby
tnk1 has joined #ruby
cakehero has joined #ruby
akem has quit [Ping timeout: 246 seconds]
margle has joined #ruby
lggr has joined #ruby
kil0byte_ has joined #ruby
starship has quit [Quit: Leaving]
reisl has quit [Quit: Leaving]
ferb has joined #ruby
samphippen has quit [Quit: Computer has gone to sleep.]
verto|off is now known as verto
sspiff has quit [Remote host closed the connection]
philcrissman has quit [Remote host closed the connection]
Trioke has joined #ruby
kil0byte has quit [Ping timeout: 260 seconds]
ferb has quit [Remote host closed the connection]
AlbireoX has joined #ruby
deadalus has joined #ruby
deadalus has quit [Changing host]
deadalus has joined #ruby
lggr has quit [Ping timeout: 245 seconds]
deadalus has quit [Client Quit]
zmo_ has joined #ruby
mahmoudimus has joined #ruby
lggr has joined #ruby
thmzlt has quit [Read error: Connection reset by peer]
thmzlt has joined #ruby
<arietis>
i have hosting with ruby CLI but ut says no web sites support
starship has joined #ruby
<arietis>
the question is what's the point to have ruby installed then
creede has joined #ruby
tjbiddle has quit [Quit: tjbiddle]
<arietis>
it*
<ddd>
ruby is a scripting language ruby isn't just website frameworks like Rails.
<arietis>
so i can run apps?
<arietis>
via ssh
<ddd>
ruby is its own language and you can use it for your backend scripting. ask your hoster why they give you 'hosting' but tell you no websites unless you're using a learning VM or something
<ddd>
probably.
Tearan has quit [Quit: Sleepy Badger....]
<ddd>
who knows. ask your hoster that
slainer68 has quit [Remote host closed the connection]
Coolhand has joined #ruby
<creede>
Hi all. Why would rvm stop working correctly when I ssh into a host? If I ssh into my dev machine, source the rvm script and try to run ruby it just gives me an error saying I need to install ruby. (This is on Ubuntu 12.04)
<ddd>
#rvm
mikepack has joined #ruby
lggr has quit [Ping timeout: 260 seconds]
<Xeago>
creede probably path
banister`sleep has quit [Read error: Connection reset by peer]
Dreamer3 has quit [Ping timeout: 246 seconds]
<ddd>
and probably no rvm controlled ruby installed
chin-tastic has joined #ruby
<ddd>
or if it is you're not sourcing ruby correctly, or have no default ruby defined so rvm is using the system rvm which it doesn't control.
<creede>
ddd, no, ruby and rvm work fine at the local console, but for some reason not remotely
<creede>
Xeago, hold on, let me look at my path
<ddd>
creede: I *am* talking on the remote host
<Xeago>
sorry ;)
colinbm has quit [Quit: colinbm]
<Xeago>
creede, I hate and despise rvm
<Xeago>
don't have more information than usual caveats
<bnagy>
ssh can be weird sometimes
<bnagy>
in terms of environments etc
lggr has joined #ruby
slainer68 has joined #ruby
<creede>
Xeago, fair enough but I'm trying to learn Rails and everything I've read said to install it through rvm, so being a Ruby newbie (but not new to Linux) that's what I did.
tk___ has quit [Quit: ばいばい]
zmo_ has quit [Quit: Leaving]
<Xeago>
try ruby version managers
<ddd>
thats what RVM is.
<Xeago>
if wish to use different versions of ruby
<Xeago>
if you already have ruby
<Xeago>
here is a listing: rbenv, rvm, rbfu
<Xeago>
and only wish to use that version
<ddd>
try rvm, rbfu, rbenv, any of them
<Xeago>
there is no need to install any of the versioners
<creede>
Once I know as much Ruby as I do Perl I can probably take off the training wheels :-)
<ddd>
just realize that going forward rails 4.0 when it is released will have no ruby 1.8.7 support, so you'll need to make sure you install your OS's packages for ruby 1.9.x
<creede>
but that won't happen for a while
Dreamer3 has joined #ruby
<ddd>
well you can learn ruby 100% without rails. Rails extends the base Ruby classes and unless you specifically read the Rails framework's API docs you won't know where.
<creede>
ddd, at the local host I can use 1.9.3, no problems at all. I have "source /path/to/rvm" in my .zshrc and it works fine.
samphippen has joined #ruby
cbuxton has joined #ruby
<creede>
ddd, yes of course and that is my intent, to learn ruby and then rails
<ddd>
rails is specifically a web application framework, and to use it properly you'll need to know ruby in the first place, especially since Rails is written *in* ruby
<ddd>
ok
peterhellberg has quit [Remote host closed the connection]
<ddd>
for a book, I specifically recommend TWGR (The Well-Grounded Rubyist)
<creede>
ddd, yep, been through the koans once, gonna do it again. Right now I'm in the middle of Ruby The Hard Way and I think I have iwanttolearnruby bookmarked
<ddd>
have fun
RJ3000_ has quit []
<ddd>
cool
JonnieCache has quit [Quit: Lost terminal]
<creede>
ddd, thanks, yeah it's kind of like when I first set out to learn Perl mumbledyump years ago, lots to learn and having a good time doing it
robotmay has quit [Ping timeout: 240 seconds]
<ddd>
same
lggr has joined #ruby
dbruns has joined #ruby
<creede>
I've also done Rails For Zombies which gives me an idea of what to expect in Rails but of course I will need to dive in and learn more about models and controllers and stuff
<creede>
My background is more in system automation than in web stuff
thmzlt has left #ruby [#ruby]
<arietis>
can anyone link me good resource about web hosting providers which have ruby support?
margle has quit [Quit: Computer has gone to sleep.]
JonnieCache has joined #ruby
ryanlecompte has joined #ruby
<dbruns>
how can I use ||= when the expression is a block of code? can you do something like @cached_instance_var ||= do … end ?
<arietis>
i don't need rails support, just basic ruby web scripts
<workmad3>
dbruns: no
<workmad3>
dbruns: you could either do a 'return @cached_instance_var if @cached_instance_var' at the top of your memoized method, or you could to something like '@cached_instance_var ||= proc{...}.call
sn0wb1rd has quit [Quit: sn0wb1rd]
<dbruns>
if you have def cached_instance_var …[block of code] and the last line is @cached_instance_var = [last_expression] … does that work?
rehat has quit [Remote host closed the connection]
<dbruns>
OK
samuel02 has quit [Remote host closed the connection]
<dbruns>
thats what I thought. I was just making sure there wasn't an easier/simpler way
lggr has quit [Ping timeout: 245 seconds]
<workmad3>
dbruns: you could also pull the code out into a different method and have your getter as '@cached_instance_var ||= calculate_expensive_value'
robotmay has joined #ruby
<creede>
All, right, I have no idea what I just did, but after futzing with rvm for a while now suddenly "ruby --version" works and I can run my script.
<Spooner>
dbruns : You can use @x ||= begin; x = 25 * frog; x; end
vectorshelve has quit [Quit: Page closed]
<creede>
I can begin to see why Xeago doesn't like it :-)
<creede>
Thanks for the chat all, I'm off to go rubify myself.
<ddd>
:shrug: it (in 99% of cases) fails to operate correctly due to misconfiguration by the user(s)
<workmad3>
creede: did you add the line to source RVM to the appropriate bashrc or zshrc file?
<creede>
workmad3, yeah it's the last line in .zshrc
mucker has quit [Quit: leaving]
<workmad3>
creede: and did you set a default ruby?
<dbruns>
I don't even know if what I'm doing is going to work. I'm using the databasedotcom gem and I'm materializing some Salesforce objects. I need to test if the scope of the newly created ruby objects is outside of the method I'm 'materializing' :-) this might all be pointless
<ddd>
workmad3: actually it should be .bash_profile for bash. whatever the equiv is for zsh
<creede>
workmad3, yeah, 1.9.3-whatever
<RubyRails>
@arietis; doesn't get much easier than heroku
<ddd>
or appfog
<arietis>
RubyRails: is there any trial?
<workmad3>
ddd: I get annoyed remembering when .bash_profile or .bashrc get called on different linuxes... so my .bash_profile is 'source .bashrc' ;)
a_a_g has joined #ruby
Mon_Ouie has quit [Ping timeout: 245 seconds]
Xeago has quit [Ping timeout: 265 seconds]
<invisime>
workmad3: ++
Mon_Ouie has joined #ruby
Mon_Ouie has quit [Changing host]
<RubyRails>
@arietis for a basic ruby web script, your needs might be small enough that it's free!
Mon_Ouie has joined #ruby
<workmad3>
arietis: it's free for single-dyno apps
<arietis>
RubyRails: so it's web hosting? or what
<JonnieCache>
its infrastructure-as-a-service
<JonnieCache>
but yes its basically web hosting
<workmad3>
well, sort of
<ddd>
workmad3: reason for calling from .bash_profile is some parts of rvm are interactive, calling from .bashrc means non-interactive sessions would call it (the right way with .bashrc is to add the $rvm_path/bin to PATH) and 'hang'
<JonnieCache>
actually no its not iias its platform as a service
<JonnieCache>
gotta get the buzzwords right!
<Spooner>
workmad3: Not entirely, since free dynos get put to sleep if not continually accessed. So they are not really useful (yeah, I know you you can cheat).
lggr has joined #ruby
<creede>
ok, well off to go do some more scripting. Thanks again all!
creede has quit [Quit: Leaving]
<ddd>
workmad3: thats why rvm.io describes both the interactive environment (.bash_profile) and rvm for scripting (.bashrc)
<workmad3>
Spooner: that doesn't stop my statement being 100% accurate
<workmad3>
Spooner: just that 1 dyno apps have limitations :)
<Spooner>
Yes, it is free as long as you don't mind your page taking 30s to load ;)
<ddd>
which for a free system, one shouldn't mind. not paying for it
<workmad3>
Spooner: the one thing I have running on heroku where that's important, I used that cheat :)
<Spooner>
workmad3 : Yeah, I gave up on a project when I realised this. I keep meaning to go back to it and cheat :D
<workmad3>
ddd: meh, it still annoys me remembering the differences :P
<ddd>
workmad3: hehe
margle has joined #ruby
<Spooner>
Annoying there isn't a very good very-low-traffic system. Paying per-month per dyno (or similar), isn't too good. I wouldn't mind paying, but I realise it is hard to keep a fat Ruby process running even if it isn't being used.
<workmad3>
ddd: and I do that with my personal .bash_profile :P
<ddd>
workmad3: just needed saying is all
<workmad3>
Spooner: appfog?
<ddd>
i know you well enough to know you know what you're doing
<metrix>
Does anyone know of some example rake files where you can test/compile multiple applications of the same type, without copying the bulk of the rake file into each application directory?
lggr has quit [Ping timeout: 245 seconds]
Forevernade has joined #ruby
<ddd>
i've seen people use git repos, make multiple submodules of the multiple appls like you mention, and then in the main repo they write a single rake and in the rake they move into each individual submodule's dir and run specific commands.
<ddd>
but idk of anything in the wild that does it like that. this was in-house stuff
<Spooner>
workmad3 : I'll look at it.
adeponte has joined #ruby
<workmad3>
metrix: or you could move your rake tasks into a gem and simply pull them into a tiny Rakefile in each app
lggr has joined #ruby
<ddd>
but the reasoning mentioned for doing it that was for what you said
anderse has quit [Quit: anderse]
Iszak has quit [Quit: User has gone to sleep.]
<metrix>
hmm...
<ddd>
err s/that was/that way was/
akem has joined #ruby
zii has joined #ruby
cheesedanish has joined #ruby
ForevernadeAFK has quit [Ping timeout: 255 seconds]
friskd has quit [Quit: friskd]
cheesedanish has left #ruby [#ruby]
<metrix>
I see.. I worked at a company that had a top level make file that compiled down through all directories and over 100 applications... you could also just type make in a single directory if you didn't need everything compiled.. I wanted to replicate that with Rake
kil0byte_ has quit [Ping timeout: 255 seconds]
kil0byte has joined #ruby
lggr has quit [Ping timeout: 246 seconds]
alvaro_o has joined #ruby
morozovm has quit [Read error: Connection reset by peer]
saschagehlich has quit [Ping timeout: 248 seconds]
morozovm has joined #ruby
slainer68 has quit [Remote host closed the connection]
saschagehlich has joined #ruby
matrixise has quit [Ping timeout: 260 seconds]
Servidorv has quit [Ping timeout: 246 seconds]
lggr has joined #ruby
chin-tastic has quit [Ping timeout: 240 seconds]
replore_ has quit [Remote host closed the connection]
jadon has joined #ruby
kil0byte_ has joined #ruby
mmitchel_ has quit [Remote host closed the connection]
zigomir has quit [Ping timeout: 252 seconds]
mmitchell has joined #ruby
Morkel has quit [Quit: Morkel]
kil0byte has quit [Ping timeout: 246 seconds]
lggr has quit [Ping timeout: 252 seconds]
siyusong has joined #ruby
h4mz1d has quit [Ping timeout: 246 seconds]
frogprince_mac has joined #ruby
<Spooner>
metrix that should be possible. Just need to have the main make file import all the rake files in the sub-directories and give them namespaces based on the project name or something.
tjbiddle has joined #ruby
lggr has joined #ruby
tjbiddle has quit [Remote host closed the connection]
<jadon>
Hello, is there an entry point method to instantiate an inherited class inside of a static method? Here's a gist of my issue https://gist.github.com/afb35ae86f6bd192fb44 Any help would be appreciated.
tjbiddle has joined #ruby
Servidorv has joined #ruby
punkrawkR has joined #ruby
FernandoBasso has joined #ruby
<Spooner>
jadon it is a "class method" - static is not Ruby lingo.
bradhe has quit [Remote host closed the connection]
<JonnieCache>
jadon: yeah there isnt such a thing as a static method in ruby
slainer68 has joined #ruby
slainer68 has quit [Remote host closed the connection]
<JonnieCache>
jadon: because youre defining the method on self, within the class, self within the context of that method is the class
<JonnieCache>
so its calling << on the Array class which obviously doesnt work
<jadon>
but self trumps the inherited class?
<JonnieCache>
sorry thats my mistake
possibilities has joined #ruby
<JonnieCache>
its calling << on TestArray
<JonnieCache>
I think you actually want an instance method
timmow has quit [Quit: is having a nap]
<Spooner>
Yes, but why would you want to do TestArray.add - you don't actually want a class method.
ephemerian has quit [Quit: Leaving.]
<JonnieCache>
ie you should `def add` instead of `def self.add`
troessner has quit [Quit: Leaving]
<jadon>
I was trying to avoid actually instantiating the class
lggr has quit [Ping timeout: 246 seconds]
<Spooner>
Yes, but if you don't instantiate it, there isn't an array to append onto.
Servidorv has quit [Ping timeout: 240 seconds]
<jadon>
right. That is why I was curious if there was a way to super the array through some kind of entry point
<Spooner>
I suspect you are applying non-Ruby ideas onto Ruby and getting lost.
yxhuvud has joined #ruby
<jadon>
your suspicion would be fairly accurate I fear
<Spooner>
What do you want to be able to do? (not how do you want to implement it).
zemanel has joined #ruby
<jadon>
in a group of classes be able to iterate ObjectA without having to send it to every class via arg/prop
SegFaultAX|work has joined #ruby
<Spooner>
I don't understand what you mean, sorry.
Synthead has joined #ruby
siyusong has quit [Read error: Connection reset by peer]
graeme has quit [Quit: graeme]
<Spooner>
JonnieCache : You getting this?
siyusong has joined #ruby
lggr has joined #ruby
<jadon>
updated Gist
sn0wb1rd has joined #ruby
roadt has quit [Ping timeout: 260 seconds]
Xeago has joined #ruby
Taranis has left #ruby [#ruby]
<jadon>
that is a rough idea
sneakyness_wk has joined #ruby
baphled has quit [Ping timeout: 276 seconds]
bradhe has joined #ruby
Serial_Killer_C has joined #ruby
Servidorv has joined #ruby
g00se_ has joined #ruby
<JonnieCache>
this all sounds very java
Jellyg00se has quit [Read error: Connection reset by peer]
<Spooner>
You are using #map and then throwing away the result. I think you mean mean to use #each. However, I suspect what you want is not what you are doing - you basically want a global array which can be accessed in each of those classes?
GoGoGarrett has joined #ruby
<jadon>
Yes.
daniel_hinojosa1 has joined #ruby
<jadon>
without having to pass in the class as an arg/prop
Xeago has quit [Remote host closed the connection]
<Spooner>
Do Blah and Bleh not have common ancestry?
<jadon>
no.
metrix has quit [Quit: ChatZilla 0.9.89 [Firefox 16.0/20121005155445]]
friskd has joined #ruby
lggr has quit [Ping timeout: 246 seconds]
melzz has joined #ruby
possibilities has quit [Remote host closed the connection]
g00se_ has quit [Remote host closed the connection]
katrina has quit [Quit: Leaving]
Jellyg00se has joined #ruby
morozovm has quit [Read error: Connection reset by peer]
<squareduck>
But I don't see why you'd need something like that.
tommyvyo_ has quit [Quit: Computer has gone to sleep.]
<Spooner>
squareduck : You haven't implemented each_value and it is the same except I use class instance variables (good) and you use class variables (bad).
mucker has joined #ruby
lggr has joined #ruby
<jadon>
Trying to avoid the class vars in such a way
<Spooner>
Yes, but you need a variable somewhere!
<jadon>
What would be the suggested Ruby way? Just carry the object over through method args or props?
prtksxna has joined #ruby
kil0byte_ has quit [Ping timeout: 256 seconds]
pjb1 has quit [Ping timeout: 256 seconds]
margle has quit [Quit: Computer has gone to sleep.]
<Spooner>
You could do similar to mine, but include Test in each Blah/Bleh to expose the methods. Probably the cleanest way, but not the simplest.
mklappstuhl has joined #ruby
<jadon>
it seems to be the only way to do it outside of sending the Object to any class that is going to call it via args or props
marty_mcfly has joined #ruby
noxoc has quit [Quit: Leaving.]
sertaconay has joined #ruby
<marty_mcfly>
what is a general rule of thumb with 'require' ; when do i have to include full path and when is it not necessary ?
tommyvyo_ has joined #ruby
tommyvyo_ has quit [Changing host]
tommyvyo_ has joined #ruby
dakine has quit [Quit: Leaving]
<Mon_Ouie>
You should always set the $LOAD_PATH properly and just use require 'some_dir/foo'
lggr has quit [Ping timeout: 272 seconds]
<Mon_Ouie>
If you're using rubygems, it will take care of setting the load path
<workmad3>
Mon_Ouie: you never advocate using require_relative?
Jellyg00se has quit [Quit: Leaving]
<Mon_Ouie>
No, but I never advocate never using require_relative either :p
AlbireoX has quit [Remote host closed the connection]
<harushimo>
I'm wondering if I'm doing my class eval wrong
<shevy>
ewwww evals!
<harushimo>
I know
lggr has quit [Ping timeout: 252 seconds]
<shevy>
no idea, I hate evals
<blazes816>
what's the best practice for checking for the existence of an element in a large (huge?) array? I'm looking at the c implementation and it's the naive algorithm it looks like.
<harushimo>
so do I
irleif has joined #ruby
<shevy>
I use it for one config file, which acts as a hash
<shevy>
but every key in that hash, also becomes a method
<blazes816>
any built-in support for larger datasets?
<burgestrand>
blazes816: if you can put it in a Set or a Hash instead and use that for lookup, way faster
<shevy>
so { :foo => "bar"} becomes object.foo
tvw has quit [Remote host closed the connection]
<shevy>
and returns string "bar"
<shevy>
but I HATE the code I wrote for it
<burgestrand>
actually, putting it in a Set is pretty much same thing as a Hash, both need to be unique
<shevy>
(and openstruct does give me things which I dont need, so I cant use it)
<blazes816>
burgestrand: thanks, I'll look at how ruby searches sets
rosipov has joined #ruby
<harushimo>
any suggestions
<burgestrand>
arielpts: after you have done gem install you can remove the .gem
xargoon has joined #ruby
<burgestrand>
blazes816: a ruby Set is a Hash under the hood, it’ll be a hash lookup
<blazes816>
oh, hmmmm
<blazes816>
that sounds good
<rosipov>
asked on #rails, but here it's more appropriate - does gem have it's own PATH in windows? gem install -l fails because it can't find git (git works from both cmd or ruby cmd)
lggr has joined #ruby
<blazes816>
thanks, I'll give it a shot!
sent-hil has quit [Remote host closed the connection]
<shevy>
I used something like ... my_hash_here.each_pair.each { |key, value| self.class.class_eval { add_getter_method(key); add_setter_method(key) } }
abionic has joined #ruby
<ddd>
rosipov: no, it uses the system PATH. All it looks at is GEM_DIR, GEM_PATH, and I believe RUBY_HOME, and RUBYOPT.
<harushimo>
oh
<Spooner>
harushimo : the code you put inside an eval still has to be code that would run outside. You have to remember that a string won't magically interpolate variables for you.
<burgestrand>
harushimo: what is up with the comma?
shadoi has joined #ruby
<harushimo>
its a copy and paste
<rosipov>
ddd: but it fails with an error 'git ls-files can\'t find file specified'
<harushimo>
right
hbpoison has quit [Ping timeout: 276 seconds]
shevy has quit [Read error: Operation timed out]
<burgestrand>
not sure how that code can even run without a syntax error
<harushimo>
does that code valid for the return output I'm doing?
<ddd>
plus any augmentation you add in your personal environment
<rosipov>
ddd: thank you
<Marken23>
Does anybody know why I always get a name error #<NameError: uninitialized constant Easypaste::Paste> with this code https://gist.github.com/3893737 when I run paste.async_archive?
<ddd>
rosipov: np
Takehiro has joined #ruby
CodeDroid__ has joined #ruby
<burgestrand>
harushimo: that is still a syntax error
<blazes816>
that worked great burgestrand, thanks again
chrishunt has joined #ruby
<burgestrand>
blazes816: :)
hoffmanc has quit [Ping timeout: 248 seconds]
chin-tastic has joined #ruby
<harushimo>
ok
lggr has quit [Ping timeout: 252 seconds]
<burgestrand>
harushimo: why don’t you try to run your code before asking for help?
<Spooner>
harushimo : I don't think you can write dynamic code until you can write code. Read up a bit more on how methods work.
<harushimo>
I've been reading on it since last night
<harushimo>
all you are doing is returning array of elements that is stored in a history variable
<harushimo>
my question is how are you storing the variables in the array and accessing it?
Vainoharhainen has quit [Quit: Leaving...]
lggr has joined #ruby
<burgestrand>
harushimo: you need to write your own setter
sent-hil has joined #ruby
jimeh has joined #ruby
<harushimo>
%q{"def history = value} to start off
<burgestrand>
harushimo: you only have a reader there and some other thing that just causes a syntax error
abionic has quit [Read error: Connection reset by peer]
Marken23 has quit [Quit: Page closed]
<burgestrand>
harushimo: no, what is history? you don’t use history in your code below
<harushimo>
its in my class eval method
<burgestrand>
write it without metaprogramming first
<burgestrand>
just create a getter bar, a setter bar= and a getter bar_history
davidcelis has joined #ruby
<harushimo>
ok
<harushimo>
now I'm really confused. I understand the concept of the getter and setter
Jellyg00se has joined #ruby
<harushimo>
bar = value bar_history = bar ?
<harushimo>
be right back
<harushimo>
one sec
jslowe has joined #ruby
<burgestrand>
maybe just write a getter bar, and a setter bar= first
lggr has quit [Ping timeout: 256 seconds]
rosipov has quit [Quit: leaving]
<harushimo>
ok
<burgestrand>
without using attr_reader or attr_writer or attr_accessor
brianpWins has joined #ruby
Marken23 has joined #ruby
<harushimo>
do that in the class eval
lggr has joined #ruby
<harushimo>
bar = first
<Marken23>
I have this https://gist.github.com/3893737 code, but I always get a #<NameError: uninitialized constant Easypaste::Paste> when I run Paste.async_archive, does anybody know why?
`brendan has quit [Read error: Connection reset by peer]
creede has quit [Client Quit]
<harushimo>
ok
sepp2k1 has joined #ruby
uris_ has quit [Quit: Lost terminal]
<burgestrand>
harushimo: no metaprogramming, just "def bar … end"
<burgestrand>
make it simple
cardoni has quit [Quit: cardoni]
kil0byte_ has joined #ruby
reinaldo_ has joined #ruby
sepp2k has quit [Ping timeout: 245 seconds]
hoffmanc has joined #ruby
<harushimo>
I'm curious how you do it with metaprogramming
cardoni has joined #ruby
<harushimo>
I've been looking at the solution too
<burgestrand>
I’m not so sure you can do it without it
<burgestrand>
You should grab somebody from your class or school or whatever that knows this and get them through it with you
hadees has joined #ruby
lggr has quit [Ping timeout: 255 seconds]
<burgestrand>
IRC can only give you an answer, it’s not good at teaching you the answer
<Spooner>
burgestrand : You can do it without eval, but eval seems to be a requirement of the assignment.
<burgestrand>
I need to go, glhf
<harushimo>
yeah it is
shevy has joined #ruby
<harushimo>
I've been working on this two days
<harushimo>
no head way
<burgestrand>
Spooner: yeah, I just wish he could understand what he needs the eval to do before trying it
reinaldob has quit [Ping timeout: 252 seconds]
<harushimo>
I get what eval is doing to
<burgestrand>
Now he’s just guessing and that won’t get him forward
* Spooner
nods.
<burgestrand>
Sorry if I sound mean, I’m just very low on time, ta-ta :P
<harushimo>
thats okay
kil0byte has quit [Ping timeout: 260 seconds]
Guest22757 has joined #ruby
<harushimo>
sorry I'm really struggling with this concept
haxrbyte_ has quit [Ping timeout: 245 seconds]
samuel02 has joined #ruby
ForevernadeAFK has joined #ruby
<RubyPanther>
#send and define_method mean never having to say eval
PragCypher has quit [Read error: Operation timed out]
<RubyPanther>
In Ruby, you should only eval after you understand how to not-eval, and then only because you have some excuse you think is good enough.
<harushimo>
ok
chussenot has quit [Ping timeout: 255 seconds]
<Spooner>
RubyPanther : Irrelevant if an assignment demands eval.
<RubyPanther>
Nothing "demands eval" in Ruby.
<havenn>
harushimo: Pretend eval does not exist, move on.
<harushimo>
all I'm trying to do is the get ouput
Servidorv has quit [Quit: The early bird may get the worm, but the second mouse gets the cheese]
lggr has joined #ruby
<Spooner>
RubyPanther : No, I mean the assignment asks for eval, not that the assignment needs eval.
<Spooner>
Thus you must use eval.
Forevernade has quit [Ping timeout: 240 seconds]
<RubyPanther>
Oh, it is homework is what you meant
<Spooner>
Yes, it is. Nothing to do with best-practice.
<RubyPanther>
Well, hopefully he doesn't get any help lol
<harushimo>
hey
reinaldo_ has quit [Remote host closed the connection]
<harushimo>
this is the first problem I've asked.
Eiam has joined #ruby
<harushimo>
its okay if you don't help, I can figure threw solutions which I've been looking at
nitti has joined #ruby
<harushimo>
its look like class eval is pretty powerful method
<Spooner>
RubyPanther : Since it is an assignment for year one of a large uni, the answer is all over the net. However harushimo actually wants to do it ;)
<harushimo>
thank you
<harushimo>
I'm trying to leanr
<harushimo>
I mean learn
<ddd>
harushimo: excellent path man
<Spooner>
So I don't see any problem with helping. The problem is with grasp of Ruby, not the assignment, per se.
<harushimo>
I can't figure this solution out at all
<RubyPanther>
Spooner: research is most of what people learn the first year, presumably
bricker has joined #ruby
<harushimo>
I don't mean to start argument here
<RubyPanther>
Actually I remember my first year classes, half the students flunked out and switched majors
<Spooner>
Yes, the ability to use Google ;) Especially since it seems to be automatically marked.
<harushimo>
I'm just trying to figure this out
g0bl1n has joined #ruby
rubious has joined #ruby
apok has joined #ruby
<Spooner>
Have you implemented it as burgestrand suggested?
<RubyPanther>
Half the rest got too much help and didn't switch majors until the second year even though they couldn't do any of the work
philips- has joined #ruby
<harushimo>
yeah I did but I still need to use the eval
<Spooner>
Get it working as you want it to without using dynamic code first.
<harushimo>
the only i didn't understand burgerstrand solution was this part
lggr has quit [Ping timeout: 244 seconds]
<harushimo>
def bar ...end
IrishGringo has joined #ruby
<bricker>
Is there a way to set "self" inside of a method? I know you can't actually set it. But if I want to have a method I can call that takes a block, and any method inside of that block will be called on something besides the "self" that the original method was... I hope that makes sense.
<harushimo>
where does that go
<Spooner>
RubyPanther : That is what web development is for. Takes the people who have bad CS degrees ;)
<harushimo>
just for the record, I don't have a cs degree
<harushimo>
just saying
<RubyPanther>
Spooner: if they have a client and a finish line, they're way more likely to be successful than if they're trying to get a degree
<Mon_Ouie>
bricker: 3.instance_eval { puts self }
<Spooner>
bricker : You want instance_eval or class_eval...yeah.
mucker has quit [Quit: leaving]
maletor has joined #ruby
lggr has joined #ruby
<Mon_Ouie>
It's more often used with a block passed as an argument to get pretty syntax, though
<bricker>
Mon_Ouie: Spooner Right! thanks.
<Mon_Ouie>
If it's to e.g. alter ivars, you'd be better off defining new methods on the other object
eldariof has joined #ruby
Banistergalaxy has joined #ruby
Scriptwriter has joined #ruby
CodeDroid__ has quit [Ping timeout: 246 seconds]
<bricker>
Mon_Ouie: So I can do something like 3.instance_eval block.call ?
Scriptwriter has quit [Client Quit]
<Spooner>
bricker 3.instance_eval &block
Scriptwriter has joined #ruby
mmitchel_ has joined #ruby
<bricker>
I see
siyusong has quit [Quit: siyusong]
philips_ has quit [Remote host closed the connection]
<Spooner>
Assuming block is a Proc or similar, of course.
<bricker>
right
<arietis>
if i have config.ru file it means it's rack application?
<bricker>
arietis: ru = "rackup"
<bricker>
(yes)
nitti has quit [Ping timeout: 244 seconds]
Guest22757 has quit [Ping timeout: 240 seconds]
<Spooner>
It could be for configuring Russia.
<arietis>
yeah, that was my 1st thought
<bricker>
One does not configure Russia
lggr has quit [Ping timeout: 246 seconds]
thedeadghost has quit [Ping timeout: 245 seconds]
<bricker>
Only Putin configure Russia
thejoecarroll has left #ruby [#ruby]
AndChat| has quit [Ping timeout: 255 seconds]
voodoofish430 has joined #ruby
ukd1 has joined #ruby
Servidorv has joined #ruby
<arietis>
putin doesn't, it's new world order who does :)
lggr has joined #ruby
khakimov has joined #ruby
mmitchell has quit [Ping timeout: 246 seconds]
elaptics is now known as elaptics`away
<shevy>
lol
jrist is now known as jrist-afk
thedeadghost has joined #ruby
jgrevich_ has joined #ruby
robotmay has quit [Remote host closed the connection]
hotovson_ has quit [Remote host closed the connection]
graeme has joined #ruby
PragCypher has joined #ruby
jgrevich has quit [Ping timeout: 255 seconds]
jgrevich_ is now known as jgrevich
Rydefalk_ has joined #ruby
Rydefalk has quit [Read error: Connection reset by peer]
lggr has quit [Ping timeout: 246 seconds]
<harushimo>
I got it to print the memory location of f and f.bar
<harushimo>
now how do I store it in an array
chimay has quit [Quit: WeeChat 0.4.0-dev]
<harushimo>
all the variables and then do the class eval
<Mon_Ouie>
memory location?
lggr has joined #ruby
dmiller has quit [Remote host closed the connection]
Marken23 has quit [Quit: Page closed]
PragCypher has quit [Read error: Operation timed out]
Guest22757 has joined #ruby
<aces1up>
hey all I have an app that has a contants file, many I need set certain ways based on production compile or not.. What is a good method for setting these without having to do a BLAH = Production? ? 'one' : 'two' for each and every constant?
froy has joined #ruby
<harushimo>
when you create an object in ruby, f = Foo.new
<Mon_Ouie>
No, it doesn't. It gives you an identifier unique to that object. What it actually corresponds to is an implementation detail, and not something you should be concerned with.
lggr has quit [Ping timeout: 260 seconds]
jrajav has joined #ruby
jbw has quit [Read error: Operation timed out]
<harushimo>
I'm sorry
<Mon_Ouie>
(If the assignment asks you to find the memory location of a Ruby object, they're doing it wrong)
<harushimo>
you are right
mklappstuhl has quit [Ping timeout: 252 seconds]
<harushimo>
you are totally correct. I messed up
lggr has joined #ruby
irleif has quit [Quit: Computer has gone to sleep.]
<harushimo>
I'm working on this class eval problem. I'm trying to learn it
<harushimo>
i'm confusing stuff right now
jimeh has quit [Quit: bye]
soulcake has quit [Read error: Connection reset by peer]
recycle has joined #ruby
lggr has quit [Ping timeout: 272 seconds]
samuel02 has quit [Ping timeout: 246 seconds]
nitti has joined #ruby
morozovm has quit [Read error: Connection reset by peer]
morozovm has joined #ruby
musl has quit [Quit: Upgrades.]
mklappstuhl has joined #ruby
kenneth has quit [Quit: kenneth]
PragCypher has joined #ruby
ctevie has quit [Quit: Connection closed for inactivity]
`brendan has joined #ruby
lggr has joined #ruby
hbpoison has joined #ruby
samuel02 has joined #ruby
margle has joined #ruby
advorak has joined #ruby
thedeadghost has quit [Ping timeout: 246 seconds]
Rydefalk_ has quit [Read error: Connection reset by peer]
margle has quit [Client Quit]
Rydefalk has joined #ruby
emmanuelux has joined #ruby
lggr has quit [Ping timeout: 252 seconds]
danguita has quit [Quit: @danguita quits 0.3.9]
chrisja has quit [Quit: leaving]
hbpoison has quit [Ping timeout: 255 seconds]
lggr has joined #ruby
<Servidorv>
hey guys
<Servidorv>
how are you
<Servidorv>
i have a question
<Servidorv>
what does posts.map do |post| do??
havenn has quit [Remote host closed the connection]
h4mz1d has joined #ruby
_marvin has quit [Quit: Connection closed for inactivity]
adeponte has quit [Remote host closed the connection]
<Mon_Ouie>
It maps each post to a new object and returns the result as an array.
<Mon_Ouie>
It's hard to tell what it's used for without the complete expression, though.
<Servidorv>
ok
<Servidorv>
and if inside posts i have another array say likes
<Servidorv>
how can i extrac only that likes array??
morozovm has quit [Read error: Connection reset by peer]
samuel02 has quit [Ping timeout: 255 seconds]
morozovm has joined #ruby
<Servidorv>
could it be posts.likes.map ??
samuel02 has joined #ruby
sspiff has joined #ruby
sspiff has quit [Changing host]
sspiff has joined #ruby
<Servidorv>
sorry im a php coder that is trying to learn ruby
siyusong has joined #ruby
<Mon_Ouie>
No, because posts is an arary, and it is your post object that has a #likes methods, not the array object
<Mon_Ouie>
Therefore you need to call the #likes method on each individual post
<Mon_Ouie>
For instance, you can do posts.map { |post| post.likes }
lggr has quit [Ping timeout: 260 seconds]
<Mon_Ouie>
Try those in Pry or IRB, to see what it does exactly
<arietis>
any idea if there is a good tutorial about sinatra?
savage- has joined #ruby
<Servidorv>
ok
<Servidorv>
thanks Mon_Uoie
lggr has joined #ruby
<Servidorv>
sorry Ouie
awestroke has quit [Remote host closed the connection]
kenneth has joined #ruby
slainer68 has joined #ruby
Russell^^ has joined #ruby
ryanlecompte has quit [Ping timeout: 246 seconds]
g0bl1n has quit [Quit: Leaving]
ckrailo has joined #ruby
reset has joined #ruby
kieppie has joined #ruby
`brendan has quit [Read error: Connection reset by peer]
reset has quit [Read error: Connection reset by peer]
<Servidorv>
I there, question: how can i extrat info from an array that is inside another array, right now for the first array i have to be able to access it posts.map do |post
<Servidorv>
¬
<Servidorv>
|
<Servidorv>
how can i access array likes that is inside array posts
<Servidorv>
yeah for example inside posts i have the id the comment the date, and i have a likes array that gives me each person that like that one posts
jslowe has quit [Ping timeout: 245 seconds]
<swarley>
oh, no bot
<Servidorv>
so right now i have
<Servidorv>
def extract_relevant_info(posts)
<Servidorv>
posts.map do |post|
<Servidorv>
'id' => post['id'], etc
williamcotton has quit [Quit: williamcotton]
<swarley>
use gist.github.com
d2dchat has quit [Remote host closed the connection]
<blazes816>
posts.map{|post|….. post.likes….}
<Servidorv>
ok
<swarley>
I'm not really sure what you're trying to do
zemanel has quit [Quit: Remote hottie closed the connection]
<swarley>
how long have you been using ruby?
jrist is now known as jrist-mtg
<Servidorv>
no much
<Servidorv>
i started like a week ago
<swarley>
that's what i thought
<Servidorv>
im a php coder
<benwoody>
harushimo: you spelled initialize wrong
manizzle has quit [Ping timeout: 256 seconds]
<Servidorv>
lol sorry bro
<benwoody>
and c wasn't getting the CartesianProduct because you weren't creating a new object with 2 params
<Servidorv>
but i really want to learn ruby now
thmzlt has joined #ruby
<swarley>
its no problem, i was just wondering because of certain use of terminology. If you were a veteran user i'd call you on it but since you're new I'll let it pass
lggr has joined #ruby
<Servidorv>
thanks
<Servidorv>
what terminology so i can learn
thejoecarroll has joined #ruby
<swarley>
when you use {} as a constructor, that's called a Hash
Neomex has joined #ruby
havenn_ has joined #ruby
<Servidorv>
oh ok
<Servidorv>
thanks
<swarley>
any time you use something with a named list foo["bar"]
<swarley>
that's a hash
<swarley>
arrays use numerical indexes
<Servidorv>
oh ok
<Servidorv>
thanks so i have a hash inside an array then
<thejoecarroll>
hi folks
<swarley>
Yes
<Servidorv>
thanks man
<swarley>
{} is a hash, [] is an array
jrajav has quit []
chin-tastic has quit [Ping timeout: 246 seconds]
<thejoecarroll>
anyone here encountered and solved a problem with the sqlite3 gem on os x mountain lion?
reset has joined #ruby
<RubyPanther>
No, nobody ever solved a sqlite3 problem because as soon as they had one they realized they weren't saving any time and switched to a real database.
seanyo has quit [Ping timeout: 246 seconds]
lggr has quit [Ping timeout: 252 seconds]
<thejoecarroll>
haha RubyPanther
SegFaultAX|work has joined #ruby
<wmoxam>
thejoecarroll: whats the trouble?
<thejoecarroll>
i need it for a rails dev project/course assignment
<swarley>
ew rails
<thejoecarroll>
LoadError: cannot load such file -- sqlite3/sqlite3_native
<thejoecarroll>
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `require'
<RubyPanther>
ew assignment
<thejoecarroll>
:-)
<harushimo>
oh
bradhe has quit [Ping timeout: 240 seconds]
<harushimo>
my bad
<swarley>
also, berkly database is tasty
<thejoecarroll>
i can put the full backtrace in gist if it helps
centipedefarmer has joined #ruby
<wmoxam>
thejoecarroll: how did you install sqlite3?
jenrzzz has joined #ruby
thmzlt has left #ruby [#ruby]
<thejoecarroll>
wmoxam: the gem or the db itself?
Xeoncross has joined #ruby
<wmoxam>
thejoecarroll: the db itself
lggr has joined #ruby
<RubyPanther>
swarley: YAML is almost like a Berkeley database, except without the corrupt easter eggs
<thejoecarroll>
i haven't installed it separately (unless railsinstaller.org's package installs it; got to check), just the one included in the system
<swarley>
RubyPanther; i'm talking about for on disk operations
<thejoecarroll>
$ which sqlite3
<swarley>
sbdb is the easiest i've seen
musl has joined #ruby
musl has quit [Client Quit]
macmartine has joined #ruby
Aristata has quit [Read error: Connection reset by peer]
<thejoecarroll>
oops
<wmoxam>
:D
<thejoecarroll>
results in: /usr/bin/sqlite3
<thejoecarroll>
sqlite3 --version
<thejoecarroll>
gives me 3.7.12 2012-04-03 19:43:07 86b8481be7e76cccc92d14ce762d21bfb69504af
<arietis>
xclite: local copy works fine on localhost
lggr has quit [Ping timeout: 252 seconds]
<swarley>
try changing '/static' to '/static/'
mneorr has joined #ruby
adeponte has joined #ruby
<swarley>
(not fully sure, but that would make sense to me)
williamcotton has joined #ruby
savage- has quit [Ping timeout: 256 seconds]
<matti>
;]
<RubyPanther>
swarley: anybody old enough to used bdb should be pedantic enough by now to know that it writes as often as you want it to. And you don't need to write more often, because your data isn't safe anyways (if you wanted it safe you'd use a "real" database) and you don't need it to write quickly because bdb can't scale anyways.
internet_user has quit [Remote host closed the connection]
rakl has quit [Quit: sleeping]
Serial_Killer_C has joined #ruby
freezey has joined #ruby
geekbri has quit [Remote host closed the connection]
lggr has quit [Ping timeout: 246 seconds]
<qizwiz>
so how do I tell ruby that a file is an erb template? In other words, after I've done foo = File.open("somefile.xml.erb", "rb")
<qizwiz>
how do I say foo is really erb
bluOxigen has quit [Ping timeout: 245 seconds]
<swarley>
isnt it something like erb "somefile.xml"
lggr has joined #ruby
<benwoody>
ERB.new(filename) i think
Tearan has joined #ruby
<qizwiz>
yeah, yeah...duh
<qizwiz>
thanks
kjellski has joined #ruby
<qizwiz>
lemme try that. brb
dmiller has quit [Remote host closed the connection]
mmitchel_ has quit [Remote host closed the connection]
mmitchell has joined #ruby
internet_user has joined #ruby
elaptics`away is now known as elaptics
clj_newb has quit [Ping timeout: 252 seconds]
lggr has quit [Ping timeout: 246 seconds]
<swarley>
this can only be bad
lggr has joined #ruby
* swarley
begins to code the nqp for a ruby interpreter
bradhe has joined #ruby
freezey has quit [Quit: freezey]
replore has joined #ruby
PragCypher has quit [Read error: Connection reset by peer]
kenneth has quit [Read error: Connection reset by peer]
kenneth has joined #ruby
bradhe has quit [Remote host closed the connection]
PragCypher has joined #ruby
possibilities has joined #ruby
bradhe has joined #ruby
tjbiddle_ has joined #ruby
havenn_ has joined #ruby
lggr has quit [Ping timeout: 245 seconds]
ckrailo has quit [Quit: Leaving...]
<qizwiz>
no good. It thinks the filename I'm passing is actually the string it's supposed to interpret
jrist-mtg is now known as jrist
steffes has joined #ruby
freezey has joined #ruby
jenrzzz has quit [Ping timeout: 248 seconds]
rubious has joined #ruby
lggr has joined #ruby
havenn has quit [Remote host closed the connection]
<swarley>
ERB.new(File.read filename)
tjbiddle has quit [Ping timeout: 272 seconds]
tjbiddle_ is now known as tjbiddle
araujo has quit [Ping timeout: 246 seconds]
nyuszika7h has quit [Ping timeout: 246 seconds]
<FernandoBasso>
I just read this example: puts "#{"Tora! " * 3}" I don't understand if it is closing the string after the second " or what... What is happening there?
havenn has joined #ruby
araujo has joined #ruby
araujo has joined #ruby
<Spooner>
FernandoBasso : Well, it is running "Tora! " * 3 inside a string (Which is "Tora! Tora! Tora! "),
<Spooner>
#{} is to run code inside the string.
ckrailo has joined #ruby
<FernandoBasso>
But I don't understand... It seems to me that -Tora!- appears after the second " colsed/matched the first one, therefore closing the string.
<FernandoBasso>
Like if Tora! is naked (not inside "").
Xeago has joined #ruby
krawchyk has quit [Remote host closed the connection]
lggr has quit [Ping timeout: 260 seconds]
<FernandoBasso>
I do understand that #[
havenn_ has quit [Ping timeout: 245 seconds]
<Spooner>
I don't understand what you mean by closing a string.
<FernandoBasso>
I do understand that #{} enables one to write ruby code inside a string, though.
<FernandoBasso>
"The first quote opens a string, and the second quote closes one".
nyuszika7h has joined #ruby
lggr has joined #ruby
SegFaultAX|work has quit [Ping timeout: 252 seconds]
<FernandoBasso>
"#{" <-- Doesn't hat open and close the string?
<swarley>
no
<swarley>
because
<swarley>
#{ } is a separate context
<Spooner>
Oh, I see. After #{ it assumes everything inside is code until it reaches the }
Neomex has quit [Quit: Neomex]
<Spooner>
Ignoring ", of course.
<FernandoBasso>
Yeah, that is the case then.
<FernandoBasso>
Thanks. (the book shoud make that more clear).
<Spooner>
That example is dumb of course, since you could just: puts ("Tora! " * 3)
irleif has joined #ruby
<Spooner>
But people just love to have nothing but an interpolation in a string ;)
<invisime>
FernandoBasso: no. because the #{ puts the next " in the context in which the #{} is executed. in terms of nesting, by the time you look at "#{" you've nested 3 times. once to enter an interpolated string, once to enter the interpolation context, and once again to enter a string within the interpolation context within the interpolated string.
g-ram has quit [Quit: Computer has gone to sleep.]
<invisime>
Spooner: that's waaay easier than calling to_s. ;-)
theRoUS has quit [Remote host closed the connection]
<FernandoBasso>
invisime: All right. I get it. Thank you too.
<Spooner>
Yeah, but people still do it when they just have a string. x = 12; y = "#{x}" _almost_ makes sense!
<invisime>
FernandoBasso: yeah, my explanation was too wordy. I didn't see that you'd gotten it by the time I'd finished typing. XD
theRoUS has joined #ruby
theRoUS has joined #ruby
theRoUS has quit [Changing host]
irleif has quit [Client Quit]
<invisime>
Spooner: that same example with x = "12" is pretty dumb though. :-P
<Spooner>
I know. That was my point.
<FernandoBasso>
No problem. That is actually good. More than one way to explain and understand something couldn't do anybody any harm.
lggr has quit [Ping timeout: 272 seconds]
xorgnak has quit [Remote host closed the connection]
lggr has joined #ruby
<havenn>
I kinda like that you can interpolate instance variables without the squiggly braces: @danger = 'Llamas'; "Beware, #@danger!"
SegFaultAX|work has joined #ruby
<havenn>
#=> "Beware, Llamas!"
replore has quit [Ping timeout: 252 seconds]
stephenjudkins has joined #ruby
<Spooner>
I'm still in two minds about that, havenn. I find #{@danger} more consistent than that special case.
adeponte has quit [Remote host closed the connection]
kil0byte has joined #ruby
Scriptwriter has quit [Quit: Things are more like they are now than they have ever been before.]
<havenn>
Spooner: As long as syntax highlighters color it like interpolation, I kinda like it as shorthand for 'interpolate but just this i_var, no methods are attached'
<Servidorv>
question, can i have a .map inside a .map
<havenn>
Spooner: But yeah, inconsistent can look ugly.
<Servidorv>
or should i do .each and than a .map
<Servidorv>
??
<Spooner>
servidorv : Depends what you want to achieve.
nanderoo has quit [Quit: Leaving.]
<Spooner>
But you _may_ do either without problems.
<Spooner>
servidorv : You have extra { on line 78.
moshee has quit [Ping timeout: 252 seconds]
moshee has joined #ruby
moshee has joined #ruby
moshee has quit [Changing host]
<Spooner>
It should be posts.each do |post| --- and no } on 91
<Servidorv>
ok thanks
<Servidorv>
i just added that one
<Servidorv>
so the code ran without it
Krists has quit [Ping timeout: 276 seconds]
irleif has joined #ruby
<Servidorv>
in the page it tells me Error:undefined method `[]' for nil:NilClass
possibilities has quit [Remote host closed the connection]
love_color_text has quit [Remote host closed the connection]
<Spooner>
Again, there are lots of [] - what line?
kpshek has joined #ruby
lggr has quit [Ping timeout: 260 seconds]
love_color_text has joined #ruby
<Servidorv>
in the page it sais no line
<Servidorv>
is the
<Servidorv>
users = likes['data']
<Spooner>
Right, then that implies that post doesn't have a key ['likes']
khakimov has quit [Quit: Computer has gone to sleep.]
<Spooner>
Are you sure it shouldn't be post[:likes] ?
<thejoecarroll>
so, i go sqlite3 fixed (the gem appeared to be installed but native extensions were missing, so reinstalling it worked), but now it have this (and reinstalling the debugger gems didn't help much): https://gist.github.com/5003769f144bb1018779
<thejoecarroll>
s/go/got
<thejoecarroll>
good evening again Spooner
<Spooner>
'ello
schronicles47 has joined #ruby
<davidcelis>
Hey guys, I'm trying to fix my fresh installation of 1.9.3-p286 on Mountain Lion. I have openssl and readline installed via homebrew, so I installed Ruby using CONFIGURE_OPTS="--with-openssl-dir=`brew --prefix openssl` --with-readline-dir=`brew --prefix readline`"
lggr has joined #ruby
<davidcelis>
But any ruby script hitting an HTTPS endpoint fails with: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
<Servidorv>
it is -likes:{-data:[-{name:"susan", id:"4"}]}
sent-hil has quit [Remote host closed the connection]
schronicles47 has quit [Remote host closed the connection]
steffes has quit [Remote host closed the connection]
<davidcelis>
I tried downloading an SSL certificate and adding SSL_CERT_FILE=/path/to/cert.pem in my profile, which hasn't worked. I'm not sure what else to do
<Spooner>
You should reference it with post[:likes] then. { xx: 12} is shorthand for { :xx => 12 }
<davidcelis>
shit, never mind. i typoed the path. that fixed it hahahha
sent-hil has joined #ruby
<Servidorv>
i think it is because not all posts have like
<Servidorv>
na the hash i just gave you is json
<Servidorv>
but the code is ruby
robertotauille has joined #ruby
<Servidorv>
ok thanks
<Spooner>
servidorv : Or are you talking about JSON, not Ruby in telling what likes is?
havenn_ has joined #ruby
<Spooner>
Right, well, that could be either. As JSON converted to Ruby, you should use posts['likes'] as you were doing.
<Servidorv>
so i will do an if key exists
<Spooner>
That would do it.
<Servidorv>
thanks
justinmcp has joined #ruby
lggr has quit [Ping timeout: 272 seconds]
Virunga has quit [Remote host closed the connection]
lggr has joined #ruby
<Servidorv>
what is the difference of has_key? and has_key??'
<heftig>
servidorv: the latter is a has_key? followed by a ternary operator
<Servidorv>
ok thanks
<Servidorv>
man you guys rock
g-ram has joined #ruby
<asteve>
servidorv: thanks
netrealm has joined #ruby
robertotauill has quit [Ping timeout: 272 seconds]
<Servidorv>
i have never seen a group of people that will answer questions as fast and nicely like you guys
<Servidorv>
thanks man
SegFaultAX|work has quit [Ping timeout: 246 seconds]
<Spooner>
Give it another couple of days, then we'll kill you.
samuel02 has joined #ruby
<Servidorv>
im learning ruby and here i've learn so fast with your answers
<swarley>
Lol
<heftig>
that said, has_key? takes an argument, so it should be "has_key?(:foo)?"
<Servidorv>
thanks
irleif has quit [Quit: Computer has gone to sleep.]
<heftig>
not sure where you saw has_key??
<Servidorv>
if post.has_key?("likes")
<swarley>
I've noticed that ruby and functional languages have more forgiving communities
<thejoecarroll>
anyone know how to fix "Symbol not found: _ruby_current_thread (LoadError)" from ruby-debug-base19 stoping rails server from working? https://gist.github.com/5003769f144bb1018779
margle has quit [Quit: Computer has gone to sleep.]
BSaboia has joined #ruby
<swarley>
perl and c variants will destroy you
<Servidorv>
well thats why im learning ruby
<Servidorv>
lol
havenn_ has quit [Ping timeout: 240 seconds]
lggr has quit [Ping timeout: 256 seconds]
<swarley>
like, the more perlists in a room, the angrier they are to outsiders
GoGoGarrett has quit [Remote host closed the connection]
emergion has joined #ruby
<swarley>
And i've noticed that most people that code in only c, expect you to know most everything
SegFaultAX|work has joined #ruby
<Spooner>
swarley: Yeah, but we are mainly pure Rubyists, but mostly not Rails. I've heard Rails is a Ghetto, you know ;)
<swarley>
I for one, hate rails
SJr has quit [Excess Flood]
<swarley>
I don't care if it "saved ruby"
SJr has joined #ruby
<invisime>
sinatra's ok.
<swarley>
It's bloated, and does't feel like ruby
* invisime
ducks.
<Spooner>
That is it, we hate Rails people more than non-Rubyists or complete noobs ;)
<swarley>
If I have to use a web framework, I use sinatra
<Spooner>
Or aliens or people who wear socks with sandals!
GoGoGarrett has joined #ruby
carloslopes has quit [Quit: Leaving.]
havenn has quit [Remote host closed the connection]
<invisime>
like, if you really do need a web front end for a database that is world-facing.
<swarley>
well, rails is full of people who are using it for a project that has no business using rails
<invisime>
to be fair, there are good reasons to use rails.
<swarley>
it has good things for MAJOR applications
<invisime>
ah, the curse of being a trendy buzzword.
macmartine has joined #ruby
emergion has quit [Client Quit]
<Spooner>
Yes, if you are a train.
<swarley>
and have no clue how to use ruby
<swarley>
sure there are
Forevernade has quit [Remote host closed the connection]
lggr has joined #ruby
<swarley>
If you expect like, tons and tons and tons of traffic and you need to do tons and tons and tons of things, sure use rails why not
robertotauille has quit [Quit: Leaving...]
<swarley>
but if you're doing a few things, and basic web server activities, there is no reason to use rails
margle has joined #ruby
<Servidorv>
rails is like cakephp they are preatty much the same, and i was going to start rails, but i decided that i had to learn ruby first
<invisime>
nice catch, Spaceghostc2c. I don't have enough php background to have noticed that. XD
lggr has quit [Ping timeout: 240 seconds]
<swarley>
maybe i will
hadees has quit [Quit: hadees]
<swarley>
unrelated
<Spooner>
swarley servidorv: Gods, you guys are dumb. Can't you roll your own web app without a framework? Just do puts "<html>Hello world" (closing tags are for losers) and you are half-way there..
schronicles47 has joined #ruby
schronicles4799 has joined #ruby
Tom2 has quit [Ping timeout: 256 seconds]
schronicles47 has quit [Remote host closed the connection]
schronicles4799 has quit [Remote host closed the connection]
<Spooner>
No, people who use flashing marquees are 1337.
<swarley>
omgya
<swarley>
also people who make snowflakes go down their webpage and not let you stop it
sent-hil has quit [Ping timeout: 240 seconds]
sailias has quit [Quit: Leaving.]
[Neurotic] has quit [Remote host closed the connection]
<Servidorv>
lololol
<swarley>
well i mean you CAN stop it
<swarley>
but i'm too lazy to open up the javascript console or stop the javascript on the page
apeiros_ has joined #ruby
<Servidorv>
well cakephp is a good starting point, besides it is ready to do and if you learn to use it the right way it can save you lots of time coding, besides the db handeling is preatty good too.
<swarley>
I was interested by cardinal (Ruby on Parrot VM)
<swarley>
but then i looked at it
<swarley>
and..
<swarley>
just no
<swarley>
it would take a ton of reworking to make it usable
<arietis>
noob question - in order to submit form and make ruby process query with submitted data which method should i use?
<arietis>
POST?
<swarley>
it had already broken standard and the parser isnt even finished
<swarley>
yes
<swarley>
you can use either, but POST is recommended
lggr has quit [Ping timeout: 248 seconds]
eldariof has quit []
<swarley>
Someone should work with me to make this usable
advorak has quit [Quit: This computer has gone to sleep]
bapa has joined #ruby
lggr has joined #ruby
invisime has quit [Quit: Leaving.]
irleif has joined #ruby
realniko has joined #ruby
dmiller has quit [Ping timeout: 265 seconds]
apok_ has joined #ruby
Xeago has quit [Remote host closed the connection]
arielpts has quit [Excess Flood]
Xeago has joined #ruby
arielpts has joined #ruby
arielpts has quit [Excess Flood]
lggr has quit [Ping timeout: 252 seconds]
arielpts has joined #ruby
arielpts has quit [Excess Flood]
arielpts has joined #ruby
arielpts has quit [Excess Flood]
stoffus has quit [Quit: The computer fell asleep]
ukd1 has quit [Ping timeout: 256 seconds]
<Spooner>
You are too leet. You'd make us all look bad, swarley.
arielpts has joined #ruby
apok has quit [Ping timeout: 245 seconds]
apok_ is now known as apok
baphled has joined #ruby
hotovson has quit [Remote host closed the connection]
<swarley>
D: I am not, I wish I was though
havenn has joined #ruby
lggr has joined #ruby
justinmcp has quit [Remote host closed the connection]
chussenot has joined #ruby
undersc0re97 has joined #ruby
qizwiz has quit [Ping timeout: 255 seconds]
Scriptwriter has joined #ruby
answer_42 has quit [Quit: WeeChat 0.3.9]
jenrzzz has joined #ruby
apeiros_ has quit [Remote host closed the connection]
hotovson has joined #ruby
awestroke has quit [Remote host closed the connection]
haxrbyte has quit [Remote host closed the connection]
lggr has quit [Ping timeout: 256 seconds]
Xeago has quit [Ping timeout: 252 seconds]
artOfWar has joined #ruby
havenn has quit [Ping timeout: 240 seconds]
jenrzzz has quit [Read error: No route to host]
lggr has joined #ruby
Tearan has quit [Quit: Sleepy Badger....]
nateberkopec has joined #ruby
tjbiddle_ has joined #ruby
hotovson has quit [Ping timeout: 246 seconds]
postmodern has joined #ruby
mmitchell has quit [Ping timeout: 246 seconds]
anderse has quit [Quit: anderse]
csaunders has quit [Read error: Operation timed out]
freezey has quit [Quit: freezey]
indian has joined #ruby
indian has quit [Changing host]
indian has joined #ruby
verto is now known as verto|off
tjbiddle has quit [Ping timeout: 246 seconds]
tjbiddle_ is now known as tjbiddle
Monie has quit [Ping timeout: 244 seconds]
sent-hil has joined #ruby
hussein- has joined #ruby
xclite has quit [Remote host closed the connection]
lggr has quit [Ping timeout: 260 seconds]
zodiak has quit [Remote host closed the connection]
yxhuvud has quit [Ping timeout: 260 seconds]
ephemerian has joined #ruby
beit has quit [Quit: beit]
lggr has joined #ruby
uris_ has quit [Quit: leaving]
jenrzzz has joined #ruby
cpruitt has joined #ruby
havenn has joined #ruby
replore has joined #ruby
stephenjudkins has quit [Quit: stephenjudkins]
mando has quit [Remote host closed the connection]
mvangala has quit [Remote host closed the connection]
siyusong has quit [Quit: Computer has gone to sleep.]
lggr has quit [Ping timeout: 260 seconds]
irleif has quit [Quit: Computer has gone to sleep.]
thedeadghost has quit [Ping timeout: 272 seconds]
replore has quit [Ping timeout: 244 seconds]
hotovson_ has joined #ruby
Vinz_ is now known as Vinz_`
lggr has joined #ruby
banseljaj is now known as imami|afk
`brendan has quit [Quit: - nbs-irc 2.39 - www.nbs-irc.net -]
awarner has joined #ruby
Assurbanipal has joined #ruby
Naeblis has joined #ruby
lggr has quit [Ping timeout: 260 seconds]
nggrb has quit [Quit: leaving]
lggr has joined #ruby
splud has joined #ruby
<splud>
new to ruby. Need to modify some scripts.
<splud>
Have a script that takes as a parameter a string. Need to change this to an array of strings.
dangerousdave has quit [Quit: Leaving...]
joshman_ has quit [Ping timeout: 244 seconds]
xaq has quit [Remote host closed the connection]
schronicles47 has joined #ruby
<splud>
so, check(filter=nil) to check(*filter) seems to be what we do.
iamjarvo has quit [Ping timeout: 245 seconds]
<splud>
Now, how to compare results against the array?
<splud>
is there an array.in sort of accessor/method? if filter.in( someval ) ?
eignerchris has joined #ruby
xaq has joined #ruby
r1ddl3r has joined #ruby
Naeblis has left #ruby ["Leaving"]
punkrawkR has quit [Read error: Connection reset by peer]
lggr has quit [Ping timeout: 272 seconds]
iamjarvo has joined #ruby
Jork1 has quit [Quit: Jork1]
Serial_Killer_C has quit [Remote host closed the connection]
dpk has quit [Quit: Ceci n'est pas une broken pipe.]
lggr has joined #ruby
dpk has joined #ruby
IrishGringo has quit [Remote host closed the connection]
melzz has joined #ruby
Jork1 has joined #ruby
kyletcarey has joined #ruby
mercwithamouth has quit [Ping timeout: 256 seconds]
Vinz_` is now known as Vinz_
Jork1 has quit [Client Quit]
tfrew has joined #ruby
Vinz_ is now known as Vinz_`
Jork1 has joined #ruby
Jork1 has quit [Client Quit]
<splud>
found Array.select{|v| v =~ /element/}
lggr has quit [Ping timeout: 256 seconds]
<splud>
now, how might I change /element/ to be a variable reference rather than an immediate string?
CannedCorn has joined #ruby
<splud>
(or, er, string literal)
lggr has joined #ruby
thejoecarroll has left #ruby [#ruby]
drago757 has joined #ruby
undersc0re97 has quit [Read error: Connection reset by peer]
advorak has joined #ruby
undersc0re97 has joined #ruby
r1ddl3r has quit [Quit: Leaving.]
lggr has quit [Ping timeout: 252 seconds]
workmad3 has joined #ruby
lggr has joined #ruby
<Spooner>
Hi splud
Assurbanipal has quit [Read error: Connection reset by peer]
GoGoGarrett has quit [Remote host closed the connection]
internet_user has quit [Remote host closed the connection]
asteve has quit []
EPIK has joined #ruby
nga4 has quit [Ping timeout: 255 seconds]
<Spooner>
you can interpolate in regexp, so you could Array.select{|v| v =~ /#{str}/} though if it is just looking for a plain substring, you can just do Array.select{|v| v[str] } (v[str] will be nil if the string isn't found).
Assurbanipal has joined #ruby
alanp has joined #ruby
alanp has quit [Read error: Connection reset by peer]
<Spooner>
Actaully, you could array.grep /#{str}/ as well. Options are endless ;)
alanp_ has quit [Read error: Connection reset by peer]
alanp has joined #ruby
tfrew has quit [Ping timeout: 240 seconds]
lggr has quit [Ping timeout: 248 seconds]
bbttxu has joined #ruby
cdzombak has quit []
nitti has quit [Remote host closed the connection]
hussein- has quit [Ping timeout: 240 seconds]
Orcris has quit [Ping timeout: 246 seconds]
lggr has joined #ruby
JonnieCache has joined #ruby
melzz_ has joined #ruby
samuel02 has quit [Remote host closed the connection]
stopbit has quit [Quit: Leaving]
kn330 has quit [Ping timeout: 240 seconds]
melzz has quit [Read error: Connection reset by peer]
<swarley>
i hate writing syntax grammar
<swarley>
i mean
<swarley>
how much sense does this look like it makes?!?!?!
<aantix>
This expression, zzzz = zzzz || 1, why doesn't it complain about zzzz being undefined?
<workmad3>
swarley: doesn't look too awful, but does need a bit more knowledge as to how the syntax grammar is built :)
apok has quit [Quit: apok]
v0n has quit [Ping timeout: 246 seconds]
<aantix>
A similar expression, zzzz = eee || 1, it complains about eee not being defined.
IrishGringo has joined #ruby
<swarley>
workmad3; its weird
cpruitt has quit [Quit: cpruitt]
kn330 has joined #ruby
<workmad3>
swarley: I suspect it's BNF-esque :)
<swarley>
token term { \h*\n | \h*';' }
<swarley>
It's NQP, which is a perl6 subsect
JonnieCache has quit [Ping timeout: 248 seconds]
lggr has joined #ruby
<swarley>
but what the hell is \h?!?
<swarley>
i just saw that in an example file
SegFaultAX|work has quit [Read error: Operation timed out]
sepp2k has quit [Remote host closed the connection]
<ddd>
in bash it means hostname
<ddd>
don't know about there
<swarley>
i double that's what it means
<swarley>
doubt
<swarley>
&
<ddd>
i double doubt :)
<Servidorv>
hey guys
<Servidorv>
once again
<splud>
having a problem with the #{var.str} syntax in the .select method -- the var is a class. If i puts var.str, I get the string I'm looking for, but if I select {|v| v =~ /#{var.str}/}, the returned string is the classname.somehexvalue.
<Servidorv>
can you guys help me see what im doing wrong
<Spooner>
splud Sorry, what do you want to come out?
philcrissman has joined #ruby
<workmad3>
servidorv: correct, because that's what .each does
<workmad3>
servidorv: .each isn't a filter method
davidcelis has quit [Quit: K-Lined.]
<Servidorv>
ok so how can i do it so it isolate to only likes
<workmad3>
servidorv: take a guess at a method that might be used to 'select' the values you want ;)
lggr has quit [Ping timeout: 246 seconds]
<Servidorv>
select??
<Servidorv>
thanks man
davidcelis has joined #ruby
<workmad3>
servidorv: and afterwards, look up the ruby Enumerable documentation and memorise the hell out of it
<Servidorv>
i will
<Spooner>
splud : that #select picks all the array elements for which that regexp matches. If that is not what you want, then it won't be right.
Ankhers has quit [Remote host closed the connection]
nga4 has joined #ruby
bigkevmcd has joined #ruby
Tearan has joined #ruby
lggr has joined #ruby
paolooo has joined #ruby
panpainter has joined #ruby
icole has quit [Remote host closed the connection]
icole has joined #ruby
apok has joined #ruby
SegFaultAX|work has joined #ruby
hussein- has joined #ruby
hussein- has quit [Changing host]
hussein- has joined #ruby
lggr has quit [Ping timeout: 246 seconds]
mercwithamouth has joined #ruby
maletor has quit [Quit: Computer has gone to sleep.]
Servidorv has quit [Quit: If at first you don't succeed, skydiving is not for you]
lggr has joined #ruby
justinmcp has joined #ruby
maletor has joined #ruby
iamjarvo has quit [Ping timeout: 245 seconds]
jrist is now known as jrist-afk
philcrissman has quit [Remote host closed the connection]
Assurbanipal|2 has joined #ruby
Assurbanipal has quit [Read error: Connection reset by peer]
dmiller has joined #ruby
icole has quit [Remote host closed the connection]
nga4 has quit [Ping timeout: 240 seconds]
lggr has quit [Ping timeout: 260 seconds]
netrealm has quit [Quit: leaving]
hadees has quit [Quit: hadees]
glupo has quit [Remote host closed the connection]
lggr has joined #ruby
<swarley>
god... i HAAATE writing grammars
local has joined #ruby
<Spooner>
Eat pie instead then. Noone hates pie.
sent-hil has quit [Remote host closed the connection]
sent-hil has joined #ruby
lledet has quit [Quit: lledet]
<voodoofish430>
Has anyone ever done load testing with ruby?
mmitchell has joined #ruby
piotr__ has quit [Ping timeout: 246 seconds]
sent-hil has quit [Remote host closed the connection]
hadees has joined #ruby
lggr has quit [Ping timeout: 255 seconds]
awestroke has joined #ruby
<Spooner>
voodoofish430 : You mean with Rails or Sinatra, not Ruby itself, I assume?
dbruns has quit [Quit: dbruns]
margle has quit [Quit: Computer has gone to sleep.]
mmitchell has quit [Ping timeout: 246 seconds]
nwertman has quit [Quit: nwertman]
icole has joined #ruby
healpay has joined #ruby
lggr has joined #ruby
awestroke has quit [Remote host closed the connection]
nmurashev has joined #ruby
nmurashev has quit [Read error: Connection reset by peer]
nmurashev has joined #ruby
Russell^^ has quit [Quit: Russell^^]
Orcris has joined #ruby
nmurashev has quit [Read error: Connection reset by peer]
nmurashev has joined #ruby
gmcabrita has left #ruby [#ruby]
<voodoofish430>
Spooner: well, say I wanted to load test a rest api written using the Sinatra framework with ruby. Is there anything out there that can do this? I could write tests for the http calls, but to actually write something that can produce load, I'm not sure how that would be done. I could do it in Jmeter, but I wanted to keep it all ruby....
<ddd>
you wouldn't load test an api, you load test the machine responding via the api endpoint(s). Thats a whole different kettle of fish. An API doesn't have a load to test.
nmurashev has left #ruby [#ruby]
hoofman has quit [Ping timeout: 252 seconds]
natashatherobot has joined #ruby
daniel_- has quit [Ping timeout: 255 seconds]
noxoc has quit [Quit: Leaving.]
<Spooner>
voodoofish430 : I'd be surprised if such things didn't exist already in Ruby. Sadly, I haven't tried to do that; I was just asking to ensure I knew you were talking about server load testing, not something else (people are not often clear on here).
tpe11etier has joined #ruby
Xeoncross has quit [Quit: Ex-Chat]
IrishGringo has quit [Ping timeout: 246 seconds]
hussein- has quit [Ping timeout: 260 seconds]
judd7 has joined #ruby
<ddd>
Spooner: yeah thats why i said what i said. the way he worded it didn't suggest he wanted to test the *server*, it literally said he wanted to load test the *api*
local is now known as nwertman
<Spooner>
ddd Actually, I think I was the one that confused the issue, since I said "with Rails or Sinatra" rather than "test a Rails/Sinatra server".
<ddd>
you could write something using EM (eventmachine) it would also be affected by if you're using threads or not, etc. Might look at http://www.ruby-forum.com/topic/179748 though thats from 2009.
workmad3 has quit [Ping timeout: 245 seconds]
nateberkopec has quit [Quit: Leaving...]
<voodoofish430>
Spooner: ahh, cool, yeah, server side testing. I was looking at maybe playing around with the jruby integration of jmeter, but I haven't found much in the way of setting it up or......anything reallly
<Spooner>
ddd I would have thought, however, that Rails and/or Sinatra or Thin might have tools to help with load testing, even if would just be an external tool.
clj_newb has joined #ruby
<Spooner>
I think I meant Rack, not Thin, but really, I haven't a clue how all those layers work ;)
lggr has joined #ruby
<ddd>
voodoofish430: might want to look through http://www.rubyenterpriseedition.com/comparisons.html at how they do things, in the event you don't find some packaged deal tht does what you're wanting, to aid in how you go about it.
<voodoofish430>
Spooner: I've only seen them named in the gem server list. :)
<voodoofish430>
ddd: Thanks! :)
<ddd>
yes its for REE, however what they do might be of aid (not their showcasing)
<ddd>
np
dagnachewa has joined #ruby
nateberkopec has joined #ruby
<ddd>
also, while not stress testing, I would sign up for the free 30 days from newrelic, and run your app with it reporting back to your account and grab some additional info about your app. Might also help you streamline what it is you actually test.
<ddd>
see the newrelic site, and gem search newrelic —dr
<ddd>
their information breakdown might give you some insight.
<ddd>
write a test script to communicate with your endpoints spawning say 10k calls with varying information (could even parse a baseline from a csv or db) and see what they report. decent breakdown :shrug:
reuf has joined #ruby
lggr has quit [Ping timeout: 245 seconds]
nateberkopec has quit [Client Quit]
<voodoofish430>
interesting.
<voodoofish430>
Will check them out.
x82_nicole has quit [Quit: Computer has gone to sleep.]
<ddd>
for more stuff, i don't know if you tweet or not, but kick it out there and see what people respond with
<ddd>
or hit the ruby ML, or the ML associated with the engine you're using (sinatra or ramaze or something)