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
<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
<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?
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]
<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)
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
<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 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
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]
<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