ljarvis changed the topic of #ruby-lang to: Ruby 2.1.2; 2.0.0-p481; 1.9.3-p547: http://ruby-lang.org || Paste code on http://gist.github.com
malconis has joined #ruby-lang
malconis has quit [Client Quit]
malconis has joined #ruby-lang
malconis has quit [Client Quit]
malconis has joined #ruby-lang
zz_anildigital is now known as anildigital
malconis has quit [Client Quit]
malconis has joined #ruby-lang
chadwtaylor has quit [Remote host closed the connection]
malconis has quit [Client Quit]
marr has quit [Ping timeout: 240 seconds]
diegoviola has quit [Quit: WeeChat 0.4.3]
sepp2k1 has joined #ruby-lang
diegoviola has joined #ruby-lang
sepp2k has quit [Ping timeout: 272 seconds]
weems|mac has joined #ruby-lang
anildigital is now known as zz_anildigital
malconis has joined #ruby-lang
malconis has quit [Client Quit]
malconis has joined #ruby-lang
malconis has quit [Client Quit]
momomomomo has joined #ruby-lang
diegoviola has quit [Quit: WeeChat 0.4.3]
davispuh has quit [Ping timeout: 246 seconds]
malconis has joined #ruby-lang
ddv has quit [Ping timeout: 260 seconds]
malconis has quit [Client Quit]
sarkyniin has quit [Quit: Quitte]
malconis has joined #ruby-lang
ddv has joined #ruby-lang
malconis has quit [Client Quit]
CodeBunny has joined #ruby-lang
skade has quit [Quit: Computer has gone to sleep.]
CodeBunny has quit [Client Quit]
diegoviola has joined #ruby-lang
brianpWins has quit [Quit: brianpWins]
mikecmpbll has quit [Quit: i've nodded off.]
vintik has quit [Remote host closed the connection]
weems|mac has quit [Quit: weems|mac]
malconis has joined #ruby-lang
vintik has joined #ruby-lang
vintik has quit [Remote host closed the connection]
shinnya has quit [Ping timeout: 244 seconds]
malconis has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
aleatorik has joined #ruby-lang
weems|mac has joined #ruby-lang
charliesome has joined #ruby-lang
brianpWins has joined #ruby-lang
charliesome has quit [Client Quit]
<aleatorik> Has anyone had any luck connecting ActiveAdmin with the rails-api gem? Or have a link to an example of how to do so?
jinie has quit [Ping timeout: 260 seconds]
webhat has quit [Quit: No Ping reply in 180 seconds.]
jinie has joined #ruby-lang
malconis has joined #ruby-lang
malconis has quit [Client Quit]
dingus_khan has joined #ruby-lang
dingus_khan has left #ruby-lang [#ruby-lang]
chouhoulis has quit [Remote host closed the connection]
sepp2k1 has quit [Read error: Connection reset by peer]
arBmind1 has joined #ruby-lang
arBmind has quit [Ping timeout: 264 seconds]
malconis has joined #ruby-lang
redhat has joined #ruby-lang
tectonic has quit []
malconis has quit [Client Quit]
malconis has joined #ruby-lang
malconis has quit [Client Quit]
<jamesfordummies> aleatorik: you'll probably have better luck in #ruby-on-rails
<aleatorik> jamesfordummies: okay thanks, thats what i was thinking, pretty quiet in here
<jamesfordummies> aleatorik: there's #ruby, #ruby-lang, and #ruby-on-rails :)
<aleatorik> jamesfordumies: thanks, I'm newer to using irc, so I appreciate the help
<jamesfordummies> no problem. if you need some more ruby-focused help everyone here and in #ruby are very helpful aleatorik
<emmesswhy> jamesfordummies, what's the difference between #ruby-lang and #ruby
tectonic has joined #ruby-lang
<jamesfordummies> emmesswhy: honestly i'm not sure. i imagine ruby-lang was/is more focused on features / discussion of the language itself. ruby tends to be more help with usage of the language
<jamesfordummies> sorry aleatorik it's #rubyonrails
<jamesfordummies> I think? wtf
<aleatorik> doesn't seem to be there
<aleatorik> #rubyonrails channel on irc.freenode.net
<aleatorik> is irc.freenode different from chat.freenode
<jamesfordummies> ah
charliesome has joined #ruby-lang
<jamesfordummies> yes
kyb3r_ has quit [Read error: Connection reset by peer]
malconis has joined #ruby-lang
weems|mac has quit [Quit: weems|mac]
thomasxie has joined #ruby-lang
dm78 has quit [Remote host closed the connection]
<aleatorik> jamesfordummies: it works on irc.freenode at the channel you said #rubyonrails, thank you
<jamesfordummies> np np
dm78 has joined #ruby-lang
malconis has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
malconis has joined #ruby-lang
momomomomo has quit [Quit: momomomomo]
havenwood has joined #ruby-lang
malconis has quit [Client Quit]
vintik has joined #ruby-lang
malconis has joined #ruby-lang
malconis has quit [Client Quit]
malconis has joined #ruby-lang
malconis has quit [Client Quit]
Lingo__ has joined #ruby-lang
malconis has joined #ruby-lang
malconis has quit [Client Quit]
Lingo__ has quit [Ping timeout: 255 seconds]
weems|mac has joined #ruby-lang
Spacecloud is now known as pipework
tectonic has quit []
ur5us has joined #ruby-lang
weems|mac has quit [Quit: weems|mac]
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
dm78 has quit [Remote host closed the connection]
malconis has joined #ruby-lang
malconis has quit [Client Quit]
dm78 has joined #ruby-lang
centrx has quit [Quit: Mead error: Connection reset by beer]
centrx has joined #ruby-lang
unknownloner has joined #ruby-lang
shinnya has joined #ruby-lang
<unknownloner> If I have a class that has methods defined with 'def self.foo', is there a way for me to include those in the global namespace so I can type foo() to invoke it instead of ClassName.foo()?
<centrx> unknownloner, That's generally a bad idea, do you have an example?
<jamesfordummies> you could just add it to the Object class, no?
<centrx> Ruby core puts those kind of methods in Kernel, which is included in Object
<jamesfordummies> right
<jamesfordummies> but defining methods in top-level defines them in the Object class right?
<unknownloner> basically I'm using jruby w/lwjgl, lwjgl gives you GL11,GL13,etc. classes that let you access opengl functions, and I want to be able to do for example glColor4f instead of GL11.glColor4f
<centrx> jamesfordummies, That's another fascinating link for you
<centrx> jamesfordummies, There is actually a special type of Object called "main" that serves as the top-level namespace. It's Object, but it's also special
<jamesfordummies> yep
<jamesfordummies> i knew that
<jamesfordummies> but I thought if you defined a method there it was available everywhere..?
<unknownloner> and I can't just extend GL11 because it's final, it won't let me extend it
<havenwood> unknownloner: module Kernel; include X end; class Object; include Kernel end
<jamesfordummies> i am admittedly fuzzy on what makes it special, but I know it is the Object class
<unknownloner> havenwood: that doesn't work, trying to include the class fails because it expects me to include a module
<ari-_-e> I think main is a special instance of Object
<havenwood> unknownloner: oh, i missed that it was a Class, assumed Module
<ari-_-e> >> self.class
<eval-in> ari-_-e => Object (https://eval.in/177768)
<jamesfordummies> >> puts self
<eval-in> jamesfordummies => main ... (https://eval.in/177769)
<ari-_-e> there's a lot of black magic involved here
<centrx> The bot should say that when you do some things
InfraRuby has left #ruby-lang [#ruby-lang]
<jamesfordummies> where can I learn about this black magic?
<havenwood> here lie dragons!
<jamesfordummies> these are the borders of my ruby knowledge - would like to expand them
ur5us has quit [Remote host closed the connection]
<unknownloner> so to do what I want, would I need to write something that goes through all the methods/variables defined for the class GL11 and then defines them on Object?
<ari-_-e> centrx: was about to paste that link :)
chouhoulis has joined #ruby-lang
<jamesfordummies> sweet
amystephen has quit [Quit: amystephen]
<ari-_-e> jamesfordummies: more black magic: http://yugui.jp/articles/846
chouhoulis has quit [Remote host closed the connection]
chouhoulis has joined #ruby-lang
stardiviner has joined #ruby-lang
qinix has joined #ruby-lang
centrx has quit [Quit: Mead error: Connection reset by beer]
qinix has quit [Client Quit]
kyb3r_ has joined #ruby-lang
havenwood has quit []
thomasxie has quit [Quit: Leaving.]
thomasxie has joined #ruby-lang
Guest95071 has quit [Quit: KVIrc 4.2.0 Equilibrium http://www.kvirc.net/]
amystephen has joined #ruby-lang
KM has joined #ruby-lang
dm78 has quit [Remote host closed the connection]
KM is now known as Guest63222
agarie has joined #ruby-lang
gix has quit [Ping timeout: 250 seconds]
InfraRuby has joined #ruby-lang
gix has joined #ruby-lang
amystephen has quit [Quit: amystephen]
nathanstitt has quit [Quit: I growing sleepy]
tectonic has joined #ruby-lang
dpbus has joined #ruby-lang
semaperepelitsa has joined #ruby-lang
dm78 has joined #ruby-lang
semaperepelitsa has quit [Client Quit]
tectonic has quit []
dm78 has quit [Remote host closed the connection]
nertzy has quit [Quit: This computer has gone to sleep]
<jamesfordummies> ari-_-e: aaaaawwwweeesome
chadwtaylor has joined #ruby-lang
hellangel7 has joined #ruby-lang
darkness has joined #ruby-lang
darknesshellange has joined #ruby-lang
darkness is now known as Guest71601
agarie has quit [Ping timeout: 246 seconds]
darknesshellange has quit [Max SendQ exceeded]
darknesshellange has joined #ruby-lang
RobertBirnie has joined #ruby-lang
dingus_khan has joined #ruby-lang
<dingus_khan> jhass|off: are you the same person as jhass?
stardiviner has quit [Ping timeout: 246 seconds]
zz_anildigital is now known as anildigital
anildigital is now known as zz_anildigital
tectonic has joined #ruby-lang
zz_anildigital is now known as anildigital
RobertBirnie has quit [Quit: Textual IRC Client: www.textualapp.com]
InfraRuby has left #ruby-lang [#ruby-lang]
chouhoulis has quit [Remote host closed the connection]
dpbus has quit [Quit: Computer has gone to sleep.]
dpbus has joined #ruby-lang
dpbus has quit [Ping timeout: 272 seconds]
Guest71601 has quit [Remote host closed the connection]
hellangel7 has quit [Remote host closed the connection]
darknesshellange has quit [Read error: Connection reset by peer]
ur5us has joined #ruby-lang
duper has quit [Ping timeout: 260 seconds]
Miphix has joined #ruby-lang
charliesome has joined #ruby-lang
duper has joined #ruby-lang
pr0ton__ has joined #ruby-lang
nertzy has joined #ruby-lang
frank_o has joined #ruby-lang
jxie has quit [Ping timeout: 260 seconds]
chadwtaylor has quit [Quit: Leaving...]
jxie has joined #ruby-lang
vintik has quit [Remote host closed the connection]
vintik has joined #ruby-lang
aleatorik has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
nofxx has quit [Ping timeout: 255 seconds]
snsei has joined #ruby-lang
diegoviola has quit [Remote host closed the connection]
snsei_ has joined #ruby-lang
stayarrr has joined #ruby-lang
AKASkip has joined #ruby-lang
snsei has quit [Ping timeout: 250 seconds]
chouhoulis has joined #ruby-lang
skade has joined #ruby-lang
stayarrr has left #ruby-lang [#ruby-lang]
chouhoulis has quit [Ping timeout: 240 seconds]
danijoo has quit [Read error: Connection reset by peer]
danijoo has joined #ruby-lang
magikfx__ has quit [Remote host closed the connection]
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
hellangel7 has joined #ruby-lang
DEac- has quit [Quit: leaving]
rusty_ has joined #ruby-lang
DEac- has joined #ruby-lang
Missphoenix has joined #ruby-lang
Miphix has quit [Ping timeout: 245 seconds]
frank_o has quit [Ping timeout: 240 seconds]
anildigital is now known as zz_anildigital
Phoenixmiss has joined #ruby-lang
vintik has quit [Remote host closed the connection]
relix has joined #ruby-lang
frank_o has joined #ruby-lang
Missphoenix has quit [Ping timeout: 245 seconds]
jamesfordummies has quit [Remote host closed the connection]
charliesome has joined #ruby-lang
charliesome has quit [Client Quit]
snsei_ has quit [Remote host closed the connection]
snsei has joined #ruby-lang
nertzy has quit [Quit: This computer has gone to sleep]
snsei has quit [Ping timeout: 255 seconds]
hakunin has joined #ruby-lang
vintik has joined #ruby-lang
mistym has quit [Remote host closed the connection]
_ht has joined #ruby-lang
skade has quit [Quit: Computer has gone to sleep.]
heftig has joined #ruby-lang
zz_anildigital is now known as anildigital
skade has joined #ruby-lang
yugui_zzz is now known as yugui
Cakey has joined #ruby-lang
symm- has quit [Ping timeout: 244 seconds]
tbuehlmann has joined #ruby-lang
ledestin has quit [Quit: ledestin]
Cakey has quit [Ping timeout: 255 seconds]
havenwood has joined #ruby-lang
charliesome has joined #ruby-lang
relix has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
hellangel7 has quit [Read error: Connection reset by peer]
danijoo has quit [Read error: Connection reset by peer]
danijoo has joined #ruby-lang
ledestin has joined #ruby-lang
BubonicPestilenc has joined #ruby-lang
charliesome has quit [Ping timeout: 260 seconds]
robbyoconnor has quit [Excess Flood]
robbyoconnor has joined #ruby-lang
skade has quit [Quit: Computer has gone to sleep.]
vintik has quit [Remote host closed the connection]
relix has joined #ruby-lang
marr has joined #ruby-lang
pr0ton__ has quit [Quit: pr0ton__]
spastorino has quit [Quit: Connection closed for inactivity]
frank_o has quit [Ping timeout: 245 seconds]
rusty_ has quit []
vintik has joined #ruby-lang
sepp2k has joined #ruby-lang
arBmind1 has quit [Quit: Leaving.]
anildigital is now known as zz_anildigital
mikecmpbll has joined #ruby-lang
stardiviner has joined #ruby-lang
yfeldblum has quit [Read error: Connection reset by peer]
yfeldblum has joined #ruby-lang
vintik has quit [Remote host closed the connection]
brianpWins has quit [Quit: brianpWins]
<stardiviner> Is there: class Post << ActiveRecord::Base ; end in Ruby ? I have never this kind of inheritance operator, I only seen `<`. Or just this writer's typo ?
Phoenixmiss has quit [Quit: Leaving]
Cakey has joined #ruby-lang
<Mon_Ouie> It's a typo
<Mon_Ouie> class << X; …; end is used to access X's singleton class but class X << Y; end is not a thing
yugui is now known as yugui_zzz
vintik has joined #ruby-lang
Miphix has joined #ruby-lang
yugui_zzz is now known as yugui
yugui is now known as yugui_zzz
corecode_ has left #ruby-lang ["ERC Version 5.3 (IRC client for Emacs)"]
jhass|off is now known as jhass
<jhass> dingus_khan: sure
Atttwww has quit [Ping timeout: 272 seconds]
apeiros has joined #ruby-lang
davispuh has joined #ruby-lang
Missphoenix has joined #ruby-lang
sMecKs has quit [Read error: Connection reset by peer]
vintik has quit [Remote host closed the connection]
Miphix has quit [Ping timeout: 245 seconds]
Cakey has quit [Ping timeout: 244 seconds]
marr has quit [Ping timeout: 255 seconds]
Mon_Ouie has quit [Ping timeout: 240 seconds]
kyb3r_ has quit [Read error: Connection reset by peer]
Miphix has joined #ruby-lang
yfeldblu_ has joined #ruby-lang
Missphoenix has quit [Ping timeout: 264 seconds]
yfeldblum has quit [Ping timeout: 240 seconds]
thomasxie has quit [Remote host closed the connection]
WilfredTheGreat has joined #ruby-lang
relix has quit [Quit: Textual IRC Client: www.textualapp.com]
banister has joined #ruby-lang
banister has quit [Max SendQ exceeded]
arBmind has joined #ruby-lang
banister has joined #ruby-lang
Missphoenix has joined #ruby-lang
Miphix has quit [Ping timeout: 255 seconds]
Missphoenix has quit [Client Quit]
Miphix has joined #ruby-lang
wallerdev has quit [Quit: wallerdev]
WilfredTheGreat has quit [Read error: Connection reset by peer]
Missphoenix has joined #ruby-lang
izietto has joined #ruby-lang
Miphix has quit [Ping timeout: 264 seconds]
<izietto> Hello, I just made the Ruby porting of the Python PYSTONE script: https://github.com/mdesantis/rubystone
banister has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
banister has joined #ruby-lang
Cakey has joined #ruby-lang
<jhass> why you use globals? :(
<jhass> your IDENT1-6 seems to be an enum? we use symbols for that
<jhass> your big if elsif in proc6 can be a case when
stamina has joined #ruby-lang
<jhass> if ! -> unless
<izietto> Thank you for the response! I use globals because PYSTONE does it too
<jhass> that's a sad reason
<izietto> it is a specular porting
<jhass> a = a + 1 -> a += 1
<izietto> and it's the first release :)
<jhass> you don't need the return keyword if it's the last expression in your method
Cakey has quit [Ping timeout: 255 seconds]
<izietto> I just noticed that return true if enum_loc == IDENT3; return false could be just enum_loc == IDENT3
<jhass> yes
<jhass> https://github.com/mdesantis/rubystone/blob/master/bin/rubystone#L239 you can drop int_loc and make an until loop with the condition of the if
<izietto> there's some cleanup work to do. But the biggest problem for me is: how the hell it works??? From an algorythm point of view
<jhass> cleanup usually makes it clearer ;)
<izietto> I ported it, but I don't really understand what it does :O
<jhass> for example trying to find proper names for the methods can help a lot already
<izietto> I would like to do a serious refactor, like make shorter methods, make it OO and things like this, but I don't understand its logic, so it's hard for me to refactor it
<izietto> f.e. finding proper names: what is ptr_glb?? global_pointer?
<izietto> pointer to what??
<izietto> int_loc: integer_location?? WAT?
Gabri has joined #ruby-lang
Fushi has joined #ruby-lang
tectonic has quit []
<izietto> If I understand the logic I can even rewrite it from scratch
ur5us has quit [Remote host closed the connection]
ur5us has joined #ruby-lang
banister has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
sarkyniin has joined #ruby-lang
marr has joined #ruby-lang
ur5us has quit [Ping timeout: 255 seconds]
thomasxie has joined #ruby-lang
apeiros has quit [Remote host closed the connection]
apeiros has joined #ruby-lang
apeiros has quit [Ping timeout: 240 seconds]
InfraRuby has joined #ruby-lang
dingus_khan has quit [Remote host closed the connection]
marr has quit [Read error: Connection reset by peer]
thomasxie has quit [Remote host closed the connection]
Gabri has quit [Remote host closed the connection]
Gabri has joined #ruby-lang
thomasxie has joined #ruby-lang
dorei has joined #ruby-lang
Gabri has quit [Ping timeout: 272 seconds]
emmesswhy has quit [Quit: This computer has gone to sleep]
SkyHunter has joined #ruby-lang
<SkyHunter> Hi, I would like to read from a TCPSocket into an HEX Array, but it seems like .recv give me just a string. (Want it like that: [1a, 00, 04...]). Any ideas?
<jhass> use .unpack on the string
<SkyHunter> unpack('H*')?
<jhass> depends on the data you receive
<jhass> note there's no such thing as "hex array"
<jhass> hex is just another representation of a Integer (Fixnum/Bignum)
<jhass> >> 0xFF
<eval-in> jhass => 255 (https://eval.in/177797)
stamina has quit [Quit: WeeChat 0.4.3]
<SkyHunter> ah okay :) thank you!
jds has joined #ruby-lang
Cakey has joined #ruby-lang
WilfredTheGreat has joined #ruby-lang
heftig has quit [Ping timeout: 250 seconds]
Cakey has quit [Ping timeout: 246 seconds]
havenwood has quit [Remote host closed the connection]
sarkyniin has quit [Quit: Quitte]
bin7me has joined #ruby-lang
stardiviner has quit [Quit: my website: http://stardiviner.dyndns-blog.com/]
dingus_khan has joined #ruby-lang
gjaldon has joined #ruby-lang
dingus_khan has quit [Ping timeout: 240 seconds]
gjaldon has quit [Remote host closed the connection]
gjaldon has joined #ruby-lang
gjaldon has quit [Remote host closed the connection]
gjaldon has joined #ruby-lang
postmodern has quit [Quit: Leaving]
aleatorik has joined #ruby-lang
aleatorik is now known as asdf
asdf is now known as tradekraft
tradekraft is now known as Guest13779
Guest13779 has quit [Killed (barjavel.freenode.net (Nickname regained by services))]
aleatorik has joined #ruby-lang
aleatorik is now known as tradekraft
InfraRuby has left #ruby-lang [#ruby-lang]
jxie has quit [Read error: Connection reset by peer]
Fushi has quit [Quit: Connection closed for inactivity]
jxie has joined #ruby-lang
izietto has quit [Quit: Sto andando via]
Gabri has joined #ruby-lang
Gabri has quit [Remote host closed the connection]
wallerdev has joined #ruby-lang
wallerdev has quit [Client Quit]
dingus_khan has joined #ruby-lang
dingus_khan has quit [Ping timeout: 272 seconds]
heftig has joined #ruby-lang
SkyHunter has quit [Ping timeout: 246 seconds]
bin7me has quit [Quit: WeeChat 0.4.3]
heftig has quit [Ping timeout: 240 seconds]
Forgetful_Lion has quit [Remote host closed the connection]
_dabradley has joined #ruby-lang
IslamAzab has joined #ruby-lang
amystephen has joined #ruby-lang
dabradley has quit [Ping timeout: 250 seconds]
IslamAzab has quit [Client Quit]
heftig has joined #ruby-lang
danijoo has quit [Read error: Connection reset by peer]
danijoo has joined #ruby-lang
rubyaw has joined #ruby-lang
dabradley has joined #ruby-lang
_dabradley has quit [Ping timeout: 240 seconds]
centrx has joined #ruby-lang
jds has quit [Quit: Connection closed for inactivity]
dingus_khan has joined #ruby-lang
heftig has quit [Ping timeout: 272 seconds]
dingus_khan has quit [Ping timeout: 260 seconds]
rubyaw has quit [Quit: Leaving...]
karamazov has joined #ruby-lang
Lingo__ has joined #ruby-lang
blarghlarghl has joined #ruby-lang
aef has quit [Remote host closed the connection]
yfeldblu_ has quit [Ping timeout: 246 seconds]
<blarghlarghl> hey. i am using open classes quite liberally in this project. i have some methods that i need to redefine in a class, but i don't want to overwrite the previous definition - i only want to append to it. how can i do that?
<blarghlarghl> caaaaaaa is spamming by the way.
aef has joined #ruby-lang
<jhass> complain to #freenode, ops here won't combat query spam
<blarghlarghl> ok
aef has quit [Remote host closed the connection]
heftig has joined #ruby-lang
nathanstitt has joined #ruby-lang
weems|mac has joined #ruby-lang
sarkyniin has joined #ruby-lang
<jhass> re. your question: if you can't solve that regularly through inheritance (for example by subclassing or Module#prepend), the two common methods are alias_method and saving the original with Object#method
<blarghlarghl> jhass: alias_method and ... can you elaborate on the last part there?
Mon_Ouie has joined #ruby-lang
Mon_Ouie has joined #ruby-lang
Mon_Ouie has quit [Changing host]
<centrx> blarghlarghl, Use inheritance or alias_method
<jhass> ^
<jhass> but
<jhass> >> class Foo; def foo; :foo; end; end; class Foo; old_foo = instance_method(:foo); define_method(:foo) { p old_foo.bind(self).call; :bar }; end; Foo.new.foo # for example
<eval-in> jhass => :foo ... (https://eval.in/177820)
<blarghlarghl> ah.
<blarghlarghl> gotcha
<blarghlarghl> thanks, jhass and centrx!
jxpx777 has quit [Ping timeout: 260 seconds]
aef has joined #ruby-lang
dingus_khan has joined #ruby-lang
dingus_khan has quit [Ping timeout: 246 seconds]
echoprinter has joined #ruby-lang
heftig has quit [Ping timeout: 272 seconds]
chouhoulis has joined #ruby-lang
karamazov has quit [Remote host closed the connection]
yfeldblum has joined #ruby-lang
dm78 has joined #ruby-lang
karamazov has joined #ruby-lang
yfeldblum has quit [Ping timeout: 260 seconds]
thomasxie has quit [Quit: Leaving.]
frank_o has joined #ruby-lang
heftig has joined #ruby-lang
tradekraft has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
aleatorik has joined #ruby-lang
frank_o has quit [Ping timeout: 240 seconds]
tbuehlmann has quit [Remote host closed the connection]
spastorino has joined #ruby-lang
heftig has quit [Ping timeout: 272 seconds]
chouhoulis has quit [Remote host closed the connection]
jxpx777 has joined #ruby-lang
mbj has joined #ruby-lang
sarkyniin has quit [Ping timeout: 264 seconds]
jxpx777 has quit [Ping timeout: 255 seconds]
|jemc| has joined #ruby-lang
|jemc| has quit [Client Quit]
|jemc| has joined #ruby-lang
hakunin has quit []
weems|mac is now known as weemsledeux
frank_o has joined #ruby-lang
dm78 has quit [Remote host closed the connection]
heftig has joined #ruby-lang
shinnya has quit [Ping timeout: 244 seconds]
dm78 has joined #ruby-lang
danijoo has quit [Read error: Connection reset by peer]
danijoo has joined #ruby-lang
yfeldblum has joined #ruby-lang
heftig has quit [Ping timeout: 272 seconds]
koderok has joined #ruby-lang
koderok has quit [Remote host closed the connection]
yfeldblum has quit [Ping timeout: 255 seconds]
danijoo has quit [Read error: Connection reset by peer]
danijoo has joined #ruby-lang
WilfredTheGreat has quit [Read error: Connection reset by peer]
emmesswhy has joined #ruby-lang
havenwood has joined #ruby-lang
WilfredTheGreat has joined #ruby-lang
sarkyniin has joined #ruby-lang
nofxx has joined #ruby-lang
banister has joined #ruby-lang
Phoenixmiss has joined #ruby-lang
Missphoenix has quit [Ping timeout: 245 seconds]
aleatorik has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
dm78 has quit []
karamazov has quit [Remote host closed the connection]
bin7me has joined #ruby-lang
amclain has joined #ruby-lang
Phoenixmiss has quit [Quit: Leaving]
eeezkil has joined #ruby-lang
gjaldon has quit []
WilfredTheGreat has quit [Read error: No route to host]
WilfredTheGreat has joined #ruby-lang
dingus_khan has joined #ruby-lang
sarkyniin has quit [Ping timeout: 246 seconds]
dingus_khan has quit [Ping timeout: 240 seconds]
agarie has joined #ruby-lang
sarkyniin has joined #ruby-lang
hellangel7 has joined #ruby-lang
mistym has joined #ruby-lang
charliesome has joined #ruby-lang
aleatorik has joined #ruby-lang
frank_o has quit [Ping timeout: 240 seconds]
karamazov has joined #ruby-lang
heftig has joined #ruby-lang
mikecmpbll has quit [Quit: i've nodded off.]
jgpawletko has joined #ruby-lang
jgpawletko has quit [Client Quit]
dm78 has joined #ruby-lang
echoprinter has left #ruby-lang ["Leaving"]
mikecmpbll has joined #ruby-lang
heftig has quit [Ping timeout: 272 seconds]
weemsledeux has quit [Quit: weemsledeux]
zz_anildigital is now known as anildigital
vintik has joined #ruby-lang
sMecKs has joined #ruby-lang
ta has joined #ruby-lang
ta_ has quit [Ping timeout: 240 seconds]
unsymbol has quit [Ping timeout: 240 seconds]
unsymbol has joined #ruby-lang
havenwood has quit []
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
symm- has joined #ruby-lang
sarkyniin has quit [Ping timeout: 240 seconds]
dm78 has quit [Remote host closed the connection]
charliesome has joined #ruby-lang
jamesfordummies has joined #ruby-lang
jamesfordummies has quit [Read error: Connection reset by peer]
jamesfor_ has joined #ruby-lang
mistym_ has joined #ruby-lang
mbj has quit [Quit: leaving]
mistym has quit [Ping timeout: 240 seconds]
jamesf___ has joined #ruby-lang
jamesfor_ has quit [Ping timeout: 260 seconds]
jamesfor_ has joined #ruby-lang
agarie has quit [Quit: Leaving...]
jame_____ has joined #ruby-lang
chouhoulis has joined #ruby-lang
jamesf___ has quit [Ping timeout: 272 seconds]
jamesfo__ has joined #ruby-lang
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
jamesfor_ has quit [Ping timeout: 272 seconds]
jamesfordummies has joined #ruby-lang
jame_____ has quit [Ping timeout: 260 seconds]
charliesome has joined #ruby-lang
charliesome_ has joined #ruby-lang
jamesfo__ has quit [Ping timeout: 240 seconds]
BubonicPestile-1 has joined #ruby-lang
jamesfordummies has quit [Client Quit]
BubonicPestilenc has quit [Ping timeout: 250 seconds]
charliesome has quit [Ping timeout: 245 seconds]
karamazov has quit [Remote host closed the connection]
sTeVe-VaI has joined #ruby-lang
wallerdev has joined #ruby-lang
emmesswhy has quit [Quit: This computer has gone to sleep]
dm78 has joined #ruby-lang
dm78_ has joined #ruby-lang
dm78 has quit [Read error: Connection reset by peer]
heftig has joined #ruby-lang
jamesfordummies has joined #ruby-lang
jamesfordummies has quit [Client Quit]
dm78_ has quit [Ping timeout: 272 seconds]
jamesfordummies has joined #ruby-lang
sTeVe-VaI has quit [Quit: Saindo]
heftig has quit [Ping timeout: 272 seconds]
charliesome_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
nofxx_ has joined #ruby-lang
nofxx has quit [Ping timeout: 255 seconds]
yfeldblum has joined #ruby-lang
vintik has quit [Remote host closed the connection]
heftig has joined #ruby-lang
yfeldblum has quit [Ping timeout: 255 seconds]
andriusfm has joined #ruby-lang
frank_o has joined #ruby-lang
skade has joined #ruby-lang
dingus_khan has joined #ruby-lang
dingus_khan has quit [Ping timeout: 260 seconds]
aleatorik has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
danijoo has quit [Read error: Connection reset by peer]
danijoo has joined #ruby-lang
spastorino has quit [Quit: Connection closed for inactivity]
InfraRuby has joined #ruby-lang
aleatorik has joined #ruby-lang
skade has quit [Quit: Computer has gone to sleep.]
duper has quit [Ping timeout: 260 seconds]
<frank_o> Hello! I got some code here which will filter out some arrays I don't need (ie. items that are not on sale): https://gist.github.com/frankie-loves-jesus/a136c355f3aa4265a1d6 -- any suggestions how I can make it more Ruby-like / beautiful though?
<frank_o> Also can somebody ban caaaaaaa? Free camshow spambot :P
duper has joined #ruby-lang
dingus_khan has joined #ruby-lang
<jamesfordummies> frank_o: check this out http://devblog.avdi.org/2010/08/02/using-and-and-or-in-ruby/
<frank_o> thanks jamesfordummies
<centrx> frank_o, I would question why you have a hash of arrays of hashes, and apparently it isn't even expected to necessarily be is_a?(Hash) or is_a?(Array)
<andriusfm> Also, could you give an example of response['products']?
<jhass> frank_o: use better variable names than e, f and g
<centrx> actually it's an array of hashes of arrays of hashes, plus miscellaneous
<frank_o> centrx: please hold actually im trying to rewrite it based on your example from yesterday :)
<frank_o> andriusfm: yep, coming right up! one sec please
vintik has joined #ruby-lang
<frank_o> centrx, andriusfm, please reload https://gist.github.com/frankie-loves-jesus/a136c355f3aa4265a1d6
<frank_o> pretty lousy pseudo-code but... also haven't yet improved jhass' variable names though.
vintik has quit [Remote host closed the connection]
vintik has joined #ruby-lang
dm78 has joined #ruby-lang
<centrx> frank_o, Why is there any doubt that x.is_a? Hash or y.is_a? Array ?
<frank_o> centrx: good point
nertzy has joined #ruby-lang
dm78 has quit [Ping timeout: 245 seconds]
nbarnett has joined #ruby-lang
<frank_o> centrx: a friend seemed to think it was necessary
<centrx> frank_o, How is the data created and where does it come from?
<centrx> frank_o, If you need to validate the data or the data structure, do that in separate code/a separate method, and handle it in some way like throwing or recording an error.
sharpmachine has joined #ruby-lang
<centrx> frank_o, If you just always expect bad data and want to ignore it, remove it from the data structure ahead of time.
tectonic has joined #ruby-lang
<centrx> frank_o, That will simplify your code so that one method is doing one thing and one function won't clutter the other by being mixed together
<centrx> frank_o, As for data access, I would store this structure in a database and then access it with SQL/ORM
<frank_o> centrx: the data comes from the Tradedoubler API and is fetched via REST Client (real code: https://gist.github.com/frankie-loves-jesus/11058955).
_ht has quit [Remote host closed the connection]
nbarnett has quit [Remote host closed the connection]
<frank_o> centrx: so you're saying that instead of first fetching the JSON, and then parsing it, and then filtering out the products that aren't on sale -- i should filter them out ideally while they're being fetched?
nbarnett has joined #ruby-lang
nbarnett has quit [Remote host closed the connection]
<frank_o> man i was on a roll yesterday, thought i had everything on lock, until it turned out that when searching for say womens jeans (http://api.tradedoubler.com/1.0/products.json;q=jeans;q=women), it returned a lot of mens products and other strange stuff as well like facial creams and hair removal kits :/
PsionTheory has joined #ruby-lang
<frank_o> luckily the json has a gender field and productGroup field with which to match the jeans..
<centrx> frank_o, Did you set the cross_dressing option to true accidentally?
<frank_o> :D
<centrx> frank_o, So when you get bad data, you might want to try the API again if you expect it might give the correct results, and/or you might want to log what happened so you can fix it later, whether it's a problem with your code or a change in the remote API
tectonic has quit []
<centrx> frank_o, or you might want to ignore it because you don't care if say 1% of the data is sometimes wrong
nathanstitt has quit [Quit: I growing sleepy]
<frank_o> Well, I figured i'd just retrieve 100 matches for jeans and then filter out the ones with gender = female. should be at least 20-30 of those.
<centrx> Also in reference to the is_a? issue with the data structure, different kinds of errors
nertzy has quit [Quit: This computer has gone to sleep]
jammanbo has joined #ruby-lang
<jammanbo> Can someone explain this? It seems very counterintuitive and I don't see anything in docs: URI.join('http://example.com', '/foo', '/bar') # => #<URI::HTTP:0x01aaf0b0 URL:http://example.com/bar> Where'd FOO go??
<frank_o> centrx: yeah my friends code is a mess. please disregard all of it.
andriusfm has quit [Quit: Leaving]
<jammanbo> Why the hell is join so fussy about slashes in URI? Seems un-ruby-like
<centrx> jammanbo, I think it might be treating each parameter as a possible component of a URI
<centrx> jammanbo, These components are divided into e.g. domain, path, query string
<centrx> So if you do URI.join("http://example.com", "foo", "?search=1")
<centrx> foo does not get removed, because here are three different components of a URI
tectonic has joined #ruby-lang
<centrx> but if you use two of the same type of components, only one is used
<jammanbo> hmm … then docs are less that clear about this.
<jammanbo> URI::join(str[, str, ...])
sharpmachine has quit [Remote host closed the connection]
postmodern has joined #ruby-lang
<centrx> jammanbo, It looks like it actually calls this: http://www.ruby-doc.org/stdlib-2.1.2/libdoc/uri/rdoc/URI/Parser.html#method-i-parse
<jammanbo> Oh my … this behaviour is very weird.
<centrx> jammanbo, and the name #join may be so it fits with File.join and such
apeiros has joined #ruby-lang
<jammanbo> trailing slashes seem to be the key, but I can see why there's no public documentation about it because I'd have no idea how to explain this weirdness succinctly!
<jammanbo> Ah File.join … I can always rely on thee
sharpmachine has joined #ruby-lang
mistym_ is now known as mistym
sarkyniin has joined #ruby-lang
robbyoconnor has quit [Excess Flood]
robbyoconnor has joined #ruby-lang
darkness has joined #ruby-lang
BubonicPestile-1 has quit [Quit: BubonicPestile-1]
darkness is now known as Guest81558
Guest81558 has quit [Max SendQ exceeded]
hellangel7 has quit [Ping timeout: 272 seconds]
hellangel7 has joined #ruby-lang
elia has joined #ruby-lang
hellangel7 has quit [Max SendQ exceeded]
hellangel7 has joined #ruby-lang
robbyoconnor has quit [Ping timeout: 246 seconds]
hellangel7 has quit [Max SendQ exceeded]
hellangel7 has joined #ruby-lang
robbyoconnor has joined #ruby-lang
WilfredTheGreat has quit [Read error: Connection reset by peer]
gianlucadv has joined #ruby-lang
hellangel7 has quit [Max SendQ exceeded]
jamesfordummies has quit []
hellangel7 has joined #ruby-lang
yliu has quit [Ping timeout: 255 seconds]
yliu has joined #ruby-lang
elia has quit [Ping timeout: 245 seconds]
hellangel7 has quit [Max SendQ exceeded]
saarinen has joined #ruby-lang
dm78 has joined #ruby-lang
WilfredTheGreat has joined #ruby-lang
WilfredTheGreat has quit [Read error: Connection reset by peer]
yfeldblum has joined #ruby-lang
dm78 has quit [Ping timeout: 264 seconds]
Lingo__ has quit [Quit: Computer has gone to sleep.]
yfeldblum has quit [Ping timeout: 246 seconds]
elia has joined #ruby-lang
yfeldblum has joined #ruby-lang
jammanbo has left #ruby-lang [#ruby-lang]
hellangel7 has joined #ruby-lang
hellangel7 has quit [Max SendQ exceeded]
saarinen has quit [Quit: saarinen]
hellangel7 has joined #ruby-lang
hellangel7 has quit [Max SendQ exceeded]
hellangel7 has joined #ruby-lang
dingus_khan has quit [Remote host closed the connection]
hahuang61 has joined #ruby-lang
ddv has quit [Changing host]
ddv has joined #ruby-lang
charliesome has joined #ruby-lang
nertzy has joined #ruby-lang
elia has quit [Ping timeout: 250 seconds]
dm78 has joined #ruby-lang
PsionTheory has quit [Remote host closed the connection]
hahuang61 has quit [Ping timeout: 260 seconds]
havenwood has joined #ruby-lang
elia has joined #ruby-lang
elia has quit [Client Quit]
kuanding_ has joined #ruby-lang
kuanding has quit [Ping timeout: 272 seconds]
kuanding_ is now known as kuanding
frank_o has quit [Ping timeout: 260 seconds]
elia has joined #ruby-lang
_lexjm has joined #ruby-lang
_lexjm has quit [Max SendQ exceeded]
anildigital is now known as zz_anildigital
nertzy has quit [Quit: This computer has gone to sleep]
spastorino has joined #ruby-lang
hellangel7 has quit [Remote host closed the connection]
solars has joined #ruby-lang
aleatorik has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
dingus_khan has joined #ruby-lang
AKASkip has quit [Ping timeout: 245 seconds]
ur5us has joined #ruby-lang
vintik has quit [Remote host closed the connection]
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
_elia has joined #ruby-lang
elia has quit [Ping timeout: 272 seconds]
sharpmachine has quit [Remote host closed the connection]
sharpmachine has joined #ruby-lang
sharpmachine has quit [Remote host closed the connection]
charliesome has joined #ruby-lang
ari-_-e has quit [Quit: Leaving]
vintik has joined #ruby-lang
hahuang61 has joined #ruby-lang
marr has joined #ruby-lang
emmesswhy has joined #ruby-lang
djbkd has joined #ruby-lang
sharpmachine has joined #ruby-lang
x0f_ has joined #ruby-lang
frank_o has joined #ruby-lang
x0f has quit [Ping timeout: 260 seconds]
vintik has quit [Remote host closed the connection]
hahuang61 has quit [Quit: WeeChat 0.4.3]
solars has quit [Ping timeout: 272 seconds]
karamazov has joined #ruby-lang
Atttwww has joined #ruby-lang
solars has joined #ruby-lang
nertzy has joined #ruby-lang
<frank_o> centrx: I understand a little bit better what you meant earlier. Brb
banister has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
blarghlarghl has left #ruby-lang [#ruby-lang]
banister has joined #ruby-lang
banister has quit [Max SendQ exceeded]
solars has quit [Ping timeout: 246 seconds]
banister has joined #ruby-lang
<dingus_khan> jhass: i logged out since the question, so if you switched it back to mess with me, perfect crime
<jhass> dingus_khan: I've a bouncer running, it changes my nick when I log off
<dingus_khan> jhass: TIL there are things called bouncers
banister has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
banister has joined #ruby-lang
tectonic has quit []
djbkd has quit [Remote host closed the connection]
saarinen has joined #ruby-lang
djbkd has joined #ruby-lang
<darix> dingus_khan: there are also things like screen/tmux + irssi/weechat
banister has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<dingus_khan> darix: i need to try the tmux thing, but i just found madeye
<darix> madeye?
saarinen has quit [Ping timeout: 260 seconds]
saarinen has joined #ruby-lang
tectonic has joined #ruby-lang
weems|mac has joined #ruby-lang
emmesswhy has quit [Quit: Leaving]
mistym has quit [Remote host closed the connection]
mistym has joined #ruby-lang
mistym has quit [Remote host closed the connection]
saarinen has quit [Quit: saarinen]
toretore has quit [Quit: This computer has gone to sleep]
dorei has quit []
bzb has joined #ruby-lang
bzb has quit [Read error: Connection reset by peer]
aleatorik has joined #ruby-lang
centrx has quit [Quit: Mead error: Connection reset by beer]
centrx has joined #ruby-lang
yatish27 has joined #ruby-lang
<frank_o> Greetings centrx !
<centrx> Ahoy
<frank_o> centrx: You meant something like https://gist.github.com/frankie-loves-jesus/11058955#file-1-third_party_products-rb-L45-L61 earlier right? coupled with L83
<centrx> frank_o, Yes, exactly
<frank_o> I will ofcourse import the products into my db later on, just need to get something temp working first
<frank_o> Great!
<centrx> frank_o, But instead of calling all the validations in ThirdPartyProducts#fetch
mikecmpbll has quit [Quit: i've nodded off.]
<centrx> frank_o, I would have a #validate method that uses a constant VALIDATIONS = [:gender, :category]
banister has joined #ruby-lang
<centrx> frank_o, then VALIDATIONS.each { |it| send("ensure_#{it}") } with perhaps some handling for whatever you want to do when it errors
apeiros has quit [Remote host closed the connection]
mikecmpbll has joined #ruby-lang
apeiros has joined #ruby-lang
weems|mac has quit [Quit: weems|mac]
ti-wali has joined #ruby-lang
banister has quit [Ping timeout: 255 seconds]
danijoo has quit [Read error: Connection reset by peer]
banister has joined #ruby-lang
<frank_o> centrx: a bit embarassing but im not sure i entirely follow: https://gist.github.com/frankie-loves-jesus/11058955
danijoo has joined #ruby-lang
<frank_o> centrx: what sort of error handling did you have in mind?
mikecmpbll has quit [Quit: i've nodded off.]
jhass is now known as jhass|off
<centrx> frank_o, Error handling = however you want to handle the bug in the remote data source, e.g. ignore it
<centrx> frank_o, Yes, that code you linked, that's the idea
<centrx> frank_o, Of course there's a mismatch between the method names and the method call (send) in that gist
<centrx> and the actual validation is not implemented, so that's where the "error handling" comes in.
<centrx> frank_o, I would make more use of separate methods
<centrx> frank_o, #fetch is a huge method. Imagine, if you will, that there was a rule that every method could be no more than FIVE lines long
<centrx> frank_o, Of course, that can't be a hard and fast rule, but it makes for very clear, self-documenting, Rubytastic code
<centrx> frank_o, Even have 40% of your methods be ONE line
<centrx> frank_o, So your code becomes almost a series of words and sentences chained together as methods
_elia has quit [Quit: Computer has gone to sleep.]
<frank_o> Wow.. you just completely changed my view of the world
<frank_o> Yeah I'm all for such a restructuring
chrisseaton has left #ruby-lang [#ruby-lang]
sepp2k has quit [Read error: Connection reset by peer]
weems|mac has joined #ruby-lang