fflush changed the topic of #ruby to: Ruby 1.9.3-p194: http://ruby-lang.org || Paste > 3 lines of text on pastebin.com
bier has joined #ruby
adamkittelson has quit [Remote host closed the connection]
Ethan has joined #ruby
cj3kim has joined #ruby
Ethan is now known as Guest98804
hamfz_ has quit [Ping timeout: 244 seconds]
hamfz_ has joined #ruby
krusty_ar_ has joined #ruby
mahmoudimus has quit [Quit: Computer has gone to sleep.]
levieraf has joined #ruby
mahmoudimus has joined #ruby
<shevy>
zastern ruby only treats leading character as constant, if it is upcased. the rest can be mixed case or all upcased, ruby does not care
krusty_ar has quit [Ping timeout: 272 seconds]
<shevy>
zastern but class and module names are typically like "class Foo". Then, constants are all UPCASED usually to differentiate from that. class Foo; KEEP_DIRECTORY = true
<shevy>
I dont know many people who write class FOO
lae has quit [Quit: bad irssi bad]
ZachBeta has joined #ruby
lae has joined #ruby
lae has quit [Client Quit]
lae has joined #ruby
hamfz_ has quit [Ping timeout: 240 seconds]
mahmoudimus has quit [Quit: Computer has gone to sleep.]
mxweas has quit [Quit: Computer has gone to sleep.]
mahmoudimus has joined #ruby
BrokenCog has quit [Quit: leaving]
phinfonet has quit [Quit: phinfonet]
nateberkopec has quit [Quit: Leaving...]
linoj has quit [Quit: linoj]
cj3kim has left #ruby ["Leaving"]
cj3kim has joined #ruby
cj3kim has left #ruby [#ruby]
drago757 has quit [Remote host closed the connection]
drago757 has joined #ruby
busybox42 has quit [Ping timeout: 240 seconds]
mahmoudimus has quit [Quit: Computer has gone to sleep.]
justsee is now known as justsee|away
BrokenCog has joined #ruby
mxweas has joined #ruby
sgronblom has joined #ruby
Rezwan has joined #ruby
theRoUS has quit [Ping timeout: 264 seconds]
Guedes has joined #ruby
igotnolegs has quit [Quit: Computer has gone to sleep.]
banisterfiend has quit [Remote host closed the connection]
gmci has quit [Read error: Connection reset by peer]
Quadlex has joined #ruby
<Quadlex>
Hi everyone
minijupe has joined #ruby
<Rezwan>
hi Quadlex
cableray has quit [Read error: Operation timed out]
SCommette has quit [Quit: SCommette]
gmci has joined #ruby
hemanth_ is now known as hemanth
<Quadlex>
I have a problem
<Quadlex>
I feel like my code is... shitty
<Quadlex>
Well, rather, that my tests are shitty
<Quadlex>
I feel like I don't wuite "Get" unit testing
cakehero has quit [Quit: Leaving...]
cakehero has joined #ruby
cakehero has quit [Client Quit]
Lachryma has quit [Read error: Connection reset by peer]
delinquentme has quit [Read error: Connection reset by peer]
<davidcelis>
why
igotnolegs has joined #ruby
Gab0 has quit [Remote host closed the connection]
lldong has joined #ruby
<Quadlex>
I have a message handling class
<Quadlex>
It has a reply_header method, a generate_metadata method and a handler_add_message method
<Quadlex>
I can easily test that reply_Header and gennerate_metadata create what they should by pairing up input and output tests (They're hash builders)
<Quadlex>
But to test add_message works I need to ensure it passes another hash to another method. I can mock the reciever out and test it's being called with the expected parameter
<Quadlex>
But to do so I have to hand-construct the expected parameter and it just feels clunky
sailias has quit [Ping timeout: 272 seconds]
uris has quit [Quit: leaving]
dhruvasa1ar has joined #ruby
dhruvasagar has quit [Ping timeout: 272 seconds]
mikemac has joined #ruby
ananthakumaran has quit [Quit: Leaving.]
cj3kim has joined #ruby
kevinbond has quit [Quit: kevinbond]
justsee is now known as justsee|away
anekos has quit [Remote host closed the connection]
<aces23up>
bnagy also crazy question, but can I change execution of script, by doing a trace of code?
<aces23up>
like for instance.
<aces23up>
I want to convert a method call
<aces23up>
the lines in it.
<aces23up>
to asyncronous.
<aces23up>
meaning i want to do processing before and after each line in a particular method.
<bnagy>
most of that doesn't make sense to me, but the parts that do sound like Doing It Wrong
Crisewng has joined #ruby
yxhuvud has joined #ruby
xmajoh has left #ruby ["Lämnar"]
mxweas has joined #ruby
tonni has joined #ruby
jprovazn_away is now known as jprovazn
mockra has joined #ruby
artOfWar has joined #ruby
maesbn has joined #ruby
savage- has quit [Remote host closed the connection]
<eggie5>
I'm writing some code to track follows/friends on twitter over time. I have a DSL working but and just trying to figure out how to persist it: https://gist.github.com/e6d46087596987ad480e
<eggie5>
any ideas?
fayimora has joined #ruby
artOfWar has quit [Remote host closed the connection]
mockra has quit [Ping timeout: 245 seconds]
Progster has quit [Ping timeout: 260 seconds]
artOfWar has joined #ruby
goganchic has joined #ruby
mrdodo has quit [Remote host closed the connection]
artOfWar has quit [Read error: Connection reset by peer]
mahmoudimus has joined #ruby
artOfWar has joined #ruby
aganov has joined #ruby
Guest91275 has quit [Quit: Guest91275]
mrdodo has joined #ruby
banisterfiend has joined #ruby
<_br_>
eggie5: Do you want to keep all the historical data forever or is it ok to throw it away after some time?
<_br_>
eggie5: Possibly you want to throw e.g. the datamapper gem into the mix. Then you can just choose e.g. a sqlite database
cj3kim has quit [Quit: This computer has gone to sleep]
<eggie5>
_br_: well the historic data is used to show you if you getting people to follow you back more effectively or not. So i want to keep it, but there can be limits
<eggie5>
_br_: so I don't even have to worry about the persistence ?
<eggie5>
would it be able to persist that structure I already have?
<_br_>
eggie5: go with orm (e.g. datamapper) then you can just choose what database backend you need allowing you to either be flat file (sqlite) or use some other more complex backends. There is also a redis gem you could use.
jeff_sebring has joined #ruby
<eggie5>
_br_: i'll look into that
<eggie5>
I was thinking redis or some key value store would be a good match for this data, because it's just a big hash table anyways
<_br_>
eggie5: With a little rewriting of the User class making it a datamapper resource, I think yes.
igotnolegs has quit [Quit: Computer has gone to sleep.]
<_br_>
eggie5: well if you don't want to switch later db's, sure.
<_br_>
I wouldn't choose redis for this. A flat file db is perfectly fine imo.
<eggie5>
_br_: so you think redis? I was winding what others thought. I think so too
<eggie5>
and translates 1:1 w/ the in-memory structre
julio has quit [Ping timeout: 250 seconds]
mxweas has quit [Quit: Computer has gone to sleep.]
thomasfedb has quit [Remote host closed the connection]
<_br_>
eggie5: then go for redis I guess. There are tons of key-value db's. If you are sure you don't need a orm because later you change, its fine I suppose.
artOfWar has quit [Remote host closed the connection]
<bnagy>
if you use any KV store you can abstract your own access etc
<bnagy>
you don't need a 'real' ORM
<eggie5>
_br_: well using the ORM would be the easiest choice. I'm not in a rush or anything I want to choose the best fit
jonathanwallace has quit [Remote host closed the connection]
<eggie5>
bnagy: and that's what I did already by design the objects first
<bnagy>
every single KV store will have get and put primitives which is more or less all you need
<eggie5>
My User class inherits from Model which is an empty class as-of-now since I haven't decided on persistance
fayimora has quit [Quit: Busy…..zzzzz]
<bnagy>
although, warning, what you're doing sounds relational
<bnagy>
but that's based on almost no understandig of it
<eggie5>
i just wonder if a a key that long multiplied by X amount keys would be a waste of memory
<eggie5>
bnagy: does it???
<bnagy>
yeah, to me
<eggie5>
it's barely…. Users have many followers and friends
<bnagy>
like, I would want to say like 'who followed bob between april and november' etc
sevvie has quit [Quit: sevvie]
tsolan has quit [Ping timeout: 245 seconds]
<bnagy>
'who follows bob that also follows frank'
<bnagy>
all that stuff is easier for my brain to model as relational querie4s
<eggie5>
bnagy: hmm good point, i'll take note of those examples
Morkel has joined #ruby
<bnagy>
in which case go for an ORM or Sequel or something
ekx has left #ruby [#ruby]
<bnagy>
you can still swap out DBs with Sequel, but I don't know if it is still cool. I used to love it :(
fralcon has joined #ruby
dhruvasagar has joined #ruby
mxweas has joined #ruby
Eldariof-ru has quit []
vvgomes has joined #ruby
arturaz has joined #ruby
monkegjinni has joined #ruby
mxweas has quit [Client Quit]
<eggie5>
bnagy: I added 'should show who followed me between april and november' but the second scenario doesn't fit into my use case
<eggie5>
bnagy: thanks though -- that's a good one
tonni has quit [Remote host closed the connection]
<eggie5>
but i'm not sure if my current object model would support just showing it between certain monthes
adeponte has joined #ruby
goganchic has quit [Ping timeout: 246 seconds]
nicoulaj has joined #ruby
artOfWar has joined #ruby
monkegjinni has quit [Remote host closed the connection]
goganchic has joined #ruby
mxweas has joined #ruby
thomasfedb has joined #ruby
tonni has joined #ruby
<Paradox>
shipping a 8 TB drive on 3 day shipping is equivalent to a 246.9 megabit connection
<bnagy>
that's nothing compared to ejeculation
JeanMertz has quit [Quit: JeanMertz]
qwerxy has quit [Quit: offski]
Gneiss has joined #ruby
<Gneiss>
hello
<Gneiss>
anyone here?
<Gneiss>
:P
Gneiss has quit [Client Quit]
artOfWar_ has joined #ruby
<bnagy>
depends, are you a cop?
<Paradox>
bnagy, nope
<Paradox>
but the fastest data transfer rate ever recorded
<Paradox>
was when google opened up a new european data center and copied some of their data to it
ryanf has joined #ruby
<Paradox>
a petabyte or two shipped
<banisterfiend>
bnagy: what's ejeculation
<bnagy>
banisterfiend: ask your father
<banisterfiend>
bnagy: same thing as ejaculation?
<banisterfiend>
:P
<Paradox>
banisterfiend, when a man and a woman love each other very much, the woman (or man if they are a gay couple) stimulates the mans penis till it shoots ice cream
<bnagy>
Paradox: I don't believe that you be the case
<bnagy>
s/you/to/
<Paradox>
bnagy, tomorrows soup is not flavored of atoms
swarley has joined #ruby
<swarley>
Look at the stupid thing i made after half an hour of screwing with objective-c :p http://pastebin.com/GxzcJjJU
artOfWar has quit [Ping timeout: 255 seconds]
TheDeadSerious has joined #ruby
a_a_g has joined #ruby
wm3|zzz has quit [Ping timeout: 255 seconds]
andrewhl has joined #ruby
<Hanmac1>
objective-c is nothing i want to see in ruby ... (okay its something i dont want to see in general)
Hanmac1 is now known as Hanmac
<swarley>
yeah, i just got bored
<Hanmac>
when i got bored i building on my ogre binding
<swarley>
all it does is loosely enforce type arguments and return types
<swarley>
lol
justsee is now known as justsee|away
qwerxy has joined #ruby
vectorshelve has joined #ruby
<vectorshelve>
Hai
<vectorshelve>
hemanth: good day :)
hoelzro|away is now known as hoelzro
wallerdev has quit [Quit: wallerdev]
MarGarina has joined #ruby
ryh has quit [Remote host closed the connection]
mockra has joined #ruby
venkatk_ has joined #ruby
<vectorshelve>
sevenseacat: I will be testing my app using cucumber and rspec but firstly I would like to create a test harness so that's what I want a reference on. I am very new to Testing :)
TheDeadSerious has quit [Ping timeout: 272 seconds]
Gurpartap has joined #ruby
subbyyy has quit [Read error: Connection reset by peer]
subbyyy has joined #ruby
subbyyy has quit [Max SendQ exceeded]
subbyyy has joined #ruby
swistak35 has quit [Excess Flood]
subbyyy has quit [Max SendQ exceeded]
subbyyy has joined #ruby
swistak35 has joined #ruby
mockra has quit [Ping timeout: 272 seconds]
subbyyy has quit [Client Quit]
moshef has joined #ruby
mahmoudimus has quit [Quit: Computer has gone to sleep.]
TPFC-SYSTEM has joined #ruby
mxweas has quit [Quit: Leaving...]
Rochefort has joined #ruby
goganchic has quit [Ping timeout: 272 seconds]
digitalcakestudi has quit [Ping timeout: 264 seconds]
fivetwentysix has joined #ruby
<hemanth>
vectorshelve, hey
<fivetwentysix>
Hi, I'm trying to use the google-ads-common gem, but I can't seem to require of the files in my rails app. I tried require 'google-ads-common' but it tells me it can't be found :(
<hoelzro>
hmm...I'm kinda surprised they didn't teach you that, or at least mention it
<ini>
well i am very very new to programming
krz has quit [Quit: krz]
<ini>
but could not find any rference to this stuff in the book or online
<Hanmac>
hoelzro its in the next chapter
maxmmurphy has joined #ruby
Eldariof-ru has joined #ruby
<Hanmac>
ini the tutorial may not be 100% currect to your ruby version ... (what ruby version did you use?)
goganchic has quit [Ping timeout: 272 seconds]
<ini>
one moment
blacktulip has joined #ruby
<ini>
ruby 1.9.3p125
<ini>
and using jetbrains rubymine
<ini>
4.5
<GlenK>
anyone familiar with ruby koans? sorta fill in the blanks ruby scripts to teach you some junk? Anyhow, on this one: "assert_equal __, false.object_id", I guess I'm supposed to fill in 0? so it's trying to tell me the false object always has id 0? Sound about right?
<Hanmac>
what maybe is different then the tutorial says is ?a ... on your version its not the character code, its only "a"
ph^ has joined #ruby
<ini>
another one what does @@foo = 0 mean
<GlenK>
gah. seems like a stupid question now that I think about it
timonv has joined #ruby
<ini>
i know its quite stupid question, but cant be embarassed if i want to learn :)
<bnagy>
ini: actually you can
eggie5 has quit [Quit: eggie5]
maxmmurphy has quit [Quit: maxmmurphy]
<bnagy>
if you think it's a stupid question, and feel embarassed you're more likely to find the answer out yourself, which will teach you much more
<bnagy>
don't take this the wrong way, but my heuristics have led me to always do the opposite of what you say wrt to videos and images
<bnagy>
ooh shit olympics have started I think
bullicon has joined #ruby
<GlenK>
so I don't get this statement: Older versions of Ruby - 1.8.x and older - required you to set default values for parameters starting with the last parameter in list and moving backward toward the first. The current version of Ruby (1.9.x) no longer has this limitation
<GlenK>
how could you have say a default on the first parameter but not the last.
jimeh2 is now known as jimeh
<Mon_Ouie>
def foo(bar = 3, baz); [bar, baz]; end # try that with one and then two argumemnts
<GlenK>
hmm. yeah. another stupid question on my part I suppose. I guess as long as it's not ambiguous?
<Mon_Ouie>
Yeah. I still wouldn't recommend using that feature though.
Markvilla has joined #ruby
<Mon_Ouie>
It's rather confusing that the same parameter can be either the first or the second argument depending on how many you pass
CaptainJet has quit []
rutkla has joined #ruby
* Hanmac
likes the pseudo-named parameters :P
<hemanth>
Hanmac, example plz
indian has quit [Ping timeout: 252 seconds]
<bnagy>
foo cake: :yes_please
companion has quit [Ping timeout: 276 seconds]
<banisterfiend`>
Mon_Ouie: wowthat' crazy i didnt know about that
D4T has quit [Ping timeout: 244 seconds]
gokul has joined #ruby
<Mon_Ouie>
Actually, me neither; I only knew that the splat argument wasn't required to be the last one anymore.
arturaz has joined #ruby
<hoelzro>
hemanth: I think Hanmac means method foo: 17, bar: 18
<hemanth>
instead of def foo(bar = 3, baz); ?
anekos has quit [Remote host closed the connection]
<Mon_Ouie>
def foo(opts = {})
JohnBat26 has joined #ruby
<hoelzro>
it'd be nice if you could do something like def foo(opts = {bar: 1, baz: 2})
robotmay has quit [Remote host closed the connection]
robotmay has joined #ruby
bier has quit [Remote host closed the connection]
s1n4 has quit [Quit: leaving]
bier has joined #ruby
saschagehlich has joined #ruby
JohnBat26 has joined #ruby
scott[8] has quit [Quit: scott[8]]
Spooner has joined #ruby
moshef_ has joined #ruby
berserkr has joined #ruby
sendoushi has joined #ruby
moshef has quit [Ping timeout: 255 seconds]
moshef_ is now known as moshef
M- has quit [Quit: Leaving]
opus has joined #ruby
tonini has quit [Remote host closed the connection]
nari has quit [Ping timeout: 248 seconds]
tonini has joined #ruby
nyuszika7h has joined #ruby
vlad_starkov has joined #ruby
tonini has quit [Ping timeout: 264 seconds]
[Neurotic] has quit [Quit: need food]
indian has joined #ruby
hemanth has quit [Read error: Connection reset by peer]
hemanth has joined #ruby
mrdodo has joined #ruby
mneorr has joined #ruby
<GlenK>
so...seems like the tutorial I'm reading says this should work: "def calculate(*input, flags = {})" It doesn't seem to like me trying to make flags default to an empty hash though.
<GlenK>
any advice?
<Mon_Ouie>
Where did it say that would work?
stefanp has joined #ruby
stefanp has quit [Changing host]
stefanp has joined #ruby
<banisterfiend`>
GlenK: the way ppl do that is: def calculate(*input)
<GlenK>
well, I'm supposed to pass it something like so: calculate(0, 0, 0, 0, -10, subtract: true)
chussenot has quit [Read error: Connection reset by peer]
mrdodo has quit [Ping timeout: 255 seconds]
<banisterfiend`>
GlenK: and then check that input.last.is_a?(Hash)
nari has joined #ruby
<GlenK>
and it just introduced splat and the default hash thing. I figured it wanted me to combine the two concepts to be able to deal with that input.
Markvilla has quit [Quit: Markvilla]
robozahn has quit [Quit: leaving]
<GlenK>
banisterfiend`: which is why it seems to make sense that you'd just default to an empty hash.
<GlenK>
hmm. seems the splat thing and a default to an empty has are incompatible with each other though?
<GlenK>
seems odd that they would be...
<JonnieCache>
put them in brackets
<JonnieCache>
and splat the brackets
<banisterfiend`>
GlenK: it's not valid to have *args, default=blah
Markvilla has joined #ruby
<banisterfiend`>
GlenK: so u have to do something like i said..im not sure what JonnieCache means though, maybe u could ask him to explain
cascalheira has joined #ruby
<JonnieCache>
sorry i didnt realise exactly what you meant
<Mon_Ouie>
Why? It *is* ambiguous — as soon as there's one variable, how do you decide whether to make it be flags or part of input?
<GlenK>
hmm. yeah, I guess if you're passing more than one argument it gets sorta messed up with the splat. didn't consider that
<Mon_Ouie>
Even with just one argument
<JonnieCache>
i thought you were doing the old || {} rather than using default parameters
<Hanmac>
Glenk: the best way is input = args[-1].is_a?(Hash) : args.pop : {}
Foxandxss has joined #ruby
<Mon_Ouie>
s/:/?/
<Hanmac>
yeah, sorry
<GlenK>
yeah, this stupid tutorial though. I dunno how it expects me to magically know about is_a?(Hash).
<GlenK>
anyhow, thanks all
<oddmunds>
how about just putting the hash first in the arguments?
<banisterfiend`>
Hanmac: makes overloading methods based on arity possible
<shevy>
if I'd want to have some common instance variables, I'd have to subclass all my classes in a given project, from a base class
<workmad3>
shevy: subclassing is a tool... it's not there to be liked or disliked, merely to be used
<workmad3>
shevy: right, in that case then yes, modules like the one you showed can provide a different implementation mechanism
<shevy>
I cant use things I dislike. I gave up @@ entirely because I dont like it at all
<banisterfiend`>
Hanmac: is that what u had in mind too?
<workmad3>
shevy: @@ is mostly useless... subclassing is not mostly useless :)
<shevy>
yeah
<Hanmac>
banisterfiend` hm interesting, but i want to make it possible based on Types
<workmad3>
shevy: subclassing is a way of describing relationships...
<workmad3>
shevy: in all honesty, what I think you're hitting is more of a lack of understanding of what subclassing actually is
<banisterfiend`>
Hanmac: how would u provide the type information? with a class method decorator? or what?
<workmad3>
shevy: you know my view is that subclassing is overused... but the response to that isn't to jump ship entirely, it's to actually put thought into when you want and don't want to create a type hierarchy ;)
<banisterfiend`>
Hanmac: you can do it like this if you use method_source: def hello(arg1=String, arg2=Fixnum)
<Hanmac>
instatt of def i would use def_typed(:name, Float,Integer) {|f,i| ... }
<shevy>
dunno
<shevy>
I felt constrained by the subclassing pattern in the past
<banisterfiend`>
Hanmac: and use clever metaprogramming tricks to rewrite the method
<banisterfiend`>
Hanmac: baby doesnt like that, too weird
<workmad3>
shevy: again, I don't see why you're so resistant to anything that constrains options
<workmad3>
shevy: everything is adding an extra constraint, putting more definition into what you want to express
<Hanmac>
your way breaks the default args (ok my way too but i think in my way its manageable)
<banisterfiend`>
workmad3: have you seen Asher's parallel ancestry? :P
<workmad3>
shevy: subclasses impose certain constraints, yes... which is why you put thought into when you use it, so that you only use it when those constraints make sense
<banisterfiend`>
Hanmac: mine will only break defaults in the case the default is a class :P (which is rare as a german speaking horse)
<workmad3>
shevy: in the same way that using a symbol imposes constraints
<workmad3>
shevy: or that using ruby itself imposes constraints
<shevy>
I dont like symbols either
* workmad3
facepalms
<banisterfiend`>
workmad3: shevy is insane in the membrane
<shevy>
other than taking up less memory, I fail to see the cool thing about them
<banisterfiend`>
workmad3: would u believe he's been programming ruby for 5 years? :P
<Hanmac>
i use symbols as enum replacement
<workmad3>
shevy: why do they have to be cool to be useful?
<shevy>
workmad3 because they add complexity
<workmad3>
shevy: no they don't, they remove it
saschagehlich has quit [Quit: saschagehlich]
<shevy>
just as @@ does to
<workmad3>
shevy: symbols are immutable, strings aren't
<workmad3>
shevy: so passing around a symbol means you can't accidentally leak class internals that can be changed
<shevy>
what does this mean?
<shevy>
"leak class internals"
<matti>
Hi shevy
<shevy>
hey matti
<workmad3>
shevy: it means if you return a string that's stored inside an instance variable, you have just unwittingly allowed any part of your program to change that without notifying your class
* matti
throws some PHP4 code towards shevy
zemanel has quit [Quit: zemanel]
<workmad3>
shevy: you've leaked the internals
<Mon_Ouie>
https://gist.github.com/3205958 — written a long time ago (so don't worry about the dragons, they're probably dead already)
<Hanmac>
shevy like object.imgtype.replace("shit")
<Mon_Ouie>
shevy: How could you not like symbols? They have a pretty color in almost all color themes, surely they must be nice!
nateberkopec has joined #ruby
<shevy>
complexity is the root of all evil
<banisterfiend`>
Mon_Ouie: haha that's some scary code monny!!!!!!!!!!!
<fivetwentysix>
rubygems down?
<fivetwentysix>
lol
mneorr has quit [Ping timeout: 252 seconds]
<Hanmac>
Mon_Ouie your gist looks funny ... can i use it as inspiration?
<workmad3>
shevy: stop making all forms of complexity the same
<Mon_Ouie>
Hanmac: Sure
<workmad3>
shevy: and stop assuming that just because some detail carries some extra complexity that it automatically makes everything it touches more complex (it's a false assumption)
arkiver has joined #ruby
Araxia has quit [Quit: Araxia]
fixl has joined #ruby
bwwrd has joined #ruby
<banisterfiend`>
Hanmac: by 'funny' u mean 'fun' ?
<Hanmac>
funny is an adijective
x0F has quit [Disconnected by services]
x0F_ has joined #ruby
<banisterfiend`>
Hanmac: 'funny' and 'fun' mean quite different things :P but foreigners often mess them up
x0F_ is now known as x0F
<banisterfiend`>
Hanmac: if something is 'funny' it means it's humorous and makes you laugh
<banisterfiend`>
if something is 'fun' it means you find it entertaining/enjoyable
<banisterfiend`>
they're quite different
<Hanmac>
i think its both :P
<Mon_Ouie>
I think being able to do a_string_or_an_integer_or_a_class is pretty funny
<banisterfiend`>
hehe ok
Crisewng has quit [Quit: Leaving.]
robotmay has quit [Ping timeout: 264 seconds]
mucker has joined #ruby
catphish has joined #ruby
<Hanmac>
i prefer: when_given(String, Integer) { |s,i| ... }, and maybe this: when_given(:to_f, :to_i) { |f,i| ... }
<banisterfiend`>
Hanmac: it's a cute project but i dont think anyone would actually use it
TPFC-SYSTEM has quit [Quit: TPFC-SYSTEM]
<catphish>
is anyone here familiar with mikel's mail and character encoding?
<banisterfiend`>
you're defining a hash instead a block there?
<dominikh>
I've had a reason for the proc. no idea why anymore
<Spooner>
A block with a hash in it, by the looks of it.
<dominikh>
but yeah, block with hash in it indeed
<banisterfiend`>
dominikh: maybe cos u wanted to re-evaluate the defaults each time the method was called
<banisterfiend`>
like: def hello(x = rand())
<dominikh>
yes, that's why
<Spooner>
Maybe you wanted to allow the user to have _different_ default args based on magic?
<workmad3>
banisterfiend`: that's what I was thinking :)
<banisterfiend`>
is reevaluated each time you call hello()
<dominikh>
banisterfiend` is right
bj0ern has joined #ruby
<workmad3>
but I like Spooner's suggestion...
<workmad3>
you could have a proc with a counter, so you can have a default arg consisting of how many times the default args have been used! :D
<Spooner>
A fiber would be even better.
<workmad3>
can anyone tell it's monday morning and I'm waiting for a long test suite to finish running? :)
<banisterfiend`>
i love fibers too bad they dont like me
ananthakumaran has quit [Quit: Leaving.]
yakko has joined #ruby
<Spooner>
I have found them very useful.
<Spooner>
Thankfully they don't segfault Gosu any more :)
ephemerian1 has joined #ruby
<banisterfiend`>
i just keep getting ridiculous errors when using them
ephemerian1 has quit [Client Quit]
<Spooner>
I'm surprised you haven't tried any of your mad hacks with them.
<banisterfiend`>
error: fiber called across stack rewinding barrier
bosphorus has joined #ruby
<workmad3>
banisterfiend`: still getting that one? was it to do with 'next' throwing a symbol? :)
TPFC-SYSTEM has joined #ruby
<banisterfiend`>
workmad3: yeah, it's something deep in ruby-debug internals
<Spooner>
Oh, I remember you saying that. I've not had any unexpected behaviour, but they are a little fiddly to use.
mockra has joined #ruby
<Hanmac>
someday i want to make a ruby thing similar to Towlies Book ... "a million little Fibers" :P
<banisterfiend`>
that i cant be bothered figuring out, if i use pry-nav (which is set_trace_func-based) instead of pry-debugger (which is ruby-debug based) then it works fine and i dont get the error
companion has joined #ruby
<workmad3>
banisterfiend`: debuggers have, I believe, a good history of completely buggering up when encountering threads and fibers :)
goganchic has quit [Ping timeout: 255 seconds]
ephemerian has quit [Ping timeout: 264 seconds]
yakko has quit [Remote host closed the connection]
<banisterfiend`>
yeah..i dont really need fibers anyway, they were just a bit cuter
vlad_starkov has joined #ruby
flype has joined #ruby
<Spooner>
I mainly found them useful for doing long tasks, such as preloading assets, interlaced within the Gosu Window#update call, without the pain of using Threads and synchronisation.
red-panda has joined #ruby
<banisterfiend`>
Spooner: how does it help there
mockra has quit [Ping timeout: 252 seconds]
<Spooner>
Well, if I do it all at once, then it takes, say 2s, and gives 0FPS lockup. By putting it in a fiber, I can call the fiber until a time-frame has passed (say 20ms).
ananthakumaran has joined #ruby
<catphish>
is it possible to set default behaviour for string#encode?
<Spooner>
However, that use-case could be managed just as well with a big queue of procs, but it would be more ugly.
mobilegamelabs has joined #ruby
<Spooner>
It also is guaranteed to work with non-thread-safe libraries, like Gosu :)
<hoelzro>
catphish: what kind of default behavior?
<banisterfiend`>
Spooner: so u mean the main loop of the game is resuming the fiber?
<Spooner>
banisterfiend` : Yeah.
<banisterfiend`>
Spooner: why not just use lazy loading for assets instead
<banisterfiend`>
rather than a weird staggering
<banisterfiend`>
it doesnt' seem like a normal use case for a fiber
<Spooner>
BEcause if you do that, you end up with pauses when somethign wants to make a death sound :)
<catphish>
hoelzro: i have a library that calls string.encode('UTF-8') a lot, and I want it to use :invalid => :replace by default
br4ndon has quit [Quit: Lorem ipsum dolor sit amet]
<Spooner>
banisterfiend`: Specifically, I have that fiber running in the menu too, rather than in-game. I want to preserve some FPS there, but I don't want it to lock up. IF they skip right into the game, then it defaults to either loading it when the level loads (which takes N seconds, like all the graphics) or when needed (like sounds)
moshef has quit [Ping timeout: 244 seconds]
<catphish>
looks like i can probably override the library methods instead
yxhuvud has quit [Ping timeout: 252 seconds]
bigkevmcd has quit [Quit: outta here]
br4ndon has joined #ruby
goganchic has joined #ruby
<Spooner>
banisterfiend` : I also used them for queing actions in-game. You'd have a queue of action fibers (like move from a to b at speed c, do this for n seconds, move to whereever). I'd just run the first one until it ended, then move to the second. Anyway, rather specific use-cases I'm talking about here :)
<Hanmac>
catphish i would call if from an global method ... like my_own_encode(str)
<banisterfiend`>
Spooner: cool, sounds lik eu're making good use of them anyawy
Rochefort has joined #ruby
<Hanmac>
Spooner so are Fibers interesting when you does not have the control over the main loop ?
<Spooner>
At least for me, they don't acheive anything I couldn't do in another fashion, but they do make it more simply. Like Threads really - nothing in a thread couldn't be written without them, but it would be painful :)
tonini has joined #ruby
<Spooner>
Hanmac : In my case, they work where Threads wouldn't since I need to make non-thread-safe calls in them, which might happen when the main loop isn't active. Admittedly, I suppose I could mutex it when I am "active", but it just adds unnecessary complexity.
<ini>
anyone in here from coimbatore?
saschagehlich_ has joined #ruby
bluOxigen has joined #ruby
<Hanmac>
ok this could be interesting in my case because i bind something big as Ogre :P
mehlah has quit [Quit: Leaving...]
liluo has quit [Remote host closed the connection]
<Spooner>
Hanmac : Ogre? You mean you have implemented Shrek?
<banisterfiend`>
Spooner: in my situatino i had to use fibers in order for things to execute in the right order, since i need to get pry to read a line of input, then do its little repl thingy, then read another line of input, and so on https://gist.github.com/fd345efdabcb63255014
<Spooner>
Hanmac : Ah, I'm happy with Gosu in 2D (and maybe some bespoke 3D in Opengl when I can be bothered :D).
<Hanmac>
hm yeah gosu is fine, but i dont like the swig part ...
<banisterfiend`>
Hanmac: do you use Mon_Ouie's ray library instead?
<Hanmac>
hm i tryed it ... but i dont understand it yet
<Spooner>
What precisely is wrong with SWIG? I have only hand-bound libraries, so I haven't encountered difficulties.
abra has joined #ruby
<banisterfiend`>
Hanmac: the problem with all Mon_Ouie's software is that even though it's awesome, he only writes the documentation in french
<banisterfiend`>
and archaic french too, so google translate has trouble with it
ephemerian has joined #ruby
monkegjinni has joined #ruby
<Hanmac>
Spooner: maybe i have something like this: child = window.getChild(name), what did you expect when you call it again? on my bindings the child is the same ruby object
<Spooner>
banisterfiend` : I'm not entirely sure how your example relates to fibers.
<Spooner>
Oh, I see. That would be pretty dumb - SWIG would give you the same C object, wrapped in a different Ruby object wrapper?
<banisterfiend`>
Spooner: everytime an `input << blah` line is encountered the fiber yields
<Hanmac>
excact ... when i write my bindings from hand i can add more *magic*
<banisterfiend`>
Spooner: and that line is immediately executed by pry
<banisterfiend`>
Spooner: then when the next line is wanted, the fiber is resumed again
<Spooner>
Oh, I think I see, yes.
<Spooner>
Hanmac : I didn't realise that, but Gosu doesn't really have any objects that you access like that. Still, it is a tiny library compared to most things, so I can't see any reason not to bind it manually.
<Spooner>
Hanmac : Maybe someone should write their own Ruby bindings for C++/Gosu then :)
<Hanmac>
i tryed it :D
<Hanmac>
but i paused that project until gosu implments the new glfw lib
<Spooner>
I think 0.8 and glfw will appear to signal the next ice age :)
<Hanmac>
you mean this year ? D
<Spooner>
Good point!
williamherry has quit [Remote host closed the connection]
<banisterfiend`>
Hanmac: what does 'hanmac' mean
sendoushi has joined #ruby
<Hanmac>
first three characters of first name + first three characters of surname ... is was an suggestion from suse long time ago
<Spooner>
Hank Macbeth?
<Hanmac>
yeah somethink like that :P
<banisterfiend`>
Spooner: not germanic enough
chussenot has quit [Quit: chussenot]
<aTastyCookie>
Hans
abra has quit [Ping timeout: 276 seconds]
Criztian has quit [Remote host closed the connection]
cantonic has joined #ruby
Speed has joined #ruby
Speed has quit [Changing host]
Speed has joined #ruby
vitoravelino`afk is now known as vitoravelino
lkba has quit [Quit: Bye]
arietis has joined #ruby
Guest91275 has joined #ruby
<Hanmac>
Spooner when the C++lib allows it then i try to add a freature that the c++ object force the ruby object to stay alive :P (its protected from the GC as long the c++ lives)
<Spooner>
Yes, you just attach it as a structure on the Ruby object.
<Hanmac>
i do it backwards .. i add the ruby object in a stucture to the c++ object :P
<Hanmac>
so when the c++ object dies, it deletes the stucture and this removes the object from my protection hash
<workmad3>
ah, good old RIAA principles in c++ :)
<Spooner>
That makes more sense so ou can pass out the object. You don't need to do that though; just have to use the mark method.
<Spooner>
*mark function.
<Spooner>
Which is a lot simpler.
<Hanmac>
i didnt manage the mark method yet :(
sgronblom has quit [Ping timeout: 272 seconds]
<Spooner>
You bind a free function, don't you? When you attach the C++ structure to your Ruby object?
<Hanmac>
no, because the c++ structure may be deleted without that ruby notic it ... (and then i get an double deletion)
<Spooner>
But you won't, since the C++ structure keeps the Ruby object alive via the mark function.
sgronblom has joined #ruby
<Hanmac>
hmmmm can you make a sample with using mark?
<Spooner>
Admittedly, I haven't been working on C extensiosn very long, but I'm pretty sure that is correct.
fermion has joined #ruby
mpereira has quit [Ping timeout: 272 seconds]
mockra has quit [Ping timeout: 245 seconds]
elhu has joined #ruby
<Hanmac>
hm i think the mark stuff would not work for me directly ... but nice idea
flype has quit [Quit: Computer has gone to sleep.]
<Spooner>
Well, that is for owning other Ruby objects, not the bound object. I'm sure that Data_Make_Struct binds the C structure to the Ruby object it creates already though.
gokul has quit [Quit: Leaving]
mneorr1 has quit [Quit: Leaving.]
<Spooner>
But you could use it when, for example, you have a container class that needs to keep all the contents objects alive (by marking).
rippa has joined #ruby
<Spooner>
Where those contents objects are referenced only in the underlying C, of course, not between the Ruby wrappers directly.
mneorr has joined #ruby
<Mon_Ouie>
You should never override new
<Mon_Ouie>
Define the allocator and let ruby take care of the rest
<Spooner>
Define the allocator?
<Hanmac>
in one of my bindings i override new but only because it does not work better ... :(
EPIK has joined #ruby
<Mon_Ouie>
rb_define_alloc_func
<hoelzro>
Mon_Ouie: that's just the malloc abstraction, right?
gregorg has joined #ruby
<Mon_Ouie>
What do you mean?
<Mon_Ouie>
It allows to allocate objects without having to call initialize
<Spooner>
Mon_Ouie : Ah, thanks. It wasn't telling me to do it that way in the tutorials I was reading.
<Mon_Ouie>
Which is required if you want to implement #initialize_copy and friends
goganchic has quit [Quit: leaving]
aTastyCookie has left #ruby [#ruby]
Markvilla has quit [Quit: Markvilla]
red-panda has quit [Remote host closed the connection]
nfk has joined #ruby
<nfk>
i forgot, what were my options when it comes to opengl (es2?) with ruby?
Juul has joined #ruby
<nfk>
ruby-opengl seems kinda dead
<Spooner>
"opengl" is its 1.9 successor.
<Spooner>
It works fine.
<Hanmac>
allocate methods are not so good when you need to create the object with some kind of Manager ...
<nfk>
so it's built in?
<Hanmac>
nfk no but its another gem
<Spooner>
Built in? No, the "opengl" gem is the 1.9 version of "ruby-opengl",.
<nfk>
i see
<nfk>
ERROR: Could not find a valid gem 'opengl' (>= 0) in any repository
<Spooner>
gem install opengl --pre
<nfk>
hmm...
<Spooner>
I've been using it and it seems to work fine though.
<nfk>
is it expected that gem is of version 1.8.24?
<nfk>
gem as in gem itself
<Spooner>
No, it is 0.8.0.pre1
<nfk>
not the package
nedbat has joined #ruby
<nfk>
Spooner, anyway, --pre did the trick
<nfk>
thanks
<Spooner>
Gem is at 1.8.24, yes
<workmad3>
nfk: sounds about right
<nfk>
btw, where do i find documentation for opengl? google returns only ruby-opengl
<Spooner>
The API is identical.
<nfk>
cool
<Spooner>
It is just a fork for 1.9
<nfk>
so still no real opengl 3.0?
<Spooner>
Because the ruby-opengl dev went to the moon.
<Spooner>
Nope, not unless you want to do it yourself.
<nfk>
well, i guess that's still better than nothing
<Spooner>
I thought you were after es 2.0 though :)
<nfk>
well, 3.0 would be fine
<Spooner>
I've only used it up to regular 2.0, since I want any toaster to run my code.
<nfk>
and 4.0 just peachy but the stuff i need is so basic es2 should do the trick too
<workmad3>
I should get back into opengl coding at some point
<workmad3>
haven't done any for years
vlad_starkov has quit [Remote host closed the connection]
np_complete has joined #ruby
vlad_starkov has joined #ruby
tk__ has joined #ruby
jrajav has joined #ruby
Jacob_ has joined #ruby
Jacob_ is now known as ecksit
<np_complete>
hey, I do "<<" to a string inside aloop, but it wont hold what I pass when the loop finishes. the var is defined outside the loop
banisterfiend has joined #ruby
<Spooner>
I'm making a C extension, so I'm using the opengl gem to develop, then I have it linked to opengl/glee for when I re-implement each bit in C.
<Spooner>
np_complete : You need to give an example of code (possibly in a pastie).
cantonic has quit [Quit: cantonic]
<Spooner>
Sounds like it should work though :)
Axsuul has quit [Ping timeout: 255 seconds]
ecksit has quit [Client Quit]
chussenot has joined #ruby
Jacob_ has joined #ruby
Jacob_ is now known as ecksit
peterhellberg has joined #ruby
<Hanmac>
i dont use opengl directly ... i use other libs for that ... (gosu or ogre for the Engine, and CEGUI for the GUI)
banisterfiend` has quit [Ping timeout: 252 seconds]
<workmad3>
Hanmac: opengl is fun though :D
charlies_ has joined #ruby
geekbri has joined #ruby
<Spooner>
Right, I'm building some extension and high level stuff onto Gosu, so I sort of need to use OpenGL directly, at least in the library, so I don't have to use it in my actual code :)
nikeita has joined #ruby
<workmad3>
that said, I was starting to move away onto more physics simulations when I stopped really playing with opengl and graphics
<banisterfiend>
i wanna do some opengl for a data visualization app i'm writing for ipad
Axsuul has joined #ruby
vlad_starkov has quit [Ping timeout: 246 seconds]
charlies_ is now known as charliesome_
geekbri has quit [Remote host closed the connection]
cousine has quit [Remote host closed the connection]
<workmad3>
banisterfiend: funky 3d visualisations? :)
<Spooner>
Mon_Ouie : Ha, it seemed that re-writing .new was what you did in 1.6. I have not been so out of date... Ha!
<np_complete>
Spooner: floor_init wont hold its value after the loop
<banisterfiend>
workmad3: i think so..i have to learn a bit about data visualization before i start it, might not have to be too fancy so long as it's easy to navigate
<Spooner>
np_complete : Rogue-alike?
vlad_starkov has joined #ruby
<np_complete>
yes
<Spooner>
Well, I would suggest the most likely think is that line 28 is not matching.
geekbri has joined #ruby
<workmad3>
np_complete: floor_init is inside the each_line block
<workmad3>
np_complete: so it'll be reset on each loop through
<Hanmac>
workmad do you found some good physics engine? (i heard that bullet is nice)
indian has quit [Ping timeout: 255 seconds]
<Spooner>
Ha, yes, it is.
<np_complete>
ouch! I make a mess with so much indentation!
<workmad3>
Hanmac: I was playing around with my own physics resolvers rather than an engine :)
jeff_sebring has quit [Quit: Leaving]
<workmad3>
Hanmac: and this is going back a few years now... the only one really in use and open source at the time was havok iirc
Axsuul has quit [Ping timeout: 250 seconds]
`brendan has joined #ruby
<workmad3>
Hanmac: I do have the 3 books on engines and game physics by eberly too... should crack them open at some point and see about applying some of it to ruby :)
<banisterfiend>
workmad3: do u do any non-ruby dev?
jstew has joined #ruby
<banisterfiend>
ios or android?
<banisterfiend>
or has rails taken over ur brain? :P
<workmad3>
banisterfiend: I did... but not at the moment
<banisterfiend>
ah ok
<workmad3>
rails has mostly taken over my brain :)
<banisterfiend>
rubymotion might be a good way to escape
<banisterfiend>
assumingu want to
<Spooner>
I needed to do arbitrary collisions with a randomly generated texture, so I thought it would be easier to just use a signed distance field, rather than chipmunk, but I'm beginning to regret that decision.
tommyvyo has joined #ruby
<banisterfiend>
Spooner: isn't texplay fast enough 4 u
<Spooner>
Well, Ashton is massively faster than TexPlay and generating an equivalent SDF in Texplay would take an hour :)
mpereira has joined #ruby
lorandi has joined #ruby
<Spooner>
Well, several minutes, anyway (compared to 20ms in GLSL :D).
<banisterfiend>
Spooner: what kind of collisions?
<banisterfiend>
Spooner: i dont think ashton would be faster than texplay for get_pixel
<banisterfiend>
it's O(1) in texplay
beakerman has joined #ruby
<Spooner>
Actually, it is significantly faster.
<banisterfiend>
for get_pixel?
<Spooner>
But that is because it is not doing exactly the sdame thing.
<banisterfiend>
we're talking about get_pixel *after* the image is already cached i hope
nikeita has quit [Quit: sleep]
<banisterfiend>
it's silly to include caching times into your benchmarks
<Spooner>
Remember that pushing out floats is not fast in Ruby and the method is so simple that that difference is significant.
chussenot has quit [Quit: chussenot]
<banisterfiend>
float arithmetic is slow
<Spooner>
rb_float_new() is slow :)
<banisterfiend>
why?
<banisterfiend>
i guess it's allocating memory on the heap
<Spooner>
It is slower than INT2NUM(n), anyway, since that is just n * 2 + 1 (or whatever it is).
<banisterfiend>
Yeah, whereas a float is proper ruby object
moshef has joined #ruby
moshef has quit [Client Quit]
<Spooner>
But bear in mind that generating Gosu::Color object is 2x faster than generating 4 floats.
`brendan is now known as brendan`
<Spooner>
*4 floats in an array.
arkiver has quit [Ping timeout: 246 seconds]
nwest has joined #ruby
<Spooner>
But the way I do that is pass a 0xffffffff to Color.new, which means I don't need an array or any floats or anything. You'll notice that my Texure#draw is massively slower than Gosu::Image's one so I'm not always winning in C :)
tonni has quit [Ping timeout: 272 seconds]
arkiver has joined #ruby
<Spooner>
I think that is because I have to mess around with Window#gl blocks though (should we take this discussion to #gosu? :D).
<banisterfiend>
withnale: if bing = asset_element.attributes['file']; @assets[asset_name].file = bing; end
cantonic has joined #ruby
bluenemo_ has quit [Remote host closed the connection]
GlenK has joined #ruby
locriani has joined #ruby
locriani has quit [Changing host]
locriani has joined #ruby
tonni has quit [Remote host closed the connection]
cantonic has quit [Remote host closed the connection]
cantonic has joined #ruby
macer1 has joined #ruby
tommyvyo has joined #ruby
mneorr has joined #ruby
Criztian has joined #ruby
cousine has joined #ruby
<shevy>
Ruby 1.9 no longer allows the implicit conversion of Exception to String.
<shevy>
anyone knows why?
justinseiter has joined #ruby
<banisterfiend>
shevy: what do u mean
justinseiter has left #ruby [#ruby]
np_complete has quit [Quit: Leaving]
wataken44 has quit [Remote host closed the connection]
bullicon has quit [Quit: Computer has gone to sleep.]
timonv has quit [Remote host closed the connection]
<shevy>
banisterfiend there is an example
<shevy>
e = Exception.new("not really an exception")
<shevy>
msg = "Error: " + e # String concatenation with an Exception
<shevy>
this works in 1.8 but not in 1.9
<zealinux>
How to read the core rails3 source?
<banisterfiend>
zealinux: go to the github page
wataken44 has joined #ruby
<Hanmac>
Spooner: PS: i like to prefer to write my bindings in c++ ... so i can use namespaces to group the code
<shevy>
zealinux you find the source and read it with your eyes? :) "gem install rails", then go into cache/ subdirectory and extract the .gem archive, then enter that directory and start exploring
<Spooner>
Hanmac : It does seem sensible. Have you looked at Rice, by the way?
baphled has quit [Ping timeout: 246 seconds]
centipedefarmer has joined #ruby
Juul has joined #ruby
<Hanmac>
Spooner i do ... but there are thinks in rice i do not like ...
enroxorz has joined #ruby
enroxorz has quit [Changing host]
enroxorz has joined #ruby
<Hanmac>
shevy try this: msg = "Error: #{e}"
<Spooner>
Doing it manually does seem sensible on small projects though. Not sure I'd want to maintain a large project though, if there was even a poorly implemented automated alternative.
carloslopes has joined #ruby
lkba has joined #ruby
<shevy>
Hanmac do you know why this behaviour was changed in 1.9?
<JonnieCache>
zealinux: there is a branch for each version
runa has left #ruby [#ruby]
<workmad3>
yeah, and shevy's suggestion won't give you much code, because there's very little code in the 'rails' gem anymore (it's all in separate gems like railties, actioncontroller, etc)
<Spooner>
cd ..
<Spooner>
oops :$
<workmad3>
Spooner: no, keep going, this is your terminal... now use this command line prompt to log into your bank...
<workmad3>
bank details:
* workmad3
is the worst phisher in the world
vvgomes has quit [Ping timeout: 244 seconds]
<Spooner>
You nearly got me there, workmad3
<Spooner>
Good job I got enough sleep last night :D
<workmad3>
aww, you're just saying that to make me feel better, aren't you :P
locriani has quit [Remote host closed the connection]
<Spooner>
workmad3 : was marginally more convincing than that.
<workmad3>
:D
<Spooner>
Marginally.
verto|off is now known as verto
bluOxigen has quit [Ping timeout: 256 seconds]
greyEAX has joined #ruby
kpshek has joined #ruby
<workmad3>
Spooner: welcome to your banking IRC channel. Please enter your bank account details and answers to any security questions you are aware of in order to continue
hynkle has joined #ruby
<Spooner>
You've missed your opportunity there.
<JonnieCache>
thats #bitcoin-otc youre thinking of
<JonnieCache>
where they actually do transactions in the channel
jonathanwallace has joined #ruby
<JonnieCache>
its a bit more secure than that though
<workmad3>
heh
<nikeita>
it is possible in ruby to make something like this?
<kalleth>
i don't _actually_ have camelCased code with factories ;)
Edijus has left #ruby [#ruby]
sendoushi has quit [Remote host closed the connection]
nwest has quit [Read error: Connection reset by peer]
<Hanmac>
Mon_Ouie yeah, but he could also do ::Klass or something
nwest has joined #ruby
<Spooner>
nikeita : If you want something closer to Python's with, without editing the object's #initialize, you can do CommanderBaconWing.new.tap { |f| f.cheese }
<y2k>
hello everyone!
monkegjinni has quit [Read error: Connection reset by peer]
monkegjinni has joined #ruby
<otters>
hi
ecksit has quit [Quit: Laters.]
centipedefarmer has quit [Quit: This computer has gone to sleep]
GeekOnCoffee has quit [Read error: Connection reset by peer]
enroxorz has joined #ruby
GeekOnCoffee has joined #ruby
enroxorz has quit [Changing host]
enroxorz has joined #ruby
<nikeita>
thanks Spooner and all
nikeita has quit [Quit: sleep]
kpshek has quit [Ping timeout: 252 seconds]
harcher has joined #ruby
harcher has left #ruby [#ruby]
virunga has joined #ruby
kpshek has joined #ruby
bgupta has quit [Read error: Operation timed out]
stopbit has joined #ruby
bluenemo has quit [Remote host closed the connection]
strife25 has quit [Quit: Computer has gone to sleep.]
xclite has joined #ruby
iamjarvo has joined #ruby
zealinux has joined #ruby
<shevy>
otter!!!
<shevy>
come here you cuddly otter!
<shevy>
who in his mind names a class CommanderBaconWing
<banisterfiend>
Mon_Ouie: can u fix a bug 4 me pls
<chiel>
shevy: sounds like something why would do.
<chiel>
:P
bowlowni has joined #ruby
_iori_ has quit [Remote host closed the connection]
<shevy>
yeah
<shevy>
Spooner must be one of his famous students
<Mon_Ouie>
banisterfiend: Is that like fixing a cat?
<banisterfiend>
Mon_Ouie: yes except i want u to wear a french maid's outfit and pretend u cant speak english
<Hanmac>
shevy maybe its a T-Fighter made of Bacon :P
<banisterfiend>
Mon_Ouie: no, i want u to patch 'debugger' so it doesnt freak out when i use fibers
greenarrow has quit [Ping timeout: 244 seconds]
<banisterfiend>
it's too stupid that it's doing that
bluenemo has joined #ruby
bluenemo has quit [Changing host]
bluenemo has joined #ruby
mrwalker has joined #ruby
<Mon_Ouie>
I probably can't
<shevy>
everything becomes too complex
* Hanmac
thinks that "fixing a cat" could be very worse :P
sendoushi has joined #ruby
Ionic` has joined #ruby
devdazed has quit [Quit: Computer has gone to sleep.]
<Mon_Ouie>
Life is too complex, we should get rid of some fetaures to make it work better
<shevy>
life is extremely simple. it can be described as a chain of 4 different nucleotides
devdazed has joined #ruby
<banisterfiend>
Mon_Ouie: i agree, we should start by deprecating french
Tomasso has joined #ruby
<banisterfiend>
make sure everyone in the world just speaks amurcan
guyvdb_ has joined #ruby
guyvdb_ has quit [Remote host closed the connection]
<bnagy>
french is the language of diplomacy
dhruvasagar has quit [Ping timeout: 246 seconds]
<shevy>
I thought it is the language of love
<bnagy>
plus it is awesome to be able to write poetry when every verb has a for that sounds like 'ay'
<bnagy>
*form
sevvie has joined #ruby
dhruvasagar has joined #ruby
<Mon_Ouie>
(There are formal rules that actually forbid from making words of the same nature rhyme in French.)
strife25 has joined #ruby
<rking>
Mon_Ouie: Wait what?
<Mon_Ouie>
You can't make verb rhyme with another verb, you must find a noun or an adjective or anything else
joshman_ has joined #ruby
<Mon_Ouie>
(Not that *every* famous poet followed those rules)
<bnagy>
I was about to say .. :)
<rking>
Mon_Ouie: Is it an arbitrary constraint to make the task more challenging?
<Mon_Ouie>
To force variety I believe
<bnagy>
I think it just looks lame if you are like 'j'aime jouer, ma souer puer, ou j'rai...'
iamlacroix has quit [Remote host closed the connection]
Russell^^ has quit [Quit: Russell^^]
strife25 has joined #ruby
dekroning has joined #ruby
<dekroning>
hi all
Criztian has quit [Remote host closed the connection]
xorgnak has quit [Remote host closed the connection]
<dekroning>
I'm trying to write a game, where one player challenges another player. Now I have a spec saying that challenge = player.challenge(player) however i'm wondering how to "test" that my code actually challenges this other player?
<hoelzro>
dekroning: check the resulting challenge object?
<dekroning>
since there are multiple ways to test it
paoloooo has joined #ruby
abdulkarim has joined #ruby
<dekroning>
hoelzro: test if that challenge object as my "opponent" player inside it ?
cloud|windoze has joined #ruby
cloud|windoze has quit [Client Quit]
<dekroning>
hoelzro: or should I "test" for some message expectation on the challenge object ?
mikepack has joined #ruby
strife25 has quit [Client Quit]
icambridge has joined #ruby
Ionic` is now known as Ionic
strife25 has joined #ruby
<hoelzro>
dekroning: it depends on how your application will be using your challegnge object
<hoelzro>
uh, can't spell.
<hoelzro>
*ugh
<dekroning>
hoelzro: np I had the same with that same word hehehe :)
paoloooo has quit [Client Quit]
<hoelzro>
yeah, but English is my native language, so I have no excuse =)
paoloooo has joined #ruby
Ionic is now known as Ionic`
billiam has joined #ruby
<dekroning>
hoelzro: well, actually I want to have this domain concept of "challenge" object... however i'm currently specing out the Player object, and for this reason I want to some how mock/stub out the Challenge object behavior, so that I can continue working on the Player behavior
julio_ has joined #ruby
<hoelzro>
I see
<dekroning>
hope that makes a bit of sense
ananthakumaran has quit [Quit: Leaving.]
<hoelzro>
dekroning: so you want to test Player's behavior with mock Challenges?
<dekroning>
so then I was thining, if I want to mock out the challenge object, then in order to test it. I must inject it into the Player#challenge() method
mars__ has joined #ruby
xorgnak has joined #ruby
vish has joined #ruby
<dekroning>
hoelzro: well I want players to be able to challenge other players with the #challenge method. I want this method to create an Challenge object
<hoelzro>
dekroning: why do you need to mock the challenge object, though?
<dekroning>
hoelzro: because if I want to implement my #challenge method, I need to do something like this: def challenge(opponent); Challenge.new(self, opponent); end
asobrasil has quit [Ping timeout: 244 seconds]
<dekroning>
hoelzro: but then I need to create the Challenge object first before i'm able to continue. I was hoping I could find someway to continue without having to implement this Challenge object, and be able to test my Player object in isolation
<dekroning>
so something like: def challenge(challenge_service, opponent); challenge_service.new(self, opponent); end
shashin has quit [Ping timeout: 245 seconds]
<dekroning>
so then I would be able to mock the challenge_service object, and test against that mocked object in my Player tests
<dekroning>
but then I got all confused, and started wondering if this is good way to approach it :)
<hoelzro>
I'm still not sure why you can't test player with live challenge objects
xorgnak has quit [Remote host closed the connection]
sailias has quit [Quit: Leaving.]
<dekroning>
hoelzro: because couple of reasons, I'm trying to get loose coupling by not having to call Challenge object directly in my Player objects
bairui has quit [Ping timeout: 255 seconds]
zealinux has left #ruby ["ERC Version 5.3 (IRC client for Emacs)"]
<dekroning>
hoelzro: because then I would need to first start creating the Challenge class before I can continue, which in turn could have more classes it needs, thus I have to go towards the lowest class before i'm able to finish my Player object
gmci has quit [Ping timeout: 252 seconds]
jorge has joined #ruby
<dekroning>
does that make sense?
kevinbond has joined #ruby
<hoelzro>
dekroning: well, you could just create a skeleton version of Challenge, and use it from Player
<dekroning>
if not i'm might be getting it all wrong as well :)
TPFC-SYSTEM has quit [Quit: TPFC-SYSTEM]
<hoelzro>
and then fill it out to make your tests pass
SQLStud has joined #ruby
asobrasil has joined #ruby
<dekroning>
for some reason it feels incorrect to create the Challenge object, because I feel as if I should fake that object, in order to focus on my Player object, and gradually (by mocking/stubbing) discover how the actually Challenge object should look like, after i'm done with my first Player behavior
gmci has joined #ruby
<dekroning>
anyone else with TDD experience that could shed some light on his/her perspective as well?
flype has quit [Quit: Computer has gone to sleep.]
strnx has quit [Excess Flood]
<dekroning>
hoelzro: when you write your code TDD style, you just write the minimal needed in descendant objects?
<dekroning>
hoelzro: skeleton's lik eyou said
<hoelzro>
pretty much
jrajav has quit [Quit: The best darkness is strange and surprising]
<hoelzro>
just to get method calls to not fail
<dekroning>
hoelzro: you use any mocking/stubbing at all?
<hoelzro>
I tend to avoid it
<dekroning>
ok
andrewhl has joined #ruby
<hoelzro>
but that's just me
cj3kim has joined #ruby
<dekroning>
out of curriosity, why? (i'm trying to learn TDD/BDD but constatnly get confused ;-))
d3vic3 has quit [Quit: leaving]
julio_ has quit [Ping timeout: 248 seconds]
berserkr has quit [Quit: Leaving.]
<hoelzro>
dekroning: I feel that the more I mock, the less likely I am to catch real issues
<hoelzro>
because mock objects might not behave the same way as the real thing
<hoelzro>
granted, some things you *have* to mock
cj3kim has quit [Client Quit]
<hoelzro>
production DB access and the linke
<hoelzro>
*like
verto is now known as verto|off
Araxia has joined #ruby
awarner has joined #ruby
SQLStud has quit [Quit: Leaving]
SQLStud has joined #ruby
kevinbond has quit [Read error: Connection reset by peer]
kevinbond has joined #ruby
<Muz>
You're just not mocking enough behaviour and covering enough with your tests.
<Muz>
Moc /everything/ ;)
macer1 has quit [Ping timeout: 264 seconds]
<workmad3>
hoelzro: two things: 1) don't mock what you're testing, 2) make sure you write tests for integrating bits together, not just unit tests
adeponte has quit [Remote host closed the connection]
Araxia has quit [Quit: Araxia]
wallerdev has joined #ruby
iori has joined #ruby
carloslopes has quit [Ping timeout: 246 seconds]
chson has joined #ruby
tk__ has quit [Quit: ばいばい]
<hoelzro>
workmad3: integration tests are what I tend to focus on
<hoelzro>
which is probably why I don't use mocks much =)
jrajav has joined #ruby
<workmad3>
hoelzro: :)
<workmad3>
hoelzro: I tend to mostly end up with acceptance tests and integration tests, with some unit tests of bits that are more complicated
cjlicata has quit [Remote host closed the connection]
<otters>
my irb isn't printing out error messages until I quit it
<otters>
then it prints them all out at once
<otters>
what gives?
jorge has quit [Remote host closed the connection]
internet_user has joined #ruby
carlyle has joined #ruby
<hoelzro>
otters: you're not piping IRB through anything, are you?
<otters>
no
<otters>
and it suddenly started working again...
<hoelzro>
workmad3: yeah, I tend to do the same, with unit tests for things that shouldn't change (much)
<otters>
heh
<banisterfiend>
otters: irb is for noobs anyway, u should be using a repl with real power
<otters>
like what
strife25 has quit [Quit: Computer has gone to sleep.]
<banisterfiend>
otters: a heart breaking work of staggering genius, of course: http://pry.github.com
shevy has quit [Ping timeout: 264 seconds]
jprovazn is now known as jprovazn_away
<otters>
wow
<hoelzro>
banisterfiend: *so* modest =P
kevinbond has quit [Quit: kevinbond]
<banisterfiend>
hehehe
<otters>
it has a nice logo
<otters>
who made it
<banisterfiend>
otters: a fren
davidcelis has quit [Quit: K-Lined.]
ckrailo has joined #ruby
<otters>
guess I'm sold
nateberkopec has joined #ruby
<otters>
oh and it syntax highlights stuff you wrote
flype has joined #ruby
<otters>
syntax highlighting isn't live though
<otters>
what a piece of crap
<banisterfiend>
otters: it is live with pry-coolline
strife25 has joined #ruby
<banisterfiend>
otters: it has a bunch of plugins
<hoelzro>
otters: why don't you try implementing live syntax highlighting? =P
<banisterfiend>
hoelzro: it's already implemented ;) thanks to Mon_Ouie
<otters>
what envvar does it use to figure out my editor?
<hoelzro>
I'm just saying it's not *that* easy
<banisterfiend>
yeah it wasn't easy, Mon_Ouie had to write an entire replacement for Readline
<hoelzro>
you'd need to
macer1 has joined #ruby
<otters>
banisterfiend: ^
<banisterfiend>
otters: either $EDITOR or you can set Pry.config.editor = "emacsclient" in your ~/.pryrc
<hoelzro>
and then .inputrc probably doesn't work
<rking>
hoelzro: It doesn't. And it has no vi keys. =(
<hoelzro>
and some keybindings might not work
<hoelzro>
re-implementing readline *sucks*
<banisterfiend>
hoelzro: all the important emacs ones work
<banisterfiend>
so, the default Readline keybindings work
bradhe has quit [Remote host closed the connection]
blazes816 has joined #ruby
<Mon_Ouie>
It's not meant to behave exactly like Readline anyway
markizko___1 has joined #ruby
<Mon_Ouie>
And it does provide ways of adding keybindings as you need
bluenemo_ has joined #ruby
bluenemo_ has quit [Changing host]
bluenemo_ has joined #ruby
<hoelzro>
that's handy
<enroxorz>
hey guys, is anyone here relatively good with Sinatra?
<rking>
enroxorz: Just ask.
niklasb has joined #ruby
iori has quit [Remote host closed the connection]
bluenemo_ has quit [Read error: Connection reset by peer]
<enroxorz>
How can I access a HTML element from within the code block in Sinatra? basically, I have a status checker that checks to see if a server is running a task. if it does, nothing shows. If not, a red message saying Job Running shows. Currently it works with jquery in all browsers except pre IE-9, and the majority of my users are on IE8
<Hanmac>
enroxorz why didnt you ask in #sinatra?
<enroxorz>
Hanmac, good point. thanks
<Spooner>
Everything works everywhere except on IE < 9 :)
rudle has quit [Ping timeout: 260 seconds]
<enroxorz>
I hate IE8
luckyruby has quit [Remote host closed the connection]
<enroxorz>
I have spent 2 hours on this non issue
fearoffish has joined #ruby
<markizko___1>
hi, I've hit a weird bug with ruby:
<markizko___1>
Quick google gave one tweet on that from a guy who had the same bug on mac (I'm on mac too) and some automated build system report for 2.0. I can easily reproduce the bug on my machine, but I can't minimize it to testcase yet. I wonder if any of the core team could jump in with some instructions to pinpoint the bug source.
<Hanmac>
shevy dont forget the sister method: respond_to_missing
<banisterfiend>
otters: you're meant to be telling me how awesome it is, etc
<otters>
banisterfiend: sorry, I got into a little disagreement with GNU screen
aganov has quit [Quit: aganov]
otters has quit [Quit: WeeChat 0.3.8]
pdtpatrick has joined #ruby
<ekaleido>
my company just listed multiple openings for cobol programmers
<banisterfiend>
:P
ryh has joined #ruby
<ekaleido>
i feel like imstanding on a raft in the ocean and the water is up to my forehead
markizko___1 has left #ruby [#ruby]
a_a_g1 has joined #ruby
<rking>
Hanmac: Interesting that they'd go so negative on their own campaign.
a_a_g has quit [Ping timeout: 246 seconds]
<Hanmac>
rking its because even Mircosoft wants IE6 to die :P
lorandi has quit [Quit: Leaving]
<shevy>
hehe
cek has joined #ruby
<Hanmac>
and only because that you need to buy an newer windows to get an newer Browser :P
<Muz>
Not true.
lorandi has joined #ruby
strnx has joined #ruby
<Muz>
Windows XP has had IE8 in Windows Update for months now.
MasterIdler has joined #ruby
venkatk_ has quit [Quit: This computer has gone to sleep]
<cek>
i'm distributing python script with my gem, how do I find it's path after install? It's in binaries.
otters has joined #ruby
<rking>
cek: From within what context? Are you inside Ruby at this point?
<cek>
yes, inside ruby code
<rking>
cek: Then you can do it relative to __FILE__
johnlcox has joined #ruby
<cek>
file can change, it could be a test case
<shevy>
hmm ok, that was easy via method_missing()
<rking>
Then set a global in the normal case, and override it in your test helper.rb
<Mon_Ouie>
That it's in a test case doesn't prevent you from being able to use __FILE__
headius has joined #ruby
wvms has quit [Quit: wvms]
<rking>
Yeah, actually. If you set it from lib/fnoo.rb, that __FILE__ will always be fnoo.rb, even if it's run from a test case or wherever else.
strife25 has quit [Quit: Computer has gone to sleep.]
sailias has joined #ruby
cantbecool has joined #ruby
<cek>
=> "(irb)"
johnlcox has quit [Client Quit]
<i0n>
does #{} always put things into a string?
<Hanmac>
i0n yeah because it uses the to_s method
maxmmurphy has quit [Quit: maxmmurphy]
blazes816 has joined #ruby
<Hanmac>
cek __FILE__ only works in file itself, not in irb directly
iori has joined #ruby
<bnagy>
eh?
bluenemo_ has joined #ruby
bluenemo_ has quit [Changing host]
bluenemo_ has joined #ruby
<bnagy>
oic different definitions of 'works
carlyle has quit [Ping timeout: 248 seconds]
<xclite>
well, what's the file in irc? haha
<xclite>
irb*
<dekroning>
i'm trying to create a game where two players can challenge each other, however i'm trying to approach this with TDD, on my first spec i'm trying to get a player to challenge another player, by creating a challenge. However I don't want to couple to Challenge object directly to my player objects, so i'm trying to seperate them with a challenge_manager object, however i'm not sure what would be a nice way to inject it. Into the player constructor, or durin
x77686d has joined #ruby
<rking>
dekroning: Look at it from the perspective of code that calls the stuff
Stalkr_ has joined #ruby
<rking>
dekroning: Like, what is it right now, a command-line client? A web thinger?
<dekroning>
rking: so that would be: challenger.challenge(challenge_manager, opponent) ?
<Hanmac>
xclite as i said irb directly cant say about file, you could try __FILE__ in ruby directly
jwmann has joined #ruby
<dekroning>
rking: at the moment, it's logic only. Not thinking about the delivery mechanisms yes (cli or web)
<rking>
dekroning: I'm never thrilled with classes named like ".*Manager". It's too abstract and too concrete at the same time.
x77686d has quit [Client Quit]
<shevy>
class Waiter
<Hanmac>
*Manager classes looks toomuch after c++
<dekroning>
rking: what would you call it perhaps? ChallengeController ?
carloslopes has joined #ruby
<dekroning>
rking: or just Challenge ?
<shevy>
class Dragonslayer
luckyruby has joined #ruby
johnlcox has joined #ruby
<Hanmac>
shevy: class Maid
<shevy>
hehe
mengu has quit [Remote host closed the connection]
<rking>
dekroning: Just sketching here, I'd maybe start with Game.new initator: player1, challenged: player2
<dekroning>
Hanmac: better options are welcome :-)
x77686d has joined #ruby
<xclite>
Hanmac I was agreeing
<xclite>
Hanmac more towards bnagy's "different definition of 'works'"
<dekroning>
rking: you would provide the Game constructor with a hash?
<rking>
dekroning: A "Game" is a thing that is concrete enough to be understandable, yet abstract enough to have value as a class.
nedbat_ is now known as nedbat
<rking>
dekroning: Yep, but that's because I assume I'll provide a hash to any method with more than one parameter (because Smalltalk's selectors were right all along)
<Hanmac>
dekroning Challange::Interface or something else?
<dekroning>
rking: intrestting thought :-) ive been thinking about this as well, but somehow never started using it
crankycoder has quit [Remote host closed the connection]
<dekroning>
Hanmac: ... intrestting :-)
<dekroning>
Hanmac: why not call it ChallengeInterface?
tayy has joined #ruby
tayy has quit [Remote host closed the connection]
crankycoder has joined #ruby
<dekroning>
Hanmac: also "Interface" make it sounds to me like it's more of an abstract thing, which someone will need to implement, like the ChallengeManager behaves_like_a ChallengeInterface
tayy has joined #ruby
carloslopes has quit [Client Quit]
<cek>
that's incorrect. here's the correct asnwer: Gem::Specification.find_by_name('gemname').bin_dir
crankycoder has quit [Remote host closed the connection]
carloslopes has joined #ruby
<rking>
dekroning: Keep it simple (both in terms of complexity of implementation and in terms of conceptual mindbendiness). All you're doing is starting a new game, so trying to pull the event of a "Challenge" into its own class probably won't have useful standalone meaning.
<dekroning>
rking: so everything in your code has just a single argument then right?
jhunter has quit [Ping timeout: 272 seconds]
crankycoder has joined #ruby
crankycoder has quit [Remote host closed the connection]
<Hanmac>
dekroning i thought that Challange is a class/module too so you could use it as a namespace ...
<dekroning>
rking: well i'm creating a Turnbased Game, so I would have a concept of challenges, which will take some time to get accpeted
<rking>
dekroning: Bad: A giant list of params, OK: A list of "named" params that are a hash, better: a single param, better still: no params, best: no code.
<Hanmac>
and i thought about the interface as some kind of Listener
cloud|droid has quit [Quit: Leaving]
<dekroning>
rking: and if some named params are a required you do this kind of validation checking in your constructor ?
jhunter has joined #ruby
<rking>
dekroning: I'd still consider those Game's, only ones in a different state than active games.
tayy has quit [Read error: Connection reset by peer]
fivetwentysix has quit [Quit: fivetwentysix]
Morkel has quit [Quit: Morkel]
<rking>
dekroning: Wait, what validation?
luckyruby has quit [Remote host closed the connection]
fivetwentysix has joined #ruby
<dekroning>
rking: required paramaters to a function, when using a hash as single argument
bgupta has joined #ruby
<dekroning>
rking: e.g. Game.new(initiator: player1) while Game.new would need also a challengee
<dekroning>
rking: ow btw, another thing, this would be a fighting game, in which you'll play a "Duel" ... so a challenge would later be converted into a duel, just to make things more complicater I hear you think hehehe :)
iori has quit [Remote host closed the connection]
Jay_Levitt has joined #ruby
syamajala has joined #ruby
syamajala has quit [Remote host closed the connection]
qwerxy has joined #ruby
syamajala has joined #ruby
Spooner_ has joined #ruby
peterhellberg has quit [Remote host closed the connection]
mahmoudimus has joined #ruby
Rochefort has quit [Remote host closed the connection]
benson has joined #ruby
tomb_ has quit [Quit: Computer has gone to sleep.]
Spooner has quit [Ping timeout: 272 seconds]
krusty_ar has quit [Read error: Connection reset by peer]
bglusman has joined #ruby
krusty_ar has joined #ruby
robotmay has quit [Remote host closed the connection]
kenichi has joined #ruby
qwerxy_ has joined #ruby
Spooner_ is now known as Spooner
JohnBat26 has quit [Read error: Operation timed out]
qwerxy has quit [Ping timeout: 244 seconds]
<enroxorz>
is divmod a core function in ruby?
<enroxorz>
if not, what do i have to require from standard lib?
<Spooner>
That works. I expect that "seconds" isn't a Numeric then.
minijupe has joined #ruby
<enroxorz>
hmm. let me try something. brb
bradhe has joined #ruby
kenichi has quit [Remote host closed the connection]
<shevy>
why can I not use load() or require() in mirb ?
fabrice31 has quit [Remote host closed the connection]
chclto has quit []
<Spooner>
incidentally, enroxorz, that won't format correctly. You probably want: "%2d:%2d:%2d" % [hh, mm, ss]
locriani has quit [Ping timeout: 255 seconds]
kenichi has joined #ruby
<Spooner>
Oops "%02d:%02d:%02d" % [hh, mm, ss]
<enroxorz>
chrimey, your right
kenichi has quit [Read error: Connection reset by peer]
kenichi has joined #ruby
kenichi has quit [Client Quit]
kenichi has joined #ruby
locriani has joined #ruby
locriani has quit [Changing host]
locriani has joined #ruby
Gab0 has joined #ruby
sncz has joined #ruby
gregorg has quit [Ping timeout: 250 seconds]
paoloooo has quit [Ping timeout: 245 seconds]
savage- has joined #ruby
ken_barber has joined #ruby
gregorg has joined #ruby
gregorg has quit [Changing host]
gregorg has joined #ruby
<enroxorz>
Now I have the oddest issue. basically in sinatra I have @counter += 1 (it is initialized, i tested that, and i tested just setting the number to a fixed number). When I run the web app it says NoMethodError - undefined method `+' for nil:NilClass
<Hanmac>
workmad3 i had some extensions that create so much error log that i need to pipe it into a file to read it
<workmad3>
GlenK: it's better for your soul if you work it out yourself ;)
<workmad3>
GlenK: as a hint though... did you try inlining it to see what happens?
SCommette has quit [Ping timeout: 246 seconds]
nedbat has quit [Disconnected by services]
laen_ has quit [Read error: Connection reset by peer]
asdhakjdlsad has quit [Quit: Page closed]
nedbat_ has joined #ruby
mengu has joined #ruby
<GlenK>
workmad3: yeah, it still works. which is why I'm confused.
<workmad3>
GlenK: hmm, interesting
<Bauer>
ok, so ruby still not working - gem command is not available, which package is it in?
beakerman has quit [Ping timeout: 240 seconds]
<Mon_Ouie>
Because you get a crazy long line when you don't split it up?
<bnagy>
that about all I can see
<workmad3>
GlenK: I think the problem they anticipated was it being interpreted as a block... but looking at it, that wouldn't happen there
<Hanmac>
Bauer on debianoid systems its in ruby-full
<GlenK>
k, well, thanks anyway.
bier has quit [Ping timeout: 272 seconds]
strife25 has joined #ruby
bier has joined #ruby
friskd has joined #ruby
<Bauer>
Hanmac: I am on centos, and doing yum search ruby|grep -v eruby looks likve I've got ruby installed :( yet no gem command (there is a ruby command however)
br4ndon has quit [Ping timeout: 244 seconds]
Eldariof-ru has joined #ruby
mneorr has quit [Quit: Leaving.]
<Hanmac>
Bauer did you intstall "ruby-devel ruby-docs ruby-ri ruby-irb ruby-rdoc" too?
<Bauer>
Hanmac: yes its already installed
emsilva has joined #ruby
br4ndon has joined #ruby
<GlenK>
gem comes in rubygems on fedora. seems like centos would be the same. unless it's an old as dirt centos install
binaryplease has joined #ruby
rutkla has joined #ruby
<bnagy>
centos is automatically old as dirt
<Hanmac>
Bauer whats your centos version?
<GlenK>
Bauer: and for future record: yum provides *bin/gem
<bnagy>
have they made the big jump to 2.6 kernel yet?
bosphorus has quit [Remote host closed the connection]
<Bauer>
GlenK and bnagy: CentOS release 5.4 (Final
<Hanmac>
ps: your centos version may be outdated too
fivetwentysix has joined #ruby
locriani has joined #ruby
carlyle has joined #ruby
<bnagy>
5.4??
ephemerian has quit [Quit: Leaving.]
<bnagy>
ye gods
locriani has quit [Client Quit]
<Bauer>
thanks Hanmac, I will compile from sources
locriani has joined #ruby
locriani has quit [Changing host]
locriani has joined #ruby
emmanuelux has joined #ruby
<bnagy>
Bauer: you should run an OS from this century
ramblex has quit [Remote host closed the connection]
mars__ has quit [Quit: Leaving]
<Hanmac>
bnagy arent centOS shipend on stone-plates?
fivetwentysix has quit [Client Quit]
Squarepy has quit [Read error: Connection reset by peer]
stkowski has joined #ruby
Squarepy has joined #ruby
<GlenK>
ha, centos 5 is probably still more current than debian stable
<Bauer>
bnagy: its a production server, unfortunately I did not create it :( perhaps in the future would migrate to a Debian server.. will see. problem is that I am not the sys admin, but the developer doing stuff, and doing admin work needed for things to work :)
tatsuya has quit [Remote host closed the connection]
fralcon has joined #ruby
robert- has joined #ruby
robert- has quit [Client Quit]
jrajav has joined #ruby
robert- has joined #ruby
baroquebobcat has joined #ruby
blazes816 has quit [Quit: Leaving]
rking has quit [Quit: Resetting tmux]
baroquebobcat has quit [Client Quit]
<Mon_Ouie>
I don't know much about Rails; I'm guessing you might be calling your code from an ERB template.
<Mon_Ouie>
That's hard to know without seeing your code — and even more without knowing Rails, so check #rubyonrails
revans has quit [Ping timeout: 252 seconds]
rking has joined #ruby
baroquebobcat has joined #ruby
fbernier has joined #ruby
mrdodo has quit [Remote host closed the connection]
itnomad has joined #ruby
brianpWins has quit [Quit: brianpWins]
rking has quit [Client Quit]
ryh has quit [Read error: Connection reset by peer]
<zii>
Why do #ruby'ists get all scared, when rails is mentioned? This has got nothing to do with rails, rails is just some code anyway. The problem's that caller doesn't include the script entry point and my question's how can that be?
ryh has joined #ruby
banisterfiend has quit [Read error: Connection reset by peer]
<Mon_Ouie>
Again, nobody can say without seeing your code
<GeekOnCoffee>
zii: there's so much to rails, and there are rooms dedicated to it
<Spooner>
zii because not all Rubyists use Rails (not even all of us do any web dev). The assumption that Ruby == Rails == Ruby isn't terribly helpful.
fbernier has quit [Ping timeout: 264 seconds]
rking has joined #ruby
headius has joined #ruby
banisterfiend has joined #ruby
<Hanmac>
zii its because some of us are never touched rails
jameshyde has quit [Quit: Leaving]
Progster has quit [Ping timeout: 240 seconds]
mobilegamelabs has quit [Quit: Angry Polygon (iPhone/Android/Mac) - http://www.MGGGGG.com/ap #ratingexchange]
DDAZZA has joined #ruby
<zii>
I'm talking about this particular case, which doesn't involve rails more than that the script I'm calling's coming from rails.
<Harzilein>
how about making a minimal example them (i did not find your question at the first glance)
<zii>
Ah, damn. caller doesn't include entry point.
<Harzilein>
then*
<Hanmac>
imo the most problem about rails are there users ... they looked at rails and they think that they understand ruby
<zii>
Hanmac: That's quite true, yes.
<Harzilein>
heh, while really _looking_ at rails' innards should prove to anyone they only know tiny parts of ruby ;)
Morkel has quit [Quit: Morkel]
<shevy>
every simple problem can be made more complicated via code
opus has joined #ruby
Vakaris has joined #ruby
ph^_ has joined #ruby
flip_digits has joined #ruby
<shevy>
and erb should die
cbuxton has joined #ruby
<zii>
When I run app X and CI=1 env is passed to the executable, stuff goes wrong. I'm using this http://sprunge.us/LLEY to try to debug it, but it(caller) has only "(erb):33", how sad. Any ideas how to catch where it's called?
cakehero has quit [Quit: Computer has gone to sleep.]
morpheu has left #ruby [#ruby]
laen_ has joined #ruby
mrdodo has joined #ruby
<Mon_Ouie>
Maybe the code is run before you redefine []
jbw has quit [Ping timeout: 272 seconds]
<zii>
Nope, because it catches it.
mrsolo has joined #ruby
<Mon_Ouie>
Or it *is* in some ERB template
Spooner_ has joined #ruby
Musok has joined #ruby
apok has joined #ruby
sendoushi has quit [Read error: Connection reset by peer]
<zii>
But still, shouldn't there be seomthing before the template. Something should've called that template rendering, no?
cjlicata has joined #ruby
ph^ has quit [Ping timeout: 272 seconds]
<GlenK>
so if I have a function that takes a string as an argument, but I'm having trouble adding it to the String class. I'm assuming I just go with "def func", no arguments or anything. But then what goes inside that? "func(self)" isn't working out. seems to be calling the String method, not the one I already defined.
Spooner has quit [Ping timeout: 264 seconds]
<GlenK>
ha, crap. that make a shred of sense?
mrdodo has quit [Remote host closed the connection]
mrdodo has joined #ruby
<zii>
What do you mean by adding it to the String class?
fasta has joined #ruby
<fasta>
Can I test for whether something runs in irb?
<Mon_Ouie>
You can call Kernel.func(foo)
carlyle has quit [Ping timeout: 264 seconds]
<GlenK>
zii: so right now I can just do a func("some string"). I want to be able to do "some string".func
Spooner_ is now known as Spooner
sailias has joined #ruby
qwerxy has joined #ruby
<fasta>
Or even better: whether it is not running in any binary starting with the name ruby<..>?
<Mon_Ouie>
I would suggest not to monkey patch string
<zii>
GlenK: Ah, class String; def func; *do something with self*; end; end
<GlenK>
zii: I'm that far. it's the do something with self part that's getting me. As I said, "func(self)" isn't working out.
cespare has joined #ruby
<zii>
What do you want to do with the string?
<GlenK>
Mon_Ouie: that's telling me the method is private.
<Mon_Ouie>
The Kernel.func only works if you defined the global method as a module_function on Kernel though (but you should rather define it as a module_function anyway; maybe not on Kernel)
lkba has quit [Ping timeout: 244 seconds]
<Mon_Ouie>
def foo; end globally is a bad idea (partly) for that reason
<GlenK>
zii: run my function on it, but with the dot operator or whatever it's called.
sevvie has quit [Quit: sevvie]
statarb3 has quit [Quit: Leaving]
<zii>
GlenK: Yeah, you need do either differeniate function names(both shouldn't be func) or specify that you want the func out of kernel, not string.
<zii>
Hmm, really private.
fbernier has joined #ruby
<nwest>
does anyone know of a good gem/library to cleanse explicit words from an input string?
ryh_ has joined #ruby
jrajav has quit [Quit: The best darkness is strange and surprising]
<GlenK>
zii: I'm not so sure. I mean, here's the instructions from the assignment: http://www.fpaste.org/VJo7/
<GlenK>
zii: huh? "foo" isn't the same as "func".
rakm has joined #ruby
centipedefarmer has joined #ruby
<zii>
hmm, sorry
<GlenK>
zii: if you read those instructions though, it's obvious they don't want me to copy all of my function into the String class.
kidoz has quit [Quit: Ухожу я от вас]
<zii>
If you rename that foo into func it'll still work. I just had defined the same thing with func earlier in the shell.
xaq has joined #ruby
cantonic_ has joined #ruby
jbw has joined #ruby
cantonic has quit [Ping timeout: 240 seconds]
cantonic_ is now known as cantonic
cantonic has quit [Client Quit]
flype has quit [Quit: Computer has gone to sleep.]
<shevy>
coding coding coding
<robert_>
indeed
mrsolo has quit [Quit: This computer has gone to sleep]
<robert_>
so I'm trying to parse down this string format that I have
jrajav has joined #ruby
<Spooner>
GlenK All they are asking for is to add your palandrome?(string) function to the String class as palandrome? where you operate on 'self' rather than 'string'. It isn't as complex as you seem to be making it.
kirun has joined #ruby
mrsolo has joined #ruby
cek has quit [Quit: жопа диридай диридиридай]
<Mon_Ouie>
I'm not a fan of assignments that require something that is mostly considered a bad practice
kpshek has quit []
fralcon has quit [Read error: Connection reset by peer]
Vert has quit [Ping timeout: 252 seconds]
fralcon has joined #ruby
kpshek has joined #ruby
phinfonet has joined #ruby
<Spooner>
Well, on one level it is using String as an example of how Ruby convention operates via object methods rather than global functions, unlike other languages. I'm also not convinced it is bad practice to open classes like that, if you are writing an application rather than a library.
<GlenK>
Spooner: I didn't think so either. but like I said, what I expected to work, namely "palindrome?(self)" doesn't. so I'm a bit stuck.
bradhe has quit [Remote host closed the connection]
<Spooner>
For the same reason when writing an application there shouldn't be any problem with not using a namespace, since libraries should all be using namespaces, so the global should be clean for you.
Vakaris has quit [Ping timeout: 248 seconds]
baphled has joined #ruby
<Spooner>
GlenK : You don't need to be explicit about "self" in a method on an object. They should have explained OO a bit better to you ;)
Vakaris has joined #ruby
jrist is now known as jrist-afk
headius has quit [Quit: headius]
<GlenK>
Spooner: I don't follow. what am I supposed to pass to that function then?
<Spooner>
But I imagine you are still trying to write it as a global method, not a method on String?
<GlenK>
yeah, right
<Spooner>
You don't pass anything to it. Self is implicit.
dhruvasa1ar has quit [Read error: Connection reset by peer]
<Spooner>
If I call "frog".empty?, it calls String#empty?() wherein self is set to "frog"
Hawklord has joined #ruby
minijupe has quit [Read error: No route to host]
minijupe has joined #ruby
<Spooner>
If you call palandrome?("frog") it calls your def palandrome?(string) where string = "frog"
<GlenK>
sure. but I'm wanting String#palindrome? to just pass the buck to the global palindrome? function. so I would think I'd need to pass that self, no? it seems to just be calling String#palindrome? however.
<Spooner>
Does that make any sense at all?
dhruvasagar has joined #ruby
centipedefarmer has quit [Quit: This computer has gone to sleep]
Hawklord has quit [Client Quit]
MarGarina has quit [Read error: Operation timed out]
<Spooner>
In that case, you just need String#palindrome to do: palandrome?(self)
Hawklord has joined #ruby
baphled has quit [Ping timeout: 252 seconds]
<shevy>
what is palandrome
<shevy>
is that like a palatschink
<Spooner>
Though I don't believe they are asking you to keep the global palindrome method.
<GlenK>
but then it complains about not enough arguments. so I'm pretty sure String#palindrome is just calling String#palindrome again
venkatk_ has joined #ruby
<shevy>
GlenK, how comes you need palindromes btw?
<GlenK>
shevy: a test to see if something is the same forward as it is backward.
venkatk_ has quit [Client Quit]
bradhe has joined #ruby
<GlenK>
shevy: an assignment.
<shevy>
I know what a palindrome is, I just was not sure about the palandrome ;-)
<Spooner>
Oh, I see. That makes sense. Sorry! Yes, you'd need to call ::palindrome?(self)
<GlenK>
Spooner: they'd almost have to be asking for me to keep the global. it says 5 lines should do the trick
<Spooner>
But as I said, I believe they want you to move the code, not redirect.
<GlenK>
Spooner: why would it say only 5 lines then?
<Spooner>
I have no idea.
Vakaris has quit [Ping timeout: 240 seconds]
<Spooner>
It is 5 lines if you have the method body in one line, which is all you need.
blazes816 has joined #ruby
<Spooner>
Sorry, I'm struggling to help and not do it for you :)
Vakaris has joined #ruby
<GlenK>
ha. I guess it is a one liner. I seem to recall my palindrome function being longer than that.
Progster has joined #ruby
<GlenK>
probably because it was at first.
<Spooner>
It is one liner in Ruby. Might be more if you write it in another language's style.
centipedefarmer has joined #ruby
bosphorus has joined #ruby
virunga has quit [Ping timeout: 240 seconds]
minijupe has quit [Ping timeout: 272 seconds]
Squarepy has quit [Ping timeout: 244 seconds]
opus has quit [Ping timeout: 252 seconds]
centipedefarmer has quit [Client Quit]
williamcotton has quit [Ping timeout: 246 seconds]
phinfonet has quit [Quit: phinfonet]
Markvilla has quit [Quit: Markvilla]
<Mon_Ouie>
Or because it was to check palindromes for numbers?
<Mon_Ouie>
(without turning them into string, that is)
locriani has quit [Remote host closed the connection]
saschagehlich_ has quit [Ping timeout: 248 seconds]
mdickens has joined #ruby
Vert has joined #ruby
adamkittelson has joined #ruby
Squarepy has quit [Changing host]
Squarepy has joined #ruby
williamcotton has joined #ruby
elhu has joined #ruby
<Spooner>
Mon_Ouie : The instructions clearly referenced strings though :) But yes, with numbers it would be maybe a line or two more.
bosphorus has quit [Ping timeout: 248 seconds]
wallerdev has joined #ruby
wallerdev has quit [Remote host closed the connection]
wallerdev has joined #ruby
<emsilva>
Can someone with experience on both please share pros and cons on Datamapper vs Sequel?
<fasta>
How can I run a script and then get a prompt after the last instruction?
fermion has quit [Quit: P]
Ionic` has quit [Ping timeout: 240 seconds]
qwerxy has quit [Quit: offski]
<fasta>
I have irb and also some fancy new replacement for it.
<Spooner>
fasta : Not sure what you are asking for.
<fasta>
Spooner: I want to get an irb prompt in the context of the script.
DDAZZA has quit [Quit: Leaving]
<fasta>
Spooner: that should be understandable if you know what all the words mean.
schickung has joined #ruby
Hawklord has quit [Ping timeout: 276 seconds]
dv310p3r has joined #ruby
<banisterfiend>
fasta: put a binding.pry at the last line of your file you want to load
<Spooner>
What you want is not to run the script from Pry directly, but to require 'pry' and binding.pry at the end of your scritp.
<fasta>
By 'a' you mean that literal string?
burgestrand has joined #ruby
banisterfiend has quit [Read error: Connection reset by peer]
<emsilva>
I hear a lot (and I mean a lot) of praise on Sequel, but most implementations are see are either using AR or DM. So I'm trying to understand why Sequel is not as wide spread.
ukd1 has joined #ruby
<Spooner>
Nobody mentioned 'a', fasta
<Spooner>
I mean put this at the end of your script: require 'pry'; binding.pry
<fasta>
Spooner: banghousedid.
<Spooner>
Oh, sorry, I must be netsplittedified.
<ukd1>
How can I convert a UTC unixtime stamp to a Time object?
<fasta>
Spooner: banisterfiend did
<burgestrand>
ukd1: Time.at(your_timestamp)
<burgestrand>
ukd1: the Time you receive will be in your local timezone, however. Use Time#utc to get a Time object in UTC.
<banghouse>
drush cc all
<banghouse>
lol
bbttxu has joined #ruby
Banistergalaxy has joined #ruby
locriani has joined #ruby
locriani has quit [Changing host]
locriani has joined #ruby
digitalcakestudi has quit [Quit: Leaving.]
banisterfiend has joined #ruby
centipedefarmer has joined #ruby
<banisterfiend>
fasta: or u coudl do: pry -r ./bleb
<GlenK>
gah. so downcase works inside my String method. reverse works. But if I go with self.gsub() then I get some weird #<Enumerator:0x000000015f9500> being spit out.
<blazes816>
GlenK: gist some code please
abdulkarim has quit [Ping timeout: 264 seconds]
<Hanmac>
Enumerators are mostly the best thing that ruby has
<banisterfiend>
blazes816: enumerators are already generators
<GlenK>
ha, man I suck at Ruby. that took entirely too long for 4 lines of code
<burgestrand>
Hanmac: if you map over a collection of infinite numbers and then take the first five it will only need to map over the first five instead of the set of infinite numbers
minijupe has quit [Client Quit]
<blazes816>
i mean in the python sense, where the next element doesn't exist until it's needed. obviously that wouldn't be the case for every (or most?) enums
<banisterfiend>
Mon_Ouie: should we call the police?
<banisterfiend>
we might have just witnessed a rape
ken_barber has quit [Remote host closed the connection]
burgestrand has joined #ruby
<burgestrand>
How odd is that. My text was duplicated and reversed.
<burgestrand>
Best bug ever.
<banisterfiend>
haha
ken_barber has joined #ruby
<Mon_Ouie>
Oh, didn't notice it wasn't random gibberish
<burgestrand>
Only the first one :d
<banisterfiend>
Mon_Ouie: yeah i agree
williamcotton has quit [Ping timeout: 252 seconds]
baphled has joined #ruby
<banisterfiend>
Mon_Ouie: and there should be first and last, and if you call last on an infinite sequence, then tough luck :P
<Mon_Ouie>
There are already methods that can result into infinite loops in Enumerable
<Hanmac>
banisterfiend it works without lazy when you put the take in the middle: (1..Float::INFINITY).each.chunk { |v| v.even? || nil }.take(5).map{|_,(v)| 100* v + 6}
<Mon_Ouie>
#map for starters
froy has joined #ruby
<Hanmac>
there is #cylcle too :P
williamcotton has joined #ruby
<banisterfiend>
Mon_Ouie: yeah in general, if Enumerators supported more of Array API by default
beneggett has quit [Ping timeout: 248 seconds]
mrsolo has joined #ruby
mrdodo has quit [Remote host closed the connection]
TPFC-SYSTEM has quit [Quit: TPFC-SYSTEM]
cakehero has joined #ruby
<shevy>
can someone kill burgestrand's cat pls
beneggett has joined #ruby
nyuszika7h has quit [Quit: Here we are, going far to save all that we love - If we give all we've got, we will make it through - Here we are, like a star shining bright on your world - Today, make evil go away!]
<burgestrand>
Don’t have a cat, only dogs. D:
<blazes816>
that's a very inspirational quit message
<Mon_Ouie>
Oh, then you're fine; dogs have no interest in using keyboards.
Bosma has joined #ruby
Gab0 has quit [Ping timeout: 250 seconds]
alienaut has joined #ruby
<banisterfiend>
blazes816: no one really uses generators in ruby though
<Hanmac>
cats are interested in computer mices
<alienaut>
hello
<banisterfiend>
in comparison to their update in python anyway
<banisterfiend>
uptake
<blazes816>
banisterfiend: I know, that's why I was wondering if they were trying to get it going in the ruby world
<alienaut>
how can define a class variable as Array?
<banisterfiend>
blazes816: well, can u give an example of where it's used in python? cos iirc they often use generators as a poor man's co-routine, but ruby has fully fledged co-routines in the form of fibers
<crazed>
hey, when using bundler, has anyone successfully used environment variables to configure bundle?
<alienaut>
like class Foo; @bar = Array,new; end ?
<Hanmac>
alienaut i dont think you realy want an class variable
<crazed>
i don't want to check in .bundle/config, nor do i want to run bundle install
<shevy>
gem uninstall bundle
opus has quit [Quit:]
<shevy>
(2) ???
<shevy>
(3) Profit
zemanel has joined #ruby
<alienaut>
Hanmac, i gave not working example just before you
<shevy>
alienaut Array,new ?
<shevy>
class variable is @@foo btw not @foo
<alienaut>
sorry Array.new
tomb_ has joined #ruby
abdulkarim has quit [Ping timeout: 260 seconds]
<shevy>
class Foo; @@array = Array.new; end
<shevy>
Foo.class_variables # => ["@@array"]
<alienaut>
hum i also have a method => def bar; @bar; end
<shevy>
also class variables are kind of useless
<bnagy>
or just @@dont_do_this=[]
<shevy>
yes and @bar is an instance variable
<blazes816>
banisterfiend: there are no good reasons to have another construct for it in ruby afaik. in python they're normally used just like ruby's Enumerable
<shevy>
and you add whatever code you need within define_method
<Spooner>
alienaut : You've set him off :)
<alienaut>
oh.
Guest91275 has quit [Quit: Guest91275]
fridim_ has joined #ruby
<shevy>
it's just copy paste really
<shevy>
my brain is already in hibernation mode again
<alienaut>
oo...
<shevy>
I am about to train sleep-coding
<alienaut>
i did not understand your codes.
Gab0 has quit [Ping timeout: 260 seconds]
jwg2s has joined #ruby
<jwg2s>
I have an array that is like this [table, column, table, column, table, column] and i'd like it to be [ [table, column], [table, column] ]
<alienaut>
another question then
jarred has joined #ruby
<jwg2s>
Isn't there a way with zip to do this?
<alienaut>
what ruby book i should buy
nyuszika7h has joined #ruby
<alienaut>
i already know some basic ruby
<Spooner>
jwg2s : a = a.each_slice(2).to_a
<jwg2s>
thanks i'll give that a shot
<Mon_Ouie>
zip is when you have two collections
<shevy>
alienaut the pickaxe is ok
<sernin>
alienaut: Programming Ruby 1.9, and The Well-Grounded Rubyist imo
bluenemo has quit [Remote host closed the connection]
<alienaut>
and off topic question. nook is a good device to reading programming books?
dekroning has quit [Read error: Connection reset by peer]
a_a_g has quit [Quit: Leaving.]
timepilot has joined #ruby
Vert has quit [Ping timeout: 252 seconds]
timepilot has quit [Client Quit]
<alienaut>
btw thanks guys!
<shevy>
nook?
michaelgamble has joined #ruby
<michaelgamble>
hey
<Squarepy>
I would say no
<michaelgamble>
got a question
Vert has joined #ruby
<Squarepy>
kindle can read pdf in landscape mode, nook can't
<Spooner>
michaelgamble : Ask the question, not whether you can ask. You are only ask one question a day, but you've already wasted it :P
fayimora has joined #ruby
<michaelgamble>
whats the best way to detect device type across multiple platforms ie tvs, mobile, tablets, pc
<michaelgamble>
for an html front end
<davidcelis>
user agent headers
<alienaut>
i mean thier screen looks like a smaller for a programming books
Speed has quit [Quit: When two people dream the same dream, it ceases to be an illusion.]
manizzle has joined #ruby
<alienaut>
their*
<michaelgamble>
but that generally provides OS, and specific device code… is their a database or something to cross reference to get a better sense of if its a tv or tablet or mobile?
hynkle has quit [Quit: Computer has gone to sleep.]
x77686d has quit [Remote host closed the connection]
blacktulip has quit [Remote host closed the connection]
<Squarepy>
alienaut, crop the pdf first then switch it on the side (landscape mode), then 50% of the books are fine
blacktulip has joined #ruby
<Squarepy>
use f.i. 'briss' to crop off the white space
<alienaut>
oh ok
williamcotton_ has joined #ruby
hynkle has joined #ruby
williamcotton has quit [Ping timeout: 260 seconds]
williamcotton_ is now known as williamcotton
x77686d has joined #ruby
indian has joined #ruby
krz has joined #ruby
virunga has joined #ruby
<alienaut>
how can define array with its first value is nil
mikepack has quit [Read error: Connection reset by peer]
mikepack has joined #ruby
opus has quit [Ping timeout: 248 seconds]
<sernin>
michaelgamble: javascript and screen size combined with user agent
<Mon_Ouie>
/\A[+-]\d+(?:\.\d+)\Z/ should cover most of it
<Hanmac>
paolooo you are in the wrong channel ... goto #rubyonrails
<paolooo>
sorry :) thanks
fralcon has quit [Quit: fralcon]
johnlcox has quit [Read error: Operation timed out]
Hawklord has joined #ruby
<Hanmac>
shevy did you see? #goto works on irc
ph^ has joined #ruby
<shevy>
wat
<otters>
how should I redirect stdout to nowhere
rippa has quit [Ping timeout: 264 seconds]
<otters>
in a single thread
rakm has quit [Quit: Computer has gone to sleep.]
<banisterfiend>
otters: send it to StringIO.new
fralcon has joined #ruby
<otters>
okay, that's something
ph^ has quit [Remote host closed the connection]
ph^ has joined #ruby
<Hanmac>
otters: STDOUT.reopen(File::NULL)
<skrite>
Hanmac: banisterfiend thanks !
billiam has quit [Ping timeout: 255 seconds]
<Mon_Ouie>
that or $stdout = File.open(File::NULL)
<Mon_Ouie>
(the latter still allows you to write to STDOUT if for some reason you really need to)
<banisterfiend>
Mon_Ouie: what's your guess
opus has joined #ruby
niklasb has quit [Ping timeout: 252 seconds]
<Hanmac>
File::NULL is more cool then some empty StringIO
fralcon has quit [Ping timeout: 252 seconds]
jorge has joined #ruby
<Mon_Ouie>
Yeah, especially because the StringIO is going to waste memory
<banisterfiend>
what is File::NULL on windows?
<Mon_Ouie>
"NUL"
fralcon has joined #ruby
<Hanmac>
it gives the OS what the OS wants :P
<banisterfiend>
Hanmac: what if the OS just wants to lay down and die without being pestered by germans
theRoUS has joined #ruby
theRoUS has quit [Changing host]
theRoUS has joined #ruby
<alienaut>
how can define a method works like this "string".my_method
billiam has joined #ruby
<Mon_Ouie>
You can define a method in String like in any other class
<Mon_Ouie>
Does this have to do with palindromes? :p
<banisterfiend>
alienaut: what course is this for? an online one?
<alienaut>
oh yes :D Saas course
<banisterfiend>
alienaut: coursera?
<alienaut>
yeap
<alienaut>
it is great
echobravo has joined #ruby
abdulkarim has quit [Ping timeout: 260 seconds]
<banisterfiend>
yeah coursera stuff is good
<virunga>
a course about ruby?
yugui_zzz is now known as yugui
<alienaut>
ruby and ruby and rails
<alienaut>
software engineering for saas is the full name of course
<virunga>
Martin Odersky's teaching a course on coursera in september about Scala
<banisterfiend>
virunga: awesome!
<virunga>
yep
<banisterfiend>
i'll definitely be doing that
<virunga>
:D
<banisterfiend>
virunga: how many weeks?
<banisterfiend>
i hate the really long ones
<virunga>
i dont remember
<banisterfiend>
10 weeks is too large a chunk of life
fralcon has quit [Ping timeout: 260 seconds]
<virunga>
Scala's fantastic
mneorr has joined #ruby
imami|afk is now known as banseljaj
<banisterfiend>
virunga: 7 weeks
<banisterfiend>
that's just pushing the 'too long' button
<virunga>
banghouse: :D
sgronblo1 has joined #ruby
CannedCorn has joined #ruby
adeponte has joined #ruby
lorandi has quit [Remote host closed the connection]
CannedCorn has quit [Client Quit]
saschagehlich has joined #ruby
<virunga>
banisterfiend: the programming in scala book of Odersky is nice. You won't only learn scala but also the functional programming
enroxorz has quit [Quit: Ex-Chat]
sgronblom has quit [Ping timeout: 246 seconds]
emsilva has quit [Read error: Operation timed out]
sepp2k has joined #ruby
<fasta>
I have something which takes a block as an argument; I just want it to test for condition a && b, but apparently that's a syntax error. I am using it like something_expecting_a_block { a && b}
<fasta>
Scala is overly complex.
lorandi has joined #ruby
<fasta>
Scheme is a simple functional programming language.
<burgestrand>
fasta: show your real code, and the real error
<Hanmac>
fasta : UnknownError: error message was not given
<virunga>
lol
paolooo has quit [Quit: Page closed]
nateberkopec has quit [Quit: Leaving...]
<burgestrand>
fasta: if it’s a syntax error, I assume your method takes an argument apart from the block?
<virunga>
fasta: Scheme runs on JVM?
<fasta>
burgestrand: it doesn't.
<fasta>
virunga: some do
<fasta>
burgestrand: something_expecting_a_block { a } works.
<burgestrand>
fasta: then show your real code instead, we can’t guess from a bad example. Your code runs.
<fasta>
burgestrand: should my code work according to that assumption?
niklasb has joined #ruby
abdulkarim has joined #ruby
Gab0 has joined #ruby
vlad_starkov has quit [Remote host closed the connection]
opus has quit [Quit:]
Progster has quit [Read error: Operation timed out]
jwbuurlage has joined #ruby
<burgestrand>
fasta: without your real code you’re just wasting time.
rd1 has joined #ruby
burgestrand has quit [Quit: Leaving.]
<Hanmac>
and the real error message
jarred has quit [Quit: jarred]
statarb3 has joined #ruby
elhu has joined #ruby
<rd1>
is there any way to suppress a trace when I call exit 1?
Progster has joined #ruby
<virunga>
Italy's third in the medals classific!! Go Italy!!
<virunga>
:D
<Hanmac>
virunga it seems that they realy need the "gold" :P
strife25 has quit [Quit: Computer has gone to sleep.]
jarred has joined #ruby
<virunga>
Hanmac: eheh.. Yes, we do
ortho_stice has joined #ruby
<virunga>
like half Europe
<virunga>
though
<virunga>
hihih
danielpunt has joined #ruby
jeff_sebring has joined #ruby
Gab0 has quit [Ping timeout: 255 seconds]
vlad_starkov has joined #ruby
statarb3 has quit [Remote host closed the connection]
<Hanmac>
you could ask the vatican ... they have heaped it like madges
burgestrand has joined #ruby
<ortho_stice>
I have a question about 'bundler'. I'm using a tool that relies on bundler (veewee). As far as I can tell, bundler relies on the current directory to determine what sets of gems to load. Is there any way around that? Another tool relies on eth current directory as well, and they will never agree.
kevinbond has left #ruby [#ruby]
<burgestrand>
ortho_stice: you can set an environment variable for bundler to know where to find the Gemfile.
<burgestrand>
ortho_stice: let’s see if I can find it, it’s in the documentation.
<burgestrand>
ortho_stice: BUNDLE_GEMFILE, if you point that environment variable to where your Gemfile resides bundler will use that directory at it’s base.
michaelgamble has quit [Quit: michaelgamble]
vlad_starkov has quit [Ping timeout: 246 seconds]
rakm has joined #ruby
reuf has joined #ruby
i0n has quit [Quit: Lost terminal]
jgrevich has joined #ruby
johnlcox has joined #ruby
<ortho_stice>
burgestrand: well, that seems like the right direction to go in... though now I get a stack level too deep exception
Neil_ has quit [Remote host closed the connection]
br4ndon has quit [Quit: Lorem ipsum dolor sit amet]
benson has quit [Ping timeout: 264 seconds]
Squarepy has quit [Quit: Leaving]
fbernier has quit [Ping timeout: 240 seconds]
darren has quit [Remote host closed the connection]
jwbuurlage has quit [Quit: jwbuurlage]
Eldariof-ru has quit []
benson has joined #ruby
blacktulip has quit [Remote host closed the connection]
jrajav has joined #ruby
elhu has quit [Quit: Computer has gone to sleep.]
yakko has joined #ruby
bluenemo has joined #ruby
bluenemo has quit [Changing host]
bluenemo has joined #ruby
BrokenCog has quit [Quit: leaving]
Vert has joined #ruby
internet_user has quit [Remote host closed the connection]
<TorpedoSkyline>
Hanmac, I'm trying to get my head around it and lambdas.
thedonvaughn has joined #ruby
jstew has quit [Quit: leaving]
<Hanmac>
imo the sample is a bit shity and could be coded better
bairui has joined #ruby
<TorpedoSkyline>
I think I may understand the idiot array thing. We've got arrays within arrays going on and examining the arrays that are within the arrays. Meh.
<TorpedoSkyline>
I think you're right Hanmac
ngoldman has quit [Remote host closed the connection]
cantonic has joined #ruby
capotej_ has joined #ruby
kvirani has quit [Remote host closed the connection]
<TorpedoSkyline>
That is a really terrible example.
xaq_ has quit [Read error: Connection reset by peer]
ryanf has quit [Quit: leaving]
ttilley_off is now known as ttilley
MarGarina has joined #ruby
xaq has joined #ruby
verto is now known as verto|off
jarjar_prime has joined #ruby
fralcon has joined #ruby
tiripamwe has joined #ruby
<TorpedoSkyline>
ok thanks Hanmac. I'll study that.
<Mon_Ouie>
yield(*pair) is the same as yield pair in fact
ngoldman has quit [Remote host closed the connection]
<Hanmac>
... yeah you may be right
<Mon_Ouie>
The whole method is just that_array.map
burgestrand has quit [Quit: Leaving.]
d3vic3 has joined #ruby
savage- has quit [Ping timeout: 246 seconds]
Ste11a has joined #ruby
carlyle has joined #ruby
<Synthead>
if I have a method defined like this: def this(that = true, those = false) ... end, how can I set the variable 'those' to something else without defining 'that'?
tomb_ has quit [Quit: Computer has gone to sleep.]
jonathanwallace has quit [Remote host closed the connection]
savage- has joined #ruby
jonathanwallace has joined #ruby
<lectrick>
So I want someone to be able to include my module to add features to their class... but I also want them to be able to override a method... Is there a pattern for this?
<lectrick>
(override a method in my module, I mean)
bbttxu has quit [Quit: bbttxu]
danielpunt has quit [Remote host closed the connection]
MarGarina has quit [Ping timeout: 252 seconds]
pskosinski has quit [Quit: I've got a feeling there's a fish in the floor; I'd better squish it or he'll swim out the door; Sometimes they take me for a walk in the sun; I see my fish and I have to run]
schickung has joined #ruby
<lectrick>
Can I just define the method again after I include the module?
jonathanwallace has quit [Ping timeout: 252 seconds]
<blazes816>
you could try it, but I'm pretty sure that works
schickung has quit [Client Quit]
havenn has joined #ruby
pskosinski has joined #ruby
balki_ has joined #ruby
balki_ has quit [Read error: Connection reset by peer]
havenn_ has joined #ruby
balki has quit [Read error: Connection reset by peer]
havenn has quit [Remote host closed the connection]
jonathanwallace has joined #ruby
balki has joined #ruby
vlad_starkov has joined #ruby
<Hanmac>
lectrick you could freeze the module if you want to prefent it
[Neurotic] has joined #ruby
d3c has joined #ruby
w400z has joined #ruby
stopbit has quit [Quit: Leaving]
ngoldman has joined #ruby
vlad_starkov has quit [Ping timeout: 246 seconds]
ngoldman has quit [Remote host closed the connection]
abdulkarim has quit [Ping timeout: 260 seconds]
infinitiguy1 has quit [Read error: Operation timed out]
kiwnix has quit [Quit: Saliendo]
abdulkarim has joined #ruby
banseljaj is now known as imami|afk
MissionCritical has quit [Ping timeout: 244 seconds]
<jwg2s>
i have two arrays, i want to scan through one with each element in the other, and if the first two columns match, delete it from the first
<jwg2s>
How can I do that?
sepp2k has quit [Remote host closed the connection]
alienaut has quit [Remote host closed the connection]
<jwg2s>
[ [dog cat bog], [bird bill joe] ] and [ [dog cat jim] ], combine these but only keep [dog cat dog] instead of including [dog cat jim] as well.
<jwg2s>
Sorry I'm having trouble explaining this...
jorge has quit [Remote host closed the connection]
Hawklord has joined #ruby
SQLStud has quit [Read error: Connection reset by peer]
<jwg2s>
I'll generalize… I want to take each element of one array and compare it against each element of another array. If a condition is met, delete it from the array that is being compared against.
sdwrage has quit [Quit: geekli.st/programmer]
lupine_85 has joined #ruby
mehlah has joined #ruby
sailias has joined #ruby
adeponte has quit [Remote host closed the connection]
cousine has joined #ruby
lupine_85 has quit [Client Quit]
<Synthead>
is there a variable that will tell me the parent method of what called a certain method?
MissionCritical has joined #ruby
<ForSpareParts>
Does anyone know of a Markdown solution that would be easy to extend to allow for a couple of custom app-specific tags?
jonathanwallace has quit [Remote host closed the connection]
ProLoser|Work has joined #ruby
jonathanwallace has joined #ruby
<ProLoser|Work>
hallo
<ProLoser|Work>
is this where i can get help with sass?
<ProLoser|Work>
i want to create a mixin that appends something to each rule output but another mixin
bbttxu has joined #ruby
dv310p3r has quit [Ping timeout: 260 seconds]
tomb_ has joined #ruby
tomb_ has quit [Client Quit]
shashin has joined #ruby
<ForSpareParts>
blazes816, Thanks! This is exactly what I needed. I must've been doing the wrong Google searches...
<blazes816>
awesome!
jrist is now known as jrist-afk
jarred has quit [Quit: jarred]
jonathanwallace has quit [Ping timeout: 250 seconds]
verto|off is now known as verto
tewecske has quit [Quit: Leaving.]
jonathanwallace has joined #ruby
bbttxu has quit [Ping timeout: 240 seconds]
devdazed has quit [Quit: Computer has gone to sleep.]
iamjarvo has quit [Quit: Leaving...]
nyuszika7h has quit [Quit: Here we are, going far to save all that we love - If we give all we've got, we will make it through - Here we are, like a star shining bright on your world - Today, make evil go away!]
davidpk has quit [Quit: Computer has gone to sleep.]
foudil has left #ruby ["WeeChat 0.3.8"]
carlyle has joined #ruby
foudil has joined #ruby
snearch has joined #ruby
nari has joined #ruby
verto is now known as verto|off
kirun has quit [Quit: Client exiting]
theRoUS has quit [Ping timeout: 260 seconds]
beakerman has joined #ruby
Nick0010 has joined #ruby
vzhou has joined #ruby
<vzhou>
hello
<vzhou>
a quick question
<vzhou>
i manage my gem with rvm
kpshek has quit []
awarner has quit [Remote host closed the connection]
justsee has quit [Ping timeout: 252 seconds]
<vzhou>
no such file to load -- net/http/persistent (LoadError)
<vzhou>
it shows this error
<vzhou>
when requiring
carlyle has quit [Remote host closed the connection]
xaq has quit [Remote host closed the connection]
<vzhou>
hello
<vzhou>
is any one here?
Musok has quit [Read error: Connection reset by peer]
xaq has joined #ruby
sendoushi has joined #ruby
<vzhou>
hello...
<vzhou>
is any one here?
<vzhou>
exit
vzhou has quit [Client Quit]
awarner has joined #ruby
<ccooke>
... impatient
Nick0010 has quit [Quit: Nick0010]
joshman_ has quit [Ping timeout: 252 seconds]
TheShadowFog has quit [Read error: Connection reset by peer]
sdwrage has joined #ruby
ngoldman has joined #ruby
awarner has quit [Remote host closed the connection]
cascalheira has joined #ruby
sendoushi has quit [Remote host closed the connection]
billiam has quit [Quit: Leaving]
<ged>
Haha, awesome.
foudil has quit [Quit: WeeChat 0.3.8]
Synthead has quit [Quit: p33 ba115]
cousine has quit [Remote host closed the connection]
reuf has quit [Quit: Leaving]
andrewhl has quit [Remote host closed the connection]
wallerdev has quit [Quit: wallerdev]
w400z has quit [Quit: Computer has gone to sleep.]
<jrajav>
That just made my day
wallerdev has joined #ruby
wallerdev has quit [Read error: Connection reset by peer]
wallerdev has joined #ruby
centipedefarmer has quit [Quit: This computer has gone to sleep]
jeff_sebring has quit [Quit: Leaving]
stkowski has quit [Quit: stkowski]
Criztian has quit [Remote host closed the connection]
havenn_ has quit [Remote host closed the connection]
uris has quit [Quit: leaving]
theRoUS has joined #ruby
theRoUS has quit [Changing host]
theRoUS has joined #ruby
chrisbolton has quit [Quit: chrisbolton]
centipedefarmer has joined #ruby
MarGarina has quit [Read error: Operation timed out]
<otters>
some loser already took the username "otters"
<shevy>
hehe
<otters>
so I had to settle for the singular
<otters>
I'll just wait for him to die out
<otters>
you can claim github usernames when the original owner hasn't had any activity in six months
<shevy>
really?
<otters>
yeah
<otters>
but it's only been 5
<shevy>
hmm
<otters>
as you can see
<otters>
there's a bunch of like chinese and stuff in otterses files
<otters>
but yeah, I'm just sitting here like a vulture waiting
statarb3 has quit [Quit: Leaving]
mahmoudimus has quit [Quit: Computer has gone to sleep.]
<EstanislaoStan>
I guess I could make my own method that runs =~, then overwrites the string with only the text after that point, runs the method again, and does this until nil is returned. It'll put all positions into an array that it'll return. Does that sound plausible?
bbttxu has quit [Quit: bbttxu]
lunitikcalm has joined #ruby
<otters>
that sounds like your best bet
<otters>
that's what I was gonna do, all in one line, but Ruby's no Haskell
lunitikcalm has quit [Remote host closed the connection]
virunga has quit [Quit: Sto andando via]
adeponte has joined #ruby
pskosinski has joined #ruby
gavilan2 has joined #ruby
centipedefarmer has quit [Quit: This computer has gone to sleep]
bradhe_ has quit [Remote host closed the connection]
<otters>
let indexesOf' s c [x] = if c == x then [s] else []; indexesOf' s c (x:xs) = if c == x then s:indexesOf' (succ s) c xs else indexesOf' (succ s) c xs; indexesOf = indexesOf' 0
lunitik has joined #ruby
rmc3 has joined #ruby
lunitik has quit [Client Quit]
lunitikcalm has joined #ruby
yugui is now known as yugui_zzz
fearoffish has quit [Quit: Computer has gone to sleep.]
rd1 has left #ruby [#ruby]
Chryson has joined #ruby
MarGarina has quit [Ping timeout: 246 seconds]
x77686d has quit [Read error: Operation timed out]
dagnachewa has quit [Quit: Leaving]
nari has joined #ruby
<EstanislaoStan>
Is that Haskell?
blazes816 has quit [Quit: Leaving]
<EstanislaoStan>
Ooh, and I do have a tiny bit of a problem doing this. I don't know how to make methods that don't follow the .method format.
mikepack has quit [Remote host closed the connection]
troyack has joined #ruby
chson has joined #ruby
<burgestrand>
EstanislaoStan: you just def them. def =~(thingy); end
vvgomes has joined #ruby
Speed has joined #ruby
chson has quit [Remote host closed the connection]
centipedefarmer has joined #ruby
htroyack has quit [Ping timeout: 244 seconds]
anderse_ has quit [Quit: anderse_]
htroyack has joined #ruby
bbttxu has joined #ruby
macer1 has joined #ruby
<macer1>
hey
troyack has quit [Ping timeout: 240 seconds]
<macer1>
I have a module Protocol, there is class Packet{1,2,3} etc.
<macer1>
and these have packet_id's in them
<macer1>
and I want to check every class in protocol if responds_to packet_id
MasterIdler_ has joined #ruby
<macer1>
So I know PacketLogin have i.e. id 5
cbuxton has quit [Quit: Leaving.]
<burgestrand>
macer1: you read it with Protocol::PacketLogin.packet_id?
<macer1>
well I think it will work that way
<burgestrand>
macer1: because when you said PacketX had packet_id in it, I expected just a regular attribute on every instance.
bluenemo has quit [Remote host closed the connection]
<burgestrand>
macer1: so how do you want the results?
yugui_zzz is now known as yugui
<burgestrand>
macer1: you can iterate through Protocol.constants and get the actual values with Protocol.const_get(constant_name)
<EstanislaoStan>
burgestrand: I'm getting a t_match error. It thinks I'm using the method, not defining it.
<macer1>
hmm
<macer1>
My final goal is that I have a binary string with data. Then I check the first byte from this, the id. and then I convert it to instance of packet which is owning that id
gtuckerkellogg has quit [Quit: Computer has gone to sleep.]
<macer1>
I am using bindata
<burgestrand>
macer1: I take it you don’t want to just make a hash: { packet_id_1 => Protocol::PacketLogin, packet_id_2 => Protocol::PacketDisconnect }?
<macer1>
if posibble no :)
centipedefarmer has quit [Quit: This computer has gone to sleep]
robert- has joined #ruby
<burgestrand>
Because that’d be simpler and probably looks better :)
kenichi has quit [Remote host closed the connection]