grant has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Rodya_ has joined #ruby
smulverine has quit [Remote host closed the connection]
zapata has quit [Ping timeout: 246 seconds]
bronson has quit [Ping timeout: 255 seconds]
Rodya_ has quit [Ping timeout: 240 seconds]
mim1k has joined #ruby
djbkd has quit [Remote host closed the connection]
aupadhye has joined #ruby
aupadhye has quit [Client Quit]
mrfoo has joined #ruby
brent__ has joined #ruby
zapata has joined #ruby
lxsameer has joined #ruby
doublemalt_ has joined #ruby
Beams has joined #ruby
brent__ has quit [Ping timeout: 248 seconds]
minimalism has joined #ruby
govg_ has quit [Quit: leaving]
marr has joined #ruby
postmodern has quit [Remote host closed the connection]
aupadhye has joined #ruby
blackwind_123 has quit [Ping timeout: 255 seconds]
dionysus69 has joined #ruby
ramfjord has joined #ruby
ramfjord has quit [Ping timeout: 260 seconds]
mfaeh has quit [Remote host closed the connection]
mfaeh has joined #ruby
<Psy-Q>
how can i lay out my rubygems-in-development so i can develop e.g. 2 gems in parallel and load the freshest lib/foobar.rb from disk from inside a gem that provides bin/foobar?
nofxxxx has quit [Ping timeout: 258 seconds]
bronson has joined #ruby
<Psy-Q>
or maybe those are bad example names. bin/dosomething is in one gem and requires lib/foobar.rb from another
eljimmy has quit [Quit: This computer has gone to sleep]
yew has joined #ruby
iMadper` has quit [Remote host closed the connection]
<yew>
dminuoso: how do you replace class variables with class instance variables?
<dminuoso>
yew: you remove one @ ?
<dminuoso>
:-)
__Yiota has joined #ruby
<dminuoso>
yew: A class instance variable is just a plain instance variable. The trick is to understand that even a class is just an object, and as such can have instance variables.
eljimmy has joined #ruby
<yew>
dminuoso: but what happens if you want a class variable which is common across all the objects of the class?
<dminuoso>
yew: You use a class instance variable...
<dminuoso>
Let me demonstrate
<yew>
dminuoso: But you said not to use it
<dminuoso>
yew: I said not to use class variables!
<dminuoso>
This may be easier shown than explained. Give me a second.
<yew>
dminuoso: What is the point of class variables existing if they shouldn't be used?
<dminuoso>
yew: It's for the case where the inheritance behavior _is_ desirable.
<dminuoso>
I cant think of any right now. :-P
<yew>
dminuoso: Is it not possible to use class instance variables to simulate class variables?
<dminuoso>
yew: You just use @foo but from within the context of the class itself.
<dminuoso>
yew: Generally the rule of thumb is: If it's mutable: use a constant and freeze it, if it's not use a class instance variable.
<dminuoso>
Oh, other way around. But you get the idea.
<yew>
dminuoso: Yeah, but constants in Ruby aren't actually /constant/
apparition47 has quit [Ping timeout: 255 seconds]
<dminuoso>
yew: Which is why you should freeze it too. ;-)
bronson has joined #ruby
rgtk has quit [Ping timeout: 240 seconds]
rfoust has joined #ruby
<yew>
dminuoso: Freezing doesn't stop you from reassigning a constant
<dminuoso>
yew: No but Ruby will help you there. In strict mode it will blow up
<yew>
dminuoso: How do I enable strict mode?
ramfjord has quit [Ping timeout: 240 seconds]
<dminuoso>
Errr. freeze does.
astrobunny has quit [Ping timeout: 246 seconds]
high_fiver has joined #ruby
sepp2k has quit [Read error: Connection reset by peer]
<dminuoso>
Mmm. Weird.
<dminuoso>
I hate Ruby.
<dminuoso>
Bye
DLSteve has joined #ruby
<yew>
dminuoso: Bye?
sepp2k has joined #ruby
cdg has joined #ruby
bronson has quit [Ping timeout: 240 seconds]
hotpancakes has joined #ruby
rfoust has quit [Client Quit]
<yew>
Is it still acceptable to use class variables but to be disciplined in using them, kinda like how in Python all members of a class are public?
<dminuoso>
yew: It should not be.
<matthewd>
yew: It is of course acceptable to use them if they're what you need... they're just probably not what you actually need/want.
<yew>
Okay, thanks.
<dminuoso>
yew: The issue is that class variables leak implementation, and generally prevents your class from maintaining invariants.
<dminuoso>
Anyone can inherit from your class and then fiddle around with it.
<matthewd>
dminuoso: That's not a very compelling argument.. this is ruby, after all.
ta_ has joined #ruby
<dminuoso>
matthewd: You are right, I should be freezing all my classes. :-)
<matthewd>
IMO it's less about "they allow tampering" and more about "they don't work how you think they do, and that will bite you"
uZiel has joined #ruby
AxelAlex has quit [Quit: AxelAlex]
<dminuoso>
matthewd: Perhaps this is just my C++ showing here. Thinking about contracts and invariants has been burned into my mind..
<yew>
matthewd: I guess that is true since this works in ruby: ruby -e 'CONST=1; CONST=2; puts CONST'
mfaeh has quit [Remote host closed the connection]
<matthewd>
Right. Ruby really doesn't do [enforced] contracts and invariants.. at best it does hurdles.
spider-mario has quit [Ping timeout: 248 seconds]
yew has quit [Quit: Leaving]
spider-mario has joined #ruby
yew has joined #ruby
chouhoulis has joined #ruby
<yew>
dminuoso, matthewd: Okay, thanks a lot
yew has quit [Client Quit]
hightower2 has quit [Ping timeout: 246 seconds]
hightower4 has quit [Ping timeout: 240 seconds]
chouhoulis has quit [Ping timeout: 260 seconds]
profsimm has joined #ruby
<profsimm>
Collection methods bug me. Why is it "remove" when I remove one item and "clear" when I remove all of them? Why is it "set" when I set one item and "replace" when I set all of them?
jenrzzz has joined #ruby
<dminuoso>
profsimm: What class are you talking about?
hotpancakes has quit [Remote host closed the connection]
<profsimm>
dminuoso: Hash for ex.
cschneid_ has joined #ruby
hotpancakes has joined #ruby
<matthewd>
Words have meanings ¯\_(ツ)_/¯
jameser has quit [Ping timeout: 260 seconds]
jenrzzz has quit [Ping timeout: 255 seconds]
jameser has joined #ruby
<dminuoso>
profsimm: Ruby was designed by Japanese folks. You should the names of some of the C functions.
olivi____ has quit [Remote host closed the connection]
<profsimm>
dminuoso: sounds fun :/
skweek has quit [Ping timeout: 260 seconds]
oliv_____ has joined #ruby
hotpanca_ has joined #ruby
cschneid_ has quit [Ping timeout: 276 seconds]
<dminuoso>
profsimm: Indeed. You randomly then get fun comments to help you make sense of it.
andikr has quit [Remote host closed the connection]
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
moei has quit [Quit: Leaving...]
mim1k has joined #ruby
matthewd has quit [Ping timeout: 240 seconds]
matthewd has joined #ruby
<ResidentBiscuit>
I have an rspec stub that says `expect(user).to receive(:foo)`, but the code being tested is `user.try(:foo)`. When I run rspec, I get an error `received unexpected message :try with (:foo)` The code could change how exactly it calls that method, but the tests shouldn't break because of that. Is there something I need to enable to make this work? My google-fu hasn't found this issue out there.
someuser has joined #ruby
uZiel has quit [Ping timeout: 248 seconds]
jenrzzz has quit [Ping timeout: 260 seconds]
haylon has quit [Remote host closed the connection]
<rabajaj>
i am trying to add this code to the models file, strip function is working as it should
<rabajaj>
instead i am getting the entire string value that is present in search
Antiarc has quit [Read error: Connection reset by peer]
<rabajaj>
?
tacoboy has quit [Read error: Connection reset by peer]
<rabajaj>
^^
__Yiota has quit [Ping timeout: 246 seconds]
Antiarc has joined #ruby
<apeiros>
rabajaj: what?
cam27 has quit [Quit: cam27]
renchan has quit [Quit: Leaving...]
rgtk has quit [Ping timeout: 255 seconds]
hutch34_ has joined #ruby
claw has joined #ruby
hutch34 has quit [Ping timeout: 276 seconds]
ColeHub has quit [Quit: Snooze.]
jnollette has quit [Ping timeout: 260 seconds]
dionysus69 has joined #ruby
gothicsouth has joined #ruby
eightlimbed has quit [Remote host closed the connection]
dviola has joined #ruby
jenrzzz has quit [Ping timeout: 255 seconds]
ansraliant has quit [Ping timeout: 246 seconds]
oliv_____ has quit [Remote host closed the connection]
lacuna has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
AxelAlex has joined #ruby
gothicsouth has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
dviola has quit [Quit: WeeChat 1.9]
lacuna has joined #ruby
dviola has joined #ruby
bronson has joined #ruby
rundor has quit [Remote host closed the connection]
postmodern has joined #ruby
kies has joined #ruby
bronson has quit [Ping timeout: 240 seconds]
rundor has joined #ruby
ColeHub has joined #ruby
__Yiota has joined #ruby
<apeiros>
rabajaj: ok, 30min no follow up. I guess it's not that important
ColeHub has quit [Client Quit]
marxarelli|afk is now known as marxarelli
cdg_ has joined #ruby
<havenwood>
rabajaj: If mind reading is what you're looking for, change `search =` (setting a local variable) to `self.search =` (using a setter method). That's my guess.
<rabajaj>
havenwood, apeiros sorry i was afk and dint see your messages :(
* havenwood
appreciates instance variables
<rabajaj>
havenwood, could you give an example of setter method ?
<havenwood>
rabajaj: Does it work as you intend with?: self.search_attr = search.strip
<havenwood>
rabajaj: #search_attr=
<havenwood>
you're not intending to set a local variable there, right? because that's what you're doing.
<rabajaj>
there a search variable which contains the value filled in the search field, eg " name = rahul". i want to strip that value using `before_save` callback method
pwned has joined #ruby
cam27 has joined #ruby
<havenwood>
rabajaj: You're trying to strip the :search field before you save?
<rabajaj>
yes
cschneid_ has quit [Remote host closed the connection]
rundor has quit [Remote host closed the connection]
<havenwood>
Nowaker: I'm sure a patch would be much appreciated.
cagomez has joined #ruby
petto has quit [Ping timeout: 255 seconds]
SeepingN has joined #ruby
rabajaj has quit [Quit: Leaving]
t-recx has quit [Quit: t-recx]
cschneid_ has quit [Ping timeout: 246 seconds]
tacoboy has joined #ruby
bronson has joined #ruby
astrobunny has joined #ruby
sepp2k has quit [Ping timeout: 255 seconds]
Rodya_ has joined #ruby
cadillac_ has joined #ruby
ansraliant has joined #ruby
ansraliant has joined #ruby
ansraliant has quit [Changing host]
bronson has quit [Ping timeout: 240 seconds]
astrobunny has quit [Ping timeout: 268 seconds]
Rodya_ has quit [Ping timeout: 246 seconds]
bluesocksyellowt has joined #ruby
nowhere_man has joined #ruby
lxsameer has joined #ruby
high_fiver has joined #ruby
pwned has quit [Ping timeout: 240 seconds]
high_fiver has quit [Remote host closed the connection]
alex`` has joined #ruby
loincloth has quit []
nowhere_man has quit [Ping timeout: 268 seconds]
high_fiver has joined #ruby
newalexandria_ has joined #ruby
cagomez has quit [Remote host closed the connection]
catbusters has quit [Quit: Connection closed for inactivity]
cagomez has joined #ruby
sarmiena_ has joined #ruby
newalexandria_ has quit [Client Quit]
olivi____ has quit [Remote host closed the connection]
yeticry has quit [Ping timeout: 268 seconds]
cagomez has quit [Ping timeout: 240 seconds]
olivi____ has joined #ruby
olivi____ has quit [Remote host closed the connection]
oliv_____ has joined #ruby
yeticry has joined #ruby
KeyJoo has joined #ruby
<graft>
so i'm doing an http request using net::http (actually net::http::persistent), and the response object i'm getting back says it has already been read (i.e., if i call response.read_body with a block it complains that it was already read)
<graft>
but i'm not reading it - who is? is this expected behavior, that the response from http.request will have already been read?
wilbert has joined #ruby
petto has joined #ruby
<graft>
or a better question: what do you need to get an unread response (so i can read it in chunks)
cam27 has quit [Quit: cam27]
lacuna has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
petto has quit [Ping timeout: 240 seconds]
lacuna has joined #ruby
frmendes has quit [Ping timeout: 260 seconds]
gigetoo has quit [Ping timeout: 260 seconds]
petruff has quit [Ping timeout: 240 seconds]
<bluesocksyellowt>
@graft afaik read_body is the way to do that. do you have code to share?
cschneid_ has joined #ruby
gigetoo has joined #ruby
nadir has joined #ruby
sepp2k has joined #ruby
lacuna has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
lacuna has joined #ruby
cschneid_ has quit [Ping timeout: 255 seconds]
GodFather has joined #ruby
t-recx has joined #ruby
lacuna has quit [Ping timeout: 255 seconds]
<graft>
bluesocksyellowt: i'm using read_body, however read_body raises if it has already been called before, and i'm not sure why that's happening
dionysus70 has joined #ruby
<bluesocksyellowt>
reduced example would help.
dionysus69 has quit [Ping timeout: 240 seconds]
dionysus70 is now known as dionysus69
<graft>
blerm. lemme make a gist
ta_ has quit [Remote host closed the connection]
ta_ has joined #ruby
ta_ has quit [Remote host closed the connection]
bronson has joined #ruby
astrobunny has joined #ruby
ta_ has joined #ruby
ta_ has quit [Remote host closed the connection]
mrfoo has quit [Quit: WeeChat 0.3.7]
ta_ has joined #ruby
ta_ has quit [Remote host closed the connection]
Rodya_ has joined #ruby
bronson has quit [Ping timeout: 260 seconds]
astrobunny has quit [Ping timeout: 248 seconds]
__Yiota has quit [Remote host closed the connection]
__Yiota has joined #ruby
jenrzzz has quit [Ping timeout: 240 seconds]
Rodya_ has quit [Ping timeout: 276 seconds]
ta_ has joined #ruby
ta_ has quit [Read error: Connection reset by peer]
ta_ has joined #ruby
__Yiota has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ta_ has quit [Read error: Connection reset by peer]
ramfjord has quit [Ping timeout: 268 seconds]
ta_ has joined #ruby
ta_ has quit [Read error: Connection reset by peer]
ta__ has joined #ruby
ta__ has quit [Read error: Connection reset by peer]
ta_ has joined #ruby
ta__ has joined #ruby
ta_ has quit [Read error: Connection reset by peer]
ta_ has joined #ruby
ta__ has quit [Read error: Connection reset by peer]
im0nde has joined #ruby
ta_ has quit [Read error: Connection reset by peer]
synthroid has quit [Remote host closed the connection]
ta_ has joined #ruby
ta_ has quit [Read error: Connection reset by peer]
oliv_____ has quit [Remote host closed the connection]
oliv_____ has joined #ruby
Rapture has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
synthroid has joined #ruby
claw has quit [Ping timeout: 255 seconds]
ta_ has joined #ruby
oliv_____ has quit [Remote host closed the connection]
oliv_____ has joined #ruby
ta_ has quit [Read error: Connection reset by peer]
jenrzzz has joined #ruby
spider-mario has quit [Ping timeout: 276 seconds]
cschneid_ has joined #ruby
ta_ has joined #ruby
Rapture has joined #ruby
alex`` has quit [Quit: WeeChat 1.9]
ta_ has quit [Read error: Connection reset by peer]
ta_ has joined #ruby
oliv_____ has quit [Client Quit]
nowhere_man has joined #ruby
hahuang65 has joined #ruby
oliv_____ has joined #ruby
ta_ has quit [Read error: Connection reset by peer]
alex`` has joined #ruby
cschneid_ has quit [Ping timeout: 246 seconds]
ta_ has joined #ruby
ta_ has quit [Read error: Connection reset by peer]
stoffus has quit [Ping timeout: 246 seconds]
ta_ has joined #ruby
ta_ has quit [Read error: Connection reset by peer]
brent__ has quit [Read error: Connection reset by peer]
ar1a has quit [Ping timeout: 255 seconds]
brent__ has joined #ruby
ta_ has joined #ruby
brent__ has quit [Read error: Connection reset by peer]
ar1a has joined #ruby
brent__ has joined #ruby
ta_ has quit [Read error: Connection reset by peer]
Trynemjoel has joined #ruby
rgtk has joined #ruby
A124 has quit [Quit: '']
ta_ has joined #ruby
ta_ has quit [Read error: Connection reset by peer]
P1ro_ has joined #ruby
cagomez has joined #ruby
ta_ has joined #ruby
ta_ has quit [Read error: Connection reset by peer]
Trynemjoel has quit [Client Quit]
cschneid_ has joined #ruby
A124 has joined #ruby
ta_ has joined #ruby
ta_ has quit [Read error: Connection reset by peer]
Trynemjoel has joined #ruby
ta_ has joined #ruby
ta_ has quit [Read error: Connection reset by peer]
oliv_____ has quit [Remote host closed the connection]
olivi____ has joined #ruby
Eiam has quit [Quit: ╯°□°)╯︵ǝpouǝǝɹɟ]
ta_ has joined #ruby
cschneid_ has quit [Ping timeout: 276 seconds]
ansraliant has quit [Quit: WeeChat 1.9]
ltem has joined #ruby
ta_ has quit [Read error: Connection reset by peer]
rgtk has quit [Ping timeout: 255 seconds]
olivi____ has quit [Ping timeout: 240 seconds]
claw has joined #ruby
ta_ has joined #ruby
ta_ has quit [Remote host closed the connection]
rundor has joined #ruby
jphase has quit [Ping timeout: 268 seconds]
ta_ has joined #ruby
astrobunny has joined #ruby
Rodya_ has joined #ruby
sleepee has joined #ruby
Rodya_ has quit [Ping timeout: 258 seconds]
moei has joined #ruby
cagomez has quit [Remote host closed the connection]
cagomez has joined #ruby
ur5us has joined #ruby
VeryBewitching has quit [Quit: Konversation terminated!]
ElFerna has joined #ruby
sgen has quit [Quit: Leaving]
ramfjord has joined #ruby
synthroid has quit []
im0nde has quit [Read error: Connection reset by peer]
sgen has joined #ruby
spider-mario has joined #ruby
mim1k has joined #ruby
astrobunny has quit [Ping timeout: 240 seconds]
olivi____ has joined #ruby
mim1k has quit [Ping timeout: 255 seconds]
rundor has quit [Remote host closed the connection]
someuser has quit [Ping timeout: 240 seconds]
olivi____ has quit [Quit: Leaving...]
rundor has joined #ruby
Jayson_Virissimo has joined #ruby
tvw has quit [Ping timeout: 255 seconds]
ta_ has quit [Remote host closed the connection]
enodata has left #ruby [#ruby]
rgtk has joined #ruby
ta_ has joined #ruby
ldnunes has quit [Quit: Leaving]
gothicsouth has joined #ruby
cschneid_ has joined #ruby
marxarelli is now known as marxarelli|afk
sgen has quit [Quit: Leaving]
BTRE has quit [Read error: Connection reset by peer]
sgen has joined #ruby
digitalnomad has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cschneid_ has quit [Ping timeout: 240 seconds]
Rodya_ has joined #ruby
brent__ has quit [Remote host closed the connection]
ta_ has quit [Remote host closed the connection]
psychicist__ has joined #ruby
rundor has quit [Remote host closed the connection]
someuser has joined #ruby
ta_ has joined #ruby
bronson has joined #ruby
m27frogy has quit [Ping timeout: 255 seconds]
_netglider_ has joined #ruby
_netglider_ has quit [Client Quit]
m27frogy has joined #ruby
netglider has joined #ruby
marxarelli|afk is now known as marxarelli
marxarelli is now known as marxarelli|afk
netglider has quit [Client Quit]
bronson has quit [Ping timeout: 255 seconds]
ta_ has quit [Remote host closed the connection]
netglider has joined #ruby
monument has quit [Remote host closed the connection]
<hays>
or is it better to define the hash first and then populate it outside the definition
Renich has quit [Quit: Renich]
<Papierkorb>
hays: For this, I'd prefer to write it on a single line. If that's too hard to read, it's the sign that you should filter first and assign later
cagomez has joined #ruby
jenrzzz has quit [Quit: Lost terminal]
polishdub has quit [Quit: leaving]
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
digitalnomad has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ta_ has joined #ruby
kkiero has joined #ruby
KeyJoo has quit [Ping timeout: 248 seconds]
alveric2 has joined #ruby
dcunit3d has quit [Ping timeout: 255 seconds]
robouk has quit [Quit: Konversation terminated!]
robouk has joined #ruby
alveric1 has quit [Ping timeout: 255 seconds]
digitalnomad has joined #ruby
ta_ has quit [Remote host closed the connection]
perniciouscaffei has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
uZiel has quit [Ping timeout: 248 seconds]
kith has joined #ruby
frmendes has joined #ruby
vee_ has joined #ruby
umaaji has joined #ruby
bronson has joined #ruby
emers2n has joined #ruby
facest has quit [Ping timeout: 260 seconds]
frmendes has quit [Quit: leaving]
<emers2n>
I want to decrement a string like so "hello" = ["ello", "llo", "lo", "o"]. Is there a built in function to do this?
facest has joined #ruby
jenrzzz_ has joined #ruby
bronson has quit [Ping timeout: 260 seconds]
dcunit3d has joined #ruby
GodFather has quit [Ping timeout: 240 seconds]
jnollette has quit [Ping timeout: 260 seconds]
jenrzzz has quit [Ping timeout: 248 seconds]
alex`` has quit [Quit: WeeChat 1.9]
alex`` has joined #ruby
GodFather has joined #ruby
<emers2n>
@emers2n Looks like not - just need a for loop and a splice
digitalnomad has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]