<erikh>
if they give any thought to their employees they will likely be able to answer anything reasonable you throw at them.
<zenspider>
14/hr?!?
<zenspider>
is that right?
<zenspider>
(should I shut up?)
<tran4>
zenspider yes $14. a lot of ads on my college's website are for unpaid internships
m3nd3s has joined #ruby-lang
<zenspider>
what college?
<tran4>
zenspider public school
<apeiros_>
depending on the country, that can be a lot for an internship. I think in my country it varies from ~1000$ to 5000$ per month, with 8h/d that'd be about 5.7$/h to 28.4$/h
<zenspider>
public school college... yeah. I can't see you getting much with a school like that
<erikh>
it's an internship
<erikh>
everyone knows they can low-ball the interns
tomzx has joined #ruby-lang
<qpingu>
You can get lucky though
<zenspider>
stupid cafe network
dv310p3r has joined #ruby-lang
<zenspider>
I think we paid interns _fairly_ well at amzn
<petercooper>
yeah, he just pasted a plain URL in, no link
<andrewvos>
Fail
<petercooper>
so I've just rewritten the post for him
<petercooper>
that particular problem doesn't happen much, thankfully
<erikh>
you could probably rig something up with URI.extract that can auto-highlight that
<petercooper>
normally it's people not knowing how an A tag works or being too lazy to write proper link text :)
<erikh>
err, auto-link
<andrewvos>
hahah I like the rewrite
<andrewvos>
Anyway, why would I even read that :)
<petercooper>
I write about 50 ledes a week so I've had the practice :P
<zenspider>
nice writeup tho
<epitron>
lol @ missing method_missing exception
<Asher>
why's that?
deryldoucette has joined #ruby-lang
<andrewvos>
Right, fuck everything about today. Night everyone.
<epitron>
Asher: it just sounded fun to debug
<Asher>
what if i insert an extra frame onto the backtrace that points back to where the call happened?
<epitron>
also, something about calling super inside method_missing seems like a delightfully convoluted way to code
<andrewvos>
Asher: What if I slip on a bar of soap in the shower? OH MY GOD I'D BE KILLED
<Asher>
that was recommended to me as the way to have ruby throw the methodmessing error internally
thone has joined #ruby-lang
<zenspider>
Asher: sounds overly clevar
<Asher>
i take it your preference would be to leave the exception thrown in method_missing?
<zenspider>
epitron: if your method_missing doesn't call super SOMEWHERE, you deserve a kick to the face
* epitron
puts method missings everywhere in zenspider's code with no supers
<petercooper>
remember to add your "super if meth == :zenspider_is_love" lines now folks
<deryldoucette>
thanks zenspider - my apologies to all. colloquy doesn't do the /sleep 5 ; /msg nickserv blah stuff like irssi. so it kept bouncing me and not identifying
* zenspider
greps his code for method_missing...
<andrewvos>
heheheh
* epitron
aliases it to method_supplied
<andrewvos>
deryldoucette: NEVER FORGET
<deryldoucette>
lol
<Asher>
this is the first time i've ever found what i thought to be an appropriate use for method missing
<Asher>
when bindings inherited from a superclass are renamed and have configuration procs that call the name defined before renaming, i want the block to redirect to the renamed binding instead of throwing an error
<petercooper>
apparently the 'wat' video also gave a big boost
<petercooper>
so the take away is.. do funny/silly stuff in public people find amusing but then do serious, awesome stuff on the backend that you charge for
<petercooper>
which seems like a nice approach
<zenspider>
yeah. idgi either
irb has joined #ruby-lang
<irb>
hello
<zenspider>
irb: 1 + 1
<zenspider>
irb is broken
<zenspider>
petercooper: fibur was a response to sinatra-synchrony
<zenspider>
foods... later
srbartlett has joined #ruby-lang
<deryldoucette>
hehe colloquy has a few bugs in it i see. reload the style after changing it to not show me part join quits and suddenly i don't see traffic in the channel. niiice (not)
_inc has joined #ruby-lang
<irb>
zenspider, don't follow
<irb>
anyways, i'm having trouble figuring out how to post a json payload using the RestClient class
<fragmachine>
Hey how can I search for 'something' or 'something else' With grep? Eg something like 'cats dogs kangaroos'.split.grep(/(cats)||(dogs)/) - retruns cats and dogs but not kangaroos?
<heftig>
|, not ||
<heftig>
also, those parentheses are superfluous
<nofxx>
fragmachine: str.match(/(cats|dogs)/) or something like it, might do the same
<fragmachine>
oh ok awesome!
<fragmachine>
ok cool thanks, I'll check them both out
Teddy2st_ has joined #ruby-lang
csherin has joined #ruby-lang
Tukeke has joined #ruby-lang
rohit has joined #ruby-lang
Tukeke has joined #ruby-lang
Luxx_ has joined #ruby-lang
jxie has joined #ruby-lang
<irb>
anyone familar with the RestClient class?
heppy has joined #ruby-lang
shevy has joined #ruby-lang
rippa has joined #ruby-lang
gokul has joined #ruby-lang
Jay_Levitt has joined #ruby-lang
dr0id has joined #ruby-lang
gianlucadv has joined #ruby-lang
Slackwise has joined #ruby-lang
wubofeng_ has joined #ruby-lang
pgpkeys has joined #ruby-lang
pgpkeys has joined #ruby-lang
voker57_ has joined #ruby-lang
nofxx has joined #ruby-lang
wlfman2k1 has joined #ruby-lang
kp666 has joined #ruby-lang
krz has joined #ruby-lang
wyhaines has joined #ruby-lang
krz has joined #ruby-lang
PsiliPharm has joined #ruby-lang
wubofeng has joined #ruby-lang
Pip has joined #ruby-lang
guns has joined #ruby-lang
twittard has joined #ruby-lang
qawsedrf has joined #ruby-lang
rohit has joined #ruby-lang
Teddy2steper has joined #ruby-lang
brownies has joined #ruby-lang
cdnz has joined #ruby-lang
JohnBat26 has joined #ruby-lang
Teddy2steper has joined #ruby-lang
cdnz has joined #ruby-lang
x0F__ has joined #ruby-lang
yxhuvud has joined #ruby-lang
sym- has joined #ruby-lang
Giddeon has joined #ruby-lang
stepnem has joined #ruby-lang
<qawsedrf>
is class methods considered bad ?
Defusal has joined #ruby-lang
Defusal has joined #ruby-lang
concernedcitizen has joined #ruby-lang
krzyhoo has joined #ruby-lang
<krzyhoo>
hello anyone
<rippa>
no
<krzyhoo>
can i forcethe initialize method NOT to create an objects if a condition is not met?
<krzyhoo>
in my example, if certain parameters were not supplied, it must not initialize an object
uniqanomaly_ has joined #ruby-lang
<krzyhoo>
and second question: how do i test with rspec if an object has not been created
<yxhuvud>
krzyhoo: I think you misunderstand something. initialize is called *after* the object is created
|Vargas| has joined #ruby-lang
<krzyhoo>
hmmmmm
|Vargas| has joined #ruby-lang
csherin has joined #ruby-lang
<krzyhoo>
well in that case if certain required parameters are missing, is the best practice to force the obect value to be nil?
<lianj>
maybe ruby -e 'class A; def self.new(*a); a.first == :test ? a : super(*a); end; end; p [A.new(:test), A.new]'
imrohit has joined #ruby-lang
dhruvasagar has joined #ruby-lang
Indian has joined #ruby-lang
<erikh>
you can override new, but I think you still have to call allocate?
<zenspider>
krzyhoo: raise ArgumentError
<lianj>
true, that would be nicer :)
ryez has joined #ruby-lang
<krzyhoo>
thanks mates
solars has joined #ruby-lang
<krzyhoo>
shit...how do you test with rspec is ArgumentError was raised?
<zenspider>
rspec sucks... in minitest/spec it'd be proc { raise ArgumentError }.must_raise ArgumentError
<rohit>
zenspider: Both minitest and rspec versions of checking error raised look the same. Any internal difference that makes minitest better?
QoQOoO has joined #ruby-lang
<zenspider>
many
<zenspider>
minitest w/ 3 different test frameworks is a total of 2515 lines (incl comments). rspec w/ deps is 12918.
<zenspider>
minitest/spec uses no monads, no magic, no clever, so the code is incredibly easy to debug and trace through
PsiliPharm has joined #ruby-lang
<amerine>
And often, you don't end up stepping through minitest. I can't count the number of times I've dug through rspec and rspec-rails checking for issues and fixing bugs.
<zenspider>
understanding how must_raise and all the methods that it calls requires reading < 50 loc
<zenspider>
amerine: I certainly have
<zenspider>
and you ALWAYS end up stepping through minitest... every time you see a backtrace in an error you see artifacts of minitest in there
<zenspider>
mine are terribly shallow... and because there's no magic, they're right at the source... not 400 miles away
<amerine>
zenspider: Forgive the non-100% accurate statement.
<zenspider>
that's what kills me about rspec... when I have a problem, I can't FIND where the problem is
<zenspider>
you can with minitest
<zenspider>
I should also say that assert_raises is the most complex assertion so that < 50 loc is usually more like 20
<amerine>
zenspider: I'm agreeing with you. rspec and specifically rspec-rails has caused a few headaches.
<zenspider>
if you want to write more assertions to clean up your tests, it is a loooot easier to do in minitest
<zenspider>
minitest flogs at JUST under 1900 w/ 12.4 / method on avg.
<zenspider>
rspec w/ deps flogs at ~9740 w/ 9.1 / method on avg (I'm kind surpised by that!)
fukushima has joined #ruby-lang
<zenspider>
I should prolly refactor my run method... it is getting hefty
<zenspider>
my max: 76.2
<zenspider>
rspec's max (really diff/lcs) is 298.3
<zenspider>
all of that translates to understandability and speed, smaller being better
<zenspider>
gah... diff/lcs is a monster. all 5 of the top 5 heaviest methods in that code tree are diff/lcs
<zenspider>
and all flog > 200
<zenspider>
end-rant
<rohit>
Hmm
<rohit>
Being able to dive into the source code is a big win imo. I think I'll use minitest in my new personal projects to try it out :)
<rohit>
zenspider: thanks! :)
<qawsedrf>
is class methods considered bad ? (from a testing point of view)
PsiliPharm has joined #ruby-lang
<zenspider>
qawsedrf: no? why would it?
<qawsedrf>
i am a noob, just read things like static methods are hard to test and mock ...
<zenspider>
qawsedrf: "static" is the tip-off... we're not C++/java
<qawsedrf>
hm, i thought class methods in ruby were like static methods from java only
dhruvasagar has joined #ruby-lang
ezkl has joined #ruby-lang
<rohit>
qawsedrf: They are considered bad because it's hard to inject dependencies. But in Ruby and other dynamic languages like it you can just do MyDependency = stub_for_dependency
csherin has joined #ruby-lang
<rohit>
I might be completely wrong though, so please check.
<amerine>
qawsedrf: You can think about class methods in Ruby like static methods in Java, except Ruby's class methods still have a self (this in java) accessor.
<amerine>
qawsedrf: ^^ Very very simple description, actual implementation is much more complex.
<amerine>
qawsedrf: As far as mocking, it's pretty easy to mock a class method in Ruby.
<qawsedrf>
ok
<amerine>
qawsedrf: Read "easy", as nearly exactly the same as instance methods. Also `def` is a magical mocking method. People hit a mocking library way to quickly.
robbyoconnor has joined #ruby-lang
<amerine>
qawsedrf: If you're new to Ruby, it might be worth your time to spend a little bit of time digging into the Ruby object model to understand how classes, instances and singleton classes interact.
<A124>
I got a question too.. why does not URI.escape, escape?
<A124>
Only I can think of is encoding issue, but it's the same on 1.8.7.
<rippa>
it does escape
<A124>
rippa: The thing is it does not escape '[]' for me. Although its in REGEXP::UNSAFE
<Zespre>
hi
<heftig>
A124: no, that's the character class in the RegExp
<A124>
heftig: URI.escape('[]') => "[]"
<heftig>
yep
<heftig>
correct behavior
<heftig>
[] is not unsafe
justinxreese has joined #ruby-lang
necromancer has joined #ruby-lang
<A124>
heftig: Hmm, I haven't noticed the 'not' operator. So the problem lies in gem I use it seems, which uses curl. Thank you.
tomzx has joined #ruby-lang
<A124>
I would really appreciate one tip (as I can't find out how): How can I disable transcoding in 1.9? I feed the library (zlib) one byte encoded string, but inflate returns me double byte encoded. I only found encoding and / or setting / disabling transcoding for a stream.
<DarkGray>
result.push(current.full_name) can be returned value?
<DarkGray>
if i remove: result #i need return "result" array
JEG2 has joined #ruby-lang
<mistym>
DarkGray: The return value of .push is the array with the results pushed on to it, so you don't need to explicitly return the result if that's the last thing in the method.
<mistym>
I notice you're using heroes.each to push items onto the array. Ruby has a built-in item to do that for you.
<DarkGray>
mistym: ok, thanks. But i only now understand: variables placed in each do ... end
<mistym>
The #collect method will take the items you return in each iteration, and return an array of them.
<DarkGray>
mistym: thanks! i try!
<mistym>
So that heroes.collect... call is like what you were trying to do above, just a bit more concise.
<DarkGray>
but when i try type puts names
Austin__ has joined #ruby-lang
<DarkGray>
mistym: i get next: #<Hero:0x3b652d8> #<Hero:0x3b65278> #<Hero:0x3b651e8>
<DarkGray>
mistym: but if names method returns array. Result should be array to
<mistym>
DarkGray: Also: blocks can access variables defined in the scope from which they're called. So if you defined results outside the block, you could then push to it from within it.
<DarkGray>
mistym: okay, thanks.
<mistym>
DarkGray: That's returning hero objects - you probably accidentally did something like `heroes.collect { |current| current }` instead of `current.full_name`.
<DarkGray>
result = [] means that resul now array.
<mistym>
DarkGray: Since the last action in the #names method here is heroes.each, #names is returning the return value of heroes.each - which is identical to your heroes array.
<DarkGray>
and after i push in result array object and after try puts this array
manojhans has joined #ruby-lang
<mistym>
So instead of returning an array of names, you're returning the array of hero objects.
<mistym>
Since you define the results method *inside* the block, you're not doing what you think you're doing. That's defining a new results method each iteration of the block, and the variable doesn't survive outside the block. You're not collecting the names anywhere.
<mistym>
Defining the results variable, that is.
manojhans has joined #ruby-lang
<DarkGray>
mistym: okay, my english is sucks. let me some time to translate please. thank you.
<mistym>
DarkGray: Sorry!
manojhans has joined #ruby-lang
manojhans has joined #ruby-lang
Joeysomo has joined #ruby-lang
<mistym>
DarkGray: Let me know if there's something I say that you don't understand and I can try to clarify. What's your language?
manojhans has joined #ruby-lang
<DarkGray>
mistym: i need get a cup of coffee with my mom, give me 10 minutes plz.
<mistym>
coffee :9
<DarkGray>
mistym: my language is russian
manojhans has joined #ruby-lang
<DarkGray>
mistym: :)))
<A124>
To answer myself: I have not found how to disable transcode in 1.9, but found out that zlib deflate returns #<Encoding:ASCII-8BIT> despite the Encoding.default_external #<Encoding:UTF-8>
dv310p3r has joined #ruby-lang
uniqanomaly has joined #ruby-lang
<A124>
And I have to (haven't found another solution) use String.force_encoding("UTF-8"), as data fed to zlib was UTF 8 also.
spox has joined #ruby-lang
<DarkGray>
mistym: sorry, but i don't understand. I understand that i should defune result array outside of the "each" block
<DarkGray>
but i don't understand what exacly returns names method now and why
Indian has joined #ruby-lang
<DarkGray>
when execution each block started, we have a current variable that contains hero object.
<judofyr>
A124: .default_external is only for I/O from the outside world. zlib works entirely on bytes, so ASCII-8BIT makes sense
<mistym>
DarkGray: heroes.each has a return value too. It returns the array you called it with, regardless of what you do in the block.
<A124>
judofyr: Ah. Thanks for clarification. I've read that but it's was relative for me.
<mistym>
So, because the last thing you do in the method is call heroes.each, it's the return value of heroes.each that is returned by names. That's why names is returning the same thing as your heroes array.
<DarkGray>
mistym: okay :) thank you! now i understand ^_^
<mistym>
DarkGray: What you want here is heroes.collect. heroes.collect returns a new array. Each item in the array is the return value of a step in the block.
<A124>
DarkGray: Curious. What are you coding?
<mistym>
So if you do `heroes.collect do |current|; current.full_name; end`, it will return an array with the result of using #full_name on each item in the heroes array. The same as the `results` array you were trying to create!
pw_ has joined #ruby-lang
reitelles has joined #ruby-lang
<manveru>
heroes.map{|hero| hero.full_name } or heroes.map(&:full_name)
<manveru>
do/end with oneliners just looks wrong :P
<lianj>
indeed
<mistym>
manveru: I was doing it with the same syntax he was using for clarity. ;) I prefer curly braces for one-liners too.
<mistym>
DarkGray: .map and .collect are the same thing, by the way. I find .collect makes more sense to me. Other people like .map better.
<DarkGray>
bbrr sorry
<mistym>
s/he/they # assumptions--
<DarkGray>
i still don't understand again why heroes.each do |current| always returns current array
<DarkGray>
sorry, i'am stupid
<A124>
DarkGray: each is meant to work with supplied data, not to change the object
<A124>
DarkGray: That's the only difference
<mistym>
DarkGray: That's just because #each always returns the original value of whatever you used #each with.
malev_ has joined #ruby-lang
pw_ has joined #ruby-lang
<DarkGray>
oooh
rdavila has joined #ruby-lang
<DarkGray>
okay. so i should use each when i need just puts something
<DarkGray>
A124: this is exmaple from last exercise in rubymonk.com I just trying understand.
<DarkGray>
not modify
<A124>
DarkGray: Ah. I see. I was curious, if you're not coding an rpg xD
<DarkGray>
:))
<mistym>
DarkGray: That's a good way of thinking about it!
<mistym>
Ruby offers many ways to iterate over the collections of items like arrays, designed for different ways of doing things.
jxie has joined #ruby-lang
coreydaley has joined #ruby-lang
slyphon has joined #ruby-lang
rowanu has joined #ruby-lang
adambeynon has joined #ruby-lang
beiter has joined #ruby-lang
marcostoledo has joined #ruby-lang
rippa has joined #ruby-lang
wmoxam has joined #ruby-lang
Indian has joined #ruby-lang
Hadjab has joined #ruby-lang
tenderlove has joined #ruby-lang
<Hadjab>
Hey everyone. I'm trying to use YARD for the first time, but I'm having a problem with my index page. Indeed, I did a readme.rdoc which is a quick tutorial on how to use my framework, however my index page keeps listing all my classes/methods/etc (which is normal I guess). How should I proceed for my README.rdoc to be the index page and have something like this : http://rubydoc.info/github/glejeune/ara/master/frames
<spox>
yard doc --help
<spox>
-r is likely what you're looking for
dr0id has quit [#ruby-lang]
pzol has quit ["Sayonara!"]
<Hadjab>
I'll take a look, thanks :)
dous has joined #ruby-lang
petercooper has joined #ruby-lang
makao007 has joined #ruby-lang
krz has joined #ruby-lang
davpoind has joined #ruby-lang
imperator has joined #ruby-lang
<imperator>
greetings programs
lele has joined #ruby-lang
<mistym>
imperator: Greetings. Please state the nature of your query.
<imperator>
anyone here ever used sharepoint? what did you think of it?
<andrewvos>
imperator: no
<andrewvos>
imperator: just no
<imperator>
that good, eh?
<DarkGray>
mistym: , A124 thanks for help
<wmoxam>
imperator: a) briefly. (b) I wanted to rip my own eyeballs out
erics has joined #ruby-lang
<mistym>
DarkGray: You're welcome!
<imperator>
i've been googling it a bit, seems like most people use it as a glorified filesystem interface
<imperator>
and most people seem to think it's too complex
<andrewvos>
imperator: People use it because big companies have managers who choose products depending on who they enjoy playing golf with.
<wmoxam>
andrewvos: also because their MS solutions provider said it was a good idea
rdavila has joined #ruby-lang
<wmoxam>
:p
<wmoxam>
"it'll make your company more efficent!"
<imperator>
been doing some "basecamp vs sharepoint" searches, too
<imperator>
and just now looking at asana
<wmoxam>
"(and we can bill a fuckload because customization is so fucking difficult)"
<chris2>
erm
<chris2>
i want to inherit from BasicObject, how do i call instance_eval on it?
rdavila has joined #ruby-lang
<A124>
DarkGray: Welcome.
<judofyr>
chris2: you can't
<chris2>
meh
<judofyr>
chris2: I'm pretty sure at least…
<chris2>
then i shall use object and undefine everything
<z3r00ld>
hello everyone, i am a newbie in Ruby and need a little help in overriding or disabling the Error Exception Handling (for example - i want to disable this message for Getopt::Long.getopts when we select wrong option: /usr/newbie:52: undefined method `[]' for nil:NilClass (NoMethodError) ) - i have put begin + rescue it but still getting this message
<rippa>
krzyhoo: I see he problem
<rippa>
maybe this isn't the way to do it after all
<krzyhoo>
but i hope you guys understand what i need
<krzyhoo>
i mean
<krzyhoo>
even though the code sucks
<krzyhoo>
the idea behind it (i hope) is clear
boxmo has joined #ruby-lang
<z3r00ld>
sorry to rush my problem - but i have a release on tomorrow and this is a blocker for me , any kind of solution is appreciated