<charliesome>
banistertab: even if it were documented in japanese that'd be helpful
<charliesome>
the problem is programmers just hate documenting
<seanstickle>
s/programmers/everyone/
<zzak>
i dont!
<zzak>
one of my favorite ways of learning
<charliesome>
zzak: you're a rare exception
sent-hil has quit [Remote host closed the connection]
aeberlin has quit [Quit: Leaving]
fire_wall has quit [Ping timeout: 252 seconds]
<seanstickle>
Well, I'm a fan of Literate Programming, so we prefer to write documentation
<seanstickle>
The code is sort of an afterthought
Mellett68 has quit [Remote host closed the connection]
Axsuul has joined #ruby-lang
wardrop has quit [Ping timeout: 260 seconds]
slyphon__ has quit [Ping timeout: 245 seconds]
wardrop has joined #ruby-lang
cirwin has left #ruby-lang [#ruby-lang]
dalekurt has quit [Quit: I'll be back!]
wardrop has quit [Quit: wardrop]
wardrop has joined #ruby-lang
fire_wall has joined #ruby-lang
slyphon__ has joined #ruby-lang
pkrnj has joined #ruby-lang
thone has joined #ruby-lang
thone_ has quit [Ping timeout: 250 seconds]
babinho has quit [Remote host closed the connection]
gregmoreno has quit [Ping timeout: 255 seconds]
pkrnj has quit [Quit: Computer has gone to sleep.]
CaptainJet has quit []
kentos has quit [Quit: Leaving]
robotmay has quit [Remote host closed the connection]
robotmay has joined #ruby-lang
wyhaines has quit [Remote host closed the connection]
Assurbanipal has joined #ruby-lang
robotmay has quit [Ping timeout: 264 seconds]
Banistertab` has joined #ruby-lang
banistertab has quit [Read error: Connection reset by peer]
Assurbanipal has quit [Client Quit]
sailias has joined #ruby-lang
waffleau has joined #ruby-lang
apeiros_ has joined #ruby-lang
Banistertab` has quit [Ping timeout: 252 seconds]
apeiros_ has quit [Ping timeout: 255 seconds]
simi has quit [Ping timeout: 244 seconds]
<foucist>
seanstickle: do you use folding for that too?
<soahccc>
Just wondered if there is a system() which gives me the result as string. Backticks aren't in the user's context and %x[] gives me always this: sh: echo "something": command not found
<seanstickle>
foucist: folding?
marr has quit [Ping timeout: 240 seconds]
<drbrain>
soahccc: what's in your %x[] ?
<drbrain>
and, what OS?
Croms has quit [Read error: Connection reset by peer]
<foucist>
seanstickle: in the editor, is the doc mixed right in the code?
Croms has joined #ruby-lang
<foucist>
documentation*
<seanstickle>
foucist: doc mixed into the code? no. you miss the idea of literate programming.
<seanstickle>
the code is littered among the documentation.
<soahccc>
OS X but can't I pass arguments? %x["ls"] works, %x["ls -al"] not
cczona has joined #ruby-lang
<drbrain>
soahccc: what happens when you type '"ls -al"' at your prompt?
<drbrain>
soahccc: I get: -bash: ls -al: command not found
cczona has quit [Client Quit]
<soahccc>
oh I see... Didn't need those bloody brackets >:/
<drbrain>
:D
<soahccc>
I mean the quotes :< It's to late I guess
<drbrain>
soahccc: either!
<foucist>
seanstickle: ok, do you use vim? any particular setup at all to help?
<drbrain>
foucist: I use almost no plugins with vim
<seanstickle>
foucist: vim, yes.
<seanstickle>
foucist: but pretty much stock, a couple of plugins, but nothing specific to literate programming.
lsegal` has joined #ruby-lang
lsegal` has quit [Client Quit]
davidbalber|away is now known as davidbalbert
<foucist>
cool
<soahccc>
Hmm doesn't solve it either... What do I have to do so that aliases works? with system() they work but with no other form
lsegal has joined #ruby-lang
<seanstickle>
I should probably use more plugins for this.
<drbrain>
soahccc: maybe popen or Process.spawn?
mjio has quit []
wardrop has quit [Quit: wardrop]
<soahccc>
drbrain: Hmm can't get it to work with spawn really... Could be so easy :( I know a gem which works but I don't want that dependency just because I can't capture system's output
blazes816 has quit [Quit: blazes816]
<drbrain>
soahccc: Process.spawn is a bit of work, you have to do something like in, out = IO.pipe; pid = Process.spawn command, out: in, err: in; Process.wait pid; out.read
<soahccc>
Yeah I've got that but it already died when I tried to read from it
<drbrain>
soahccc: popen or open3 should do it, they ship in ruby
<soahccc>
popen doesn't have user aliases either.
<drbrain>
:/
<soahccc>
and the session gem accomplishes that by calling a bash login
<soahccc>
With all this problems I wonder if it is supposed to work with system()
tenderlove has quit [Read error: Operation timed out]
runeb has joined #ruby-lang
jsilver has quit [Quit: poserchats]
<soahccc>
According to some articles system and backticks should behave the same as they both uses subshells instead of subprocesses like popen does.
sent-hil has joined #ruby-lang
stardiviner has joined #ruby-lang
banisterfiend has joined #ruby-lang
<foucist>
seanstickle: any tips on writing the documentation? rules of thumbs?
<drbrain>
popen can spawn a subshell as well, under certain conditions
wardrop has joined #ruby-lang
<seanstickle>
foucist: write an essay about the software you are building. code gets interspersed in the essay in whatever order you like.
<seanstickle>
It's basically writing a very nice LaTeX file with code blocks in whatever order makes sense to write about it, rather than the order that the compiler/interpreter wants to see
<foucist>
ok
runeb has quit [Ping timeout: 248 seconds]
<seanstickle>
foucist: the literate programming tool then reorders the code so the interpreter can process it
Drekonus has joined #ruby-lang
thatdutchguy has quit [Remote host closed the connection]
<firefux>
do you guys find you are more productive on the desktop than on the laptop?
<seanstickle>
Nope.
<seanstickle>
All laptop all the time for me.
waffleau has quit [Quit: waffleau]
<soahccc>
drbrain: I'll stick with the session gem for now... It's slower but I'll fix that up later
<soahccc>
Thanks for the help anyway
<foucist>
firefux: i haven't had a desktop since 2007, sometimes i miss the sweet ergonomic setup with a ergonomic keyboard, comfy computer chair etc.. but if you have a nice portable laptop you can change environment through out the day and that can help some people be more productive.. or not :P
<foucist>
firefux: also for awhile i would just plug the laptop into a monitor/keyboard etc at home.. before i started travelling heavily
rsl has quit [Quit: Computer has gone to sleep.]
faustman has quit [Read error: Connection reset by peer]
ryanlecompte has quit [Remote host closed the connection]
faustman has joined #ruby-lang
mjio has joined #ruby-lang
sn0wb1rd has quit [Quit: sn0wb1rd]
sent-hil has quit [Remote host closed the connection]
Nisstyre-laptop has joined #ruby-lang
sepp2k has joined #ruby-lang
jds_ has joined #ruby-lang
jds has quit [Read error: Operation timed out]
krohrbaugh has quit [Quit: Leaving.]
faustman has quit [Ping timeout: 260 seconds]
Aiur has quit [Quit: Computer has gone to sleep.]
slyphon__ is now known as slyphon
kain has quit [Quit: exit]
ryanlecompte has joined #ruby-lang
kain has joined #ruby-lang
havenn has quit [Remote host closed the connection]
jbsan_ has joined #ruby-lang
towski has quit [Remote host closed the connection]
jbsan has quit [Ping timeout: 246 seconds]
jbsan_ is now known as jbsan
macmartine has joined #ruby-lang
mrsolo has quit [Quit: Leaving]
io_syl has quit [Ping timeout: 264 seconds]
krz has joined #ruby-lang
<Drekonus>
firefux: I've really enjoyed a 13" MBP with an upgrade 2TB HDD for on the go, then when I'm at home I use an external 24" monitor with external mouse and touchpad/mouse. Win.
<andrewvos>
judofyr: Is it nice working for a small company?
<judofyr>
andrewvos: yes. although I haven't worked for any big companies :P
<judofyr>
oh
<judofyr>
it's lunch
<judofyr>
brb
ioga_wrk has joined #ruby-lang
<rolfb>
lunch!
<rolfb>
bb in 25
<judofyr>
brb where r = 30 mins
* henrikhodne
wishes he could eat lunch or some meal.
<henrikhodne>
However, not that many places are open at 5 AM.
<rolfb>
henrikhodne: the trick is to STOCK UP
<rolfb>
:P
<henrikhodne>
rolfb: Yes, I need to restock soon. Winter break is in not too long though, so I don't want to restock too much.
cultureulterior_ has joined #ruby-lang
hack has quit [Read error: Operation timed out]
madish has joined #ruby-lang
m3nd3s has joined #ruby-lang
nerd has joined #ruby-lang
nerd is now known as hack
ddd has joined #ruby-lang
sepp2k has joined #ruby-lang
banisterfiend has joined #ruby-lang
<gnufied>
working for big companies is best. you get natural tubelight tan (for working in artificial light all the time), some operate from so called IT parks, security there make you feel like terrorist (without visiting airports)
<gnufied>
and that is tip of goldberg
jds has quit [Ping timeout: 250 seconds]
retro|cz has joined #ruby-lang
<banisterfiend>
zenspider: did u see all those mean tweets about minitest yesterday?
GarethAdams has quit [Remote host closed the connection]
<judofyr>
andrewvos: "Well no, actually. If your argument is against global pollution, then anything > 0 is bad. You can't have it both ways. As pointed out elsewhere, I always scope my methods on object to must_* and wont_* so it really isn't any worse than your should/should_not."
<andrewvos>
judofyr: That whole argument seems like trolling
<rolfb>
judofyr: the new thing happened in 2.1 i think
<andrewvos>
judofyr: hahaha "Also, as I've pointed out, you can disable the expectation methods in minispec. Clearly 0 methods infecting Object is better than your 2. Right? I mean... I do get to use your own logic against you, right?
<judofyr>
andrewvos: I really dislike the RSpec matcher style do. for me, it's always a game of "should I use a space, dot or underscore here?"
<rolfb>
judofyr: the benefit of this verbosity is that you get some nicely formatted documentation
<andrewvos>
judofyr: Yeah, I absolutely hate rspec.
<rolfb>
and clear error messages
BlaXpirit has joined #ruby-lang
<andrewvos>
judofyr: I hate the word should in tests actually. It's like saying "my object should do this, I don't quite know if it does, but yeah, it should be doing this"
<judofyr>
rolfb: custom assert messages are pretty useful too :)
<judofyr>
rolfb: I'm not very satisfied with the tests, but yeah, it's a complex class. it's a glue between 5 different classes :/
<rolfb>
my first though is that they are very hard to read
<rolfb>
and there is a lot of setup going on
<rolfb>
and subsequent setups depend on parent setups
<rolfb>
thought, even
<judofyr>
rolfb: well, yeah. this class requires a lot of setup. I had "one test, one setup" earlier, but it was too much copy-paste
<ddd>
now imagine if you were adding in mocks and stubs :)
<judofyr>
ddd: I do have some mocks and stubs
banisterfiend has joined #ruby-lang
jbsan_ has quit [Quit: jbsan_]
<banisterfiend>
judofyr: i really like bacon
<banisterfiend>
at least...i like its speed
<rolfb>
judofyr: yeah, it's too complex for me to start editing it. :)
jbsan has joined #ruby-lang
mindbender1 has joined #ruby-lang
vlad_starkov has quit [Ping timeout: 264 seconds]
<judofyr>
rolfb: I just can't find a way to write this class in a simple way. Controllers need access to *everything*, and thus the unit test becomes messy
<rolfb>
it's also a bit confusing that you are mixing extensive setup / integration with mocking later on. also seems like you are testing the controllers understanding of the @stash a lot. what kind of a name is @stash anyway?
<rolfb>
:)
<judofyr>
rolfb: I consider Transaction/Request/Response as basic objects (like String/Array) so I don't bother mocking them. they are (mostly) data object.
<rolfb>
primitives
<rolfb>
in other words
<judofyr>
yes
<judofyr>
rolfb: well, yeah. @stash is probably as good as `params` in Rails. @stash is what the router returns. the router is just a mapping from a path to a stash.
<rolfb>
by not having an interface for the stash i think the tests are going to be expensive to change
<judofyr>
rolfb: e.g. /items/123 maps to { :controller => "items", :action => "show", :id => "123" }
<judofyr>
rolfb: but the stash is just a hash
<judofyr>
it even shares 3 letters
<rolfb>
heh
<judofyr>
that's like over 50%
<rolfb>
i thought the project aimed for using good OO-design
<judofyr>
rolfb: what would I gain from objectifying @stash?
pab|o has joined #ruby-lang
<rolfb>
judofyr: you would gain hiding what "streaming?" means
<rolfb>
from the controller
<rolfb>
hmm
<rolfb>
perhaps you are doing this already
<rolfb>
haven't checked how the stash is interpreted
<judofyr>
rolfb: it's used for various things. the action is dispatched based on :action or :callback. the controller is looked up based on :controller. the action itself can use it to get access to parts of the URL. (e.g. :id)
<judofyr>
that's the basic stuff
<judofyr>
rolfb: but it's also a way to say to the controller "wrap this action in a fiber"
<judofyr>
or, dispatch the action right away (instead of waiting until the full body is read)
<rolfb>
what's the difference between stash and params in the controller?
<judofyr>
params is only query parameters + form body
ddd has quit [Quit: rebooting to fix display. damned iStats]
<judofyr>
params comes entirely from the user
<judofyr>
stash is something you control in your app
<judofyr>
Rails' params is kinda a merge between my stash and my params
<rolfb>
hmm
jbsan has quit [Quit: jbsan]
<judofyr>
I prefer keeping them separate
<rolfb>
sure
jds has joined #ruby-lang
<rolfb>
is stash more of a configuration?
<judofyr>
yes
<rolfb>
should it have config or configuration in it's name?
<rolfb>
:)
<judofyr>
well, :id isn't actually configuration though
<rolfb>
is it a delivery configuration=?
<judofyr>
get("/items/:id").to('item#show')
m3nd3s has quit [Remote host closed the connection]
<judofyr>
delivery configuration?
<rolfb>
bad word
<judofyr>
rolfb: you're going to use it all the time in the controller, so it needs to be short
zmack has joined #ruby-lang
<judofyr>
rolfb: I don't like config, because there's also going to be a config that refers to the app-config
ddd has joined #ruby-lang
<rolfb>
judofyr: trying to figure out all of stash's responsibilites
<rolfb>
lots of them :)
kurko_ has joined #ruby-lang
jds has quit [Ping timeout: 265 seconds]
jxie has quit [Quit: leaving]
<rolfb>
judofyr: terribly sorry, but i have to do some work
<judofyr>
rolfb: well, the stash is how a router parses a request
<judofyr>
or, it's the result from parsing a request
<judofyr>
it's all about extracting data from the request, to make it usable for your app
jbsan has joined #ruby-lang
<judofyr>
rolfb: no worries :)
vlad_starkov has joined #ruby-lang
<rolfb>
judofyr: btw, would love to see how your code turns out if you give yourself a contraint of not using any variable names with less than five letters
<judofyr>
rolfb: haha. is it that bad?
<judofyr>
rolfb: always interesting talking about this stuff. I do feel that the stash is kinda difficult to explain to Railsers (who are used to merging query string and path parsing)
<rolfb>
judofyr: the cogntive load is immense
<rolfb>
which either means i'm stupid
banisterfiend has quit [Ping timeout: 252 seconds]
<rolfb>
or the code is hard to read
<rolfb>
i prefer the latter
<rolfb>
but sometimes the former is true
<rolfb>
:D
<judofyr>
rolfb: interesting. but tx, res, req stays
<rolfb>
tx is fine
<rolfb>
req is ... fine
<rolfb>
res is confusing
<judofyr>
oh?
<rolfb>
res[ponse|sult]
<judofyr>
ah
<judofyr>
well, a response is a type of a result ;)
<rolfb>
true
<rolfb>
would be nice to know what kind of response/result it is
<rolfb>
is it generic, or does it have a type?
<judofyr>
res is a HTTP response
<rolfb>
then http_res would save me a lot of lookup
<judofyr>
ugh
<rolfb>
^^
<judofyr>
ugly man
<judofyr>
ugly, man*
<rolfb>
well, i'd rather save those minutes i need to spend figuring out what i can expect to get there
<rolfb>
also, http_res is way easier to grep for than res
<rolfb>
judofyr: please try grepping your code for "res"
<rolfb>
:D
<judofyr>
rolfb: then use tx.res instead :D
runeb has joined #ruby-lang
<rolfb>
hehe
<rolfb>
judofyr; the clean code video on naming is brilliant for this topic btw
<judofyr>
rolfb: either you're in an action: res.headers.server = "Foo". or you're working with a tx (from an API): tx = ua.get("http://api/").wait!; tx.res
<judofyr>
rolfb: but yes, there could be request/response instead of req/res
waffleau has joined #ruby-lang
<judofyr>
rolfb: but yeah, this is inspired from Perl :/
<judofyr>
;) *
<rolfb>
haha
<rolfb>
yes
<rolfb>
i knew i had seen the type of abbreviations before
s1n4 has joined #ruby-lang
<andrewvos>
Is anyone really on app.net?
<judofyr>
rolfb: think about it as jargon; you'll have to learn it once, but the same classes are used consistently across the framework. so a `req` on an API call is the same as a `req` in an action
<rolfb>
judofyr: readability > consistency
<judofyr>
rolfb: there's also verbosity in there :P
<rolfb>
wait in fiber means it waits for the body before it sends anything back?
<judofyr>
rolfb: waits for the whole request. it's async
<judofyr>
#get returns a Promise
retro|cz has quit [Ping timeout: 244 seconds]
<judofyr>
but yes, it's the resolved when the body and everything has been received
slyphon has joined #ruby-lang
<rolfb>
judofyr: what's the size of user_agent's public api
<rolfb>
also ... this work thing, i should probably do that
<rolfb>
:D
<judofyr>
rolfb: get/post/put/delete/post_form + request (which is what the other delegates to). and some attributes (max_redirects, max_connections etc.)
r0bby_ has quit [Ping timeout: 246 seconds]
x0F has quit [Disconnected by services]
x0F_ has joined #ruby-lang
x0F_ is now known as x0F
<rolfb>
so it wouldn't be a very big stretch to add get_async
<rolfb>
and hide the "wait!" or "wait_in_fiber"
retro|cz has joined #ruby-lang
<judofyr>
rolfb: promises are useful on their own. and often you want to use them even if you have fibers available.
<judofyr>
bougyman: and what about /items/123/comments/456 ?
<judofyr>
how would you map that?
slyphon has quit [Ping timeout: 245 seconds]
Guedes has quit [Ping timeout: 240 seconds]
kith_ has joined #ruby-lang
<bougyman>
judofyr: depends on how long.
<judofyr>
bougyman: very long
mindbender1 has quit [Ping timeout: 265 seconds]
<judofyr>
bougyman: :P
<judofyr>
I have no idea what you mean :P
<bougyman>
if only 4, i'd probably do def index(id, more = nil, more_id = nil)
<bougyman>
to allow /items/123 orr /items/123/comments or /items/123/tags/12
<bougyman>
that'd be in the Items controller
<judofyr>
bougyman: but I want …/comments/123 to go to one action and …/tags/123 to go to another
<bougyman>
and it will/would
mars26 has quit [Ping timeout: 260 seconds]
kith has quit [Ping timeout: 244 seconds]
spuk has quit [Ping timeout: 252 seconds]
<darix>
can i have one method handling /items/123/comments/X and one method /items/123/tags/12 or do i have to make that "routing" with if/else|case/when inside the index method?
hack is now known as video
<bougyman>
you could do the typical route mapping or you could put the logic in items index method
<bougyman>
you have the choice.
<bougyman>
that's why I said "how long" if it's a wealth of possible options I prefer the optional args and handling the business logic in the method. if it's just one (like comments), probably a route map.
s0ber has quit [Remote host closed the connection]
s0ber has joined #ruby-lang
<Steve-W>
I'm thinking that's just someone forgetting to check the class of the object, but I might be misunderstanding something (like a convention of placing nil first or something)
<darix>
Steve-W: why not use row.nil?
<darix>
the error is weird indeed
<darix>
but row.nil?
<Steve-W>
I'm using nil == row
<Steve-W>
nil == row or row.nil? both work fine, I just thought t'was an oddity
<darix>
Steve-W: again why not 'puts "1" if row.nil?'
<darix>
Steve-W: it is odd indeed^^
<Steve-W>
I'm not stuck per se, just thought it might be worth checking before I file a bug report
<Steve-W>
Placing nil first in all comparisons seems to be more stable than using .nil? or x == nil, logically
vlad_starkov has quit [Remote host closed the connection]
<Steve-W>
but, well, that's somewhat counter-intuitive given the behaviour of == in many other languages
<darix>
Steve-W: .nil? should also work all the time :)
<Steve-W>
nil == can't be overridden though
dous has quit [Ping timeout: 246 seconds]
<Steve-W>
well, not by the type being compared
<Steve-W>
.nil? can be 'semantically nil' as well as 'object'ly nil, if you'll excuse the ugly phrasing
runeb has joined #ruby-lang
<darix>
uhm
dous has joined #ruby-lang
dous has quit [Changing host]
dous has joined #ruby-lang
<darix>
i dont see how
<darix>
for "has nothing in it"
<darix>
i would think .empty? is better
<Steve-W>
My point was pretty weak, I'm basically saying that it's easier for someone else to have mixed up .empty? and .nil? than it is for them to override NilClass.==
<Steve-W>
I'll grant neither should happen in most situations too ;-)
<Steve-W>
(rather 'more likely' than 'easier', p'raps)
runeb has quit [Ping timeout: 252 seconds]
Mon_Ouie has joined #ruby-lang
<Steve-W>
anyway, this is somewhat academic. Any idea how I file a bug report for the standard library?
jxie has quit [Ping timeout: 265 seconds]
outoftime has joined #ruby-lang
waffleau has quit [Ping timeout: 240 seconds]
nerd has quit [Quit: WeeChat 0.3.9.2]
<Kero>
also fails for row == "Hello, world" and a whole host of other comparisons
wyhaines has joined #ruby-lang
<Steve-W>
It should fail for most things really
mars777 has joined #ruby-lang
heftig has quit [Quit: leaving]
<Kero>
yeah; I would hope bug-reporting can be found on the ruby-lang website?
nerd has joined #ruby-lang
<Steve-W>
I've just found the right one, I think
waffleau_ has joined #ruby-lang
banisterfiend has joined #ruby-lang
Okasu has joined #ruby-lang
Okasu has left #ruby-lang [#ruby-lang]
jxie has joined #ruby-lang
<Steve-W>
Done! Well, thanks for the help, it's always nice to know I'm not missing something obvious
<Mon_Ouie>
Out of curiousity, what is the bug?
kith_ is now known as kith
<darix>
row = CSV::Row.new( [], [] )
<darix>
puts "1" if row == nil
<darix>
NoMethodError: undefined method `row' for nil:NilClass
Glass_saga has quit [Remote host closed the connection]
<rking>
darix: I just wanted to make sure there wasn't something before that that interfered.
<rking>
darix: This is an oddity of the implementation of CSV::Row#==. Instead just say row.nil?
Glass_saga has joined #ruby-lang
jasiek_ has left #ruby-lang [#ruby-lang]
<rking>
(That is, it's defined as: @row == other.row …so the arg you pass it cannot be nil)
<yorickpeterse>
Is it possible to show a list of required files in Ruby 1.8?
<yorickpeterse>
Ah, $LOADED_FEATURES works on 1.8 as well
<darix>
Steve-W: see rking
gsav has quit [Client Quit]
<darix>
rking: nice find
gsav_ has joined #ruby-lang
gsav_ has quit [Client Quit]
<banisterfiend>
yorickpeterse: Hey there yiruck
<rking>
darix: require'pry';binding.pry then $ row.==
<Steve-W>
rking I know, t'was my conjecture that it ought not to be (other stdlib items that override == check and work as I expected)
mytrile has joined #ruby-lang
GarethAdams|Work has quit [Changing host]
GarethAdams|Work has joined #ruby-lang
GarethAdams|Work is now known as GarethAdams
jbsan has joined #ruby-lang
davidbalber|away is now known as davidbalbert
gsav has joined #ruby-lang
sent-hil has joined #ruby-lang
davidbalbert is now known as davidbalber|away
Assurbanipal has quit [Quit: Konversation terminated!]
mercwithamouth has joined #ruby-lang
chimkan_ has joined #ruby-lang
jbsan has quit [Quit: jbsan]
methods has joined #ruby-lang
slyphon has joined #ruby-lang
jtoy has joined #ruby-lang
<jtoy>
i am trying to find all strings that are not substrings of others from array a, what am I doing wrong here: a=%w[a ab abc d]; b= a.reject{|x| a.detect{|xx| x.match(/^#{xx}/) } };puts b
<jtoy>
I am trying to get back abc and d
davidbalber|away is now known as davidbalbert
jbsan has joined #ruby-lang
davidbalbert is now known as davidbalber|away
davidbalber|away is now known as davidbalbert
<judofyr>
jtoy: it matches against itself
<rking>
jtoy: Well, you never refer to 'x'
<judofyr>
rking: he does. x.match
<rking>
Oops haha
<judofyr>
rking: you need to add a x != xx
<judofyr>
err
<judofyr>
jtoy: ^
<jtoy>
judofyr: doh
enebo has joined #ruby-lang
<rking>
jtoy: Well, what should %w(aa ab aa) return?
<jtoy>
hmm, this is not right either though: a=%w[a ab abc d]; b= a.reject{|x| a.detect{|xx| x != xx && x.match(/^#{xx}/) } };puts b => [a,d]
<jtoy>
rking: I think aa and ab
<jtoy>
the list will be unique if that helps
<judofyr>
jtoy: xx.match(/^#{x}/)
<jtoy>
judofyr: yes!
cirenyc has joined #ruby-lang
<jtoy>
thanks
<masterkorp>
Guys, I have a series of object members in strings. How can i know if the class has that attribute name ?
gnufied has quit [Quit: Leaving.]
Swimming_Bird has joined #ruby-lang
waffleau_ has quit [Quit: waffleau_]
leopard_me has quit [Quit: Computer has gone to sleep.]
methods has quit [Quit: Leaving.]
methods has joined #ruby-lang
mytrile has quit [Remote host closed the connection]
davidbalbert is now known as davidbalber|away
s1n4 has quit [Quit: leaving]
sepp2k has quit [Quit: Leaving.]
<judofyr>
masterkorp: hm? what class?
<judofyr>
masterkorp: you can check: klass.method_defined?("foo=")
gnufied has joined #ruby-lang
<masterkorp>
basically i have a class with a shitload of attributes
<banisterfiend>
masterkorp: by 'attribute' you mean instance variable? or attr_accessor generated methods?
<masterkorp>
attr_acessor
<banisterfiend>
then do what judofyr said
<masterkorp>
yeah and then how can use it without hard coding
apeiros_ has quit [Remote host closed the connection]
<sent-hil>
can i use capybara without rspec/cucumber?
<judofyr>
sent-hil: yes
marr has quit [Ping timeout: 264 seconds]
<judofyr>
sent-hil: `include Capybara::DSL`
<judofyr>
sent-hil: then do Capybara.reset_sessions! and Capybara.use_default_driver when you want to reset it
<judofyr>
sent-hil: I think must of the things will just work then
<zzak>
judofyr: omg quit spamming <3
<judofyr>
zzak: huh?
<sent-hil>
judofyr: that's what i've been doing, thought it seems antipattern to use capybara outside rspec, wondering if i should just use selenium directly
<judofyr>
sent-hil: I've only been using it inside Test::Unit
Edwan has joined #ruby-lang
<zzak>
judofyr: banned
<judofyr>
zzak: waat?
<zzak>
i seemed to have exceeded my daily limit on coffee
<andrewvos>
zzak: Me too man. Getting the too much coffee paranoia
sepp2k has joined #ruby-lang
<andrewvos>
sent-hil: An anti-pattern to use it outside of rspec? What?
<andrewvos>
sent-hil: Please elaborate.
<sent-hil>
andrewvos: outside a testing framework
ruurd has quit [Quit: Leaving...]
methods has joined #ruby-lang
swav has quit [Read error: Connection reset by peer]
tenderlove has joined #ruby-lang
swav has joined #ruby-lang
methods2 has joined #ruby-lang
methods has quit [Read error: Connection reset by peer]
znowi has joined #ruby-lang
andrewvos has quit [Ping timeout: 240 seconds]
andrewvos has joined #ruby-lang
methods1 has quit [Read error: Connection reset by peer]
methods2 has quit [Read error: Connection reset by peer]
jxie has quit [Ping timeout: 240 seconds]
ozzloy has quit [Ping timeout: 248 seconds]
mercwithamouth has quit [Ping timeout: 264 seconds]
agnitio has quit [Ping timeout: 265 seconds]
foucist has quit [Remote host closed the connection]
sent-hil has quit [Remote host closed the connection]
mrsolo has joined #ruby-lang
mwjcomputing has quit [Quit: Leaving]
luikore has quit [Ping timeout: 252 seconds]
mindbender1 has quit [Ping timeout: 252 seconds]
headius has joined #ruby-lang
tdy has quit [Ping timeout: 264 seconds]
tdy has joined #ruby-lang
sent-hil has joined #ruby-lang
dankest has joined #ruby-lang
workmad3 has quit [Ping timeout: 255 seconds]
Uranio has quit [Quit: WeeChat 0.3.8]
dr_bob has left #ruby-lang [#ruby-lang]
cultureulterior_ has quit [Quit: cultureulterior_]
brianpWins_ has joined #ruby-lang
chrisbislr has joined #ruby-lang
brianpWins has quit [Read error: Connection reset by peer]
brianpWins_ is now known as brianpWins
gregmore_ has joined #ruby-lang
davidbalber|away is now known as davidbalbert
sn0wb1rd has quit [Quit: sn0wb1rd]
heftig has quit [Quit: leaving]
gregmoreno has quit [Ping timeout: 265 seconds]
cirenyc has joined #ruby-lang
davidbalbert is now known as davidbalber|away
<crankharder>
need {:foo=>{:bar=>{:asdf=>123}}}.foo => [:foo, :bar, :asdf, 123]. thoughts?
<crankharder>
where Hash#foo is some method that 'flattens' the hash
retro|cz has quit [Ping timeout: 244 seconds]
methods1 has left #ruby-lang [#ruby-lang]
lushious has joined #ruby-lang
davidbalber|away is now known as davidbalbert
sn0wb1rd has joined #ruby-lang
eydaimon has joined #ruby-lang
mwjcomputing has joined #ruby-lang
wallerdev has joined #ruby-lang
<rking>
crankharder: I'd not assume that a terse way exists, and personally would define Object#recursive_flatten to return self + Hash#recursive_flatten to flatten its level and recurse
<rking>
banisterfiend: I doubt it ever worked for REPL def's
<banisterfiend>
rking: hm ok, weird if that's true
mindbender1 has joined #ruby-lang
mindbender1 has quit [Max SendQ exceeded]
tamash has quit [Quit: ChatZilla 0.9.89 [Firefox 17.0.1/20121128204232]]
mindbender1 has joined #ruby-lang
mindbender1 has quit [Max SendQ exceeded]
heftig has joined #ruby-lang
sent-hil has quit [Remote host closed the connection]
mindbender1 has joined #ruby-lang
mindbender1 has quit [Max SendQ exceeded]
sent-hil has joined #ruby-lang
ebouchut has joined #ruby-lang
mindbender1 has joined #ruby-lang
mindbender1 has quit [Max SendQ exceeded]
swav has joined #ruby-lang
mindbender1 has joined #ruby-lang
BlaXpirit has left #ruby-lang ["Quit Konversation"]
mindbender1 has quit [Max SendQ exceeded]
havenn has quit [Remote host closed the connection]
mindbender1 has joined #ruby-lang
sent-hil has quit [Remote host closed the connection]
mindbender1 has quit [Max SendQ exceeded]
mindbender1 has joined #ruby-lang
mindbender1 has quit [Max SendQ exceeded]
[dmp] has joined #ruby-lang
mindbender1 has joined #ruby-lang
mindbender1 has quit [Max SendQ exceeded]
mindbender1 has joined #ruby-lang
areil has quit [Remote host closed the connection]
mindbender1 has quit [Max SendQ exceeded]
mindbender1 has joined #ruby-lang
mindbender1 has quit [Max SendQ exceeded]
krohrbaugh has quit [Quit: Leaving.]
mindbender1 has joined #ruby-lang
mindbender1 has quit [Max SendQ exceeded]
mindbender1 has joined #ruby-lang
mindbender1 has quit [Max SendQ exceeded]
krohrbaugh has joined #ruby-lang
macmartine has joined #ruby-lang
<imperator>
rking, wtf did i just watch?
mindbender1 has joined #ruby-lang
<rking>
imperator: AFAIK it was an ad agency doing a demo
srbaker has joined #ruby-lang
Mon_Ouie has joined #ruby-lang
wallerdev has joined #ruby-lang
gaveen has quit [Ping timeout: 246 seconds]
guns has joined #ruby-lang
<cout>
rking: double yew tee eff.
<rking>
=D
agr__ has joined #ruby-lang
ruurd has joined #ruby-lang
cored has joined #ruby-lang
cored has quit [Changing host]
cored has joined #ruby-lang
kurko_ has quit [Ping timeout: 252 seconds]
agr__ has quit [Quit: Page closed]
crudson has joined #ruby-lang
gaveen has joined #ruby-lang
Swimming_Bird has quit [Quit: Computer has gone to sleep.]
ebouchut has quit [Quit: This computer has gone to sleep]
jtoy has joined #ruby-lang
tenderlove has quit [Remote host closed the connection]
schaerli has quit [Remote host closed the connection]
wnd has quit [Excess Flood]
havenn has joined #ruby-lang
wnd has joined #ruby-lang
havenn has quit [Remote host closed the connection]
havenn has joined #ruby-lang
<yorickpeterse>
is it possible to add platform specific dependencies in a Gemspec?
<tbuehlmann>
yorickpeterse, you can something like `gem "weakling", :platforms => :jruby`
<tbuehlmann>
do you mean that?
<yorickpeterse>
That's for Bundler, not Rubygems
<yorickpeterse>
Does Bundler actually have anything to do that but for operating systems?
<tbuehlmann>
ah, righty
<yorickpeterse>
e.g. `gem :foo, :os => :osx`?
<yorickpeterse>
I kinda need both
jbald has joined #ruby-lang
RickHull has joined #ruby-lang
RickHull has quit [Changing host]
RickHull has joined #ruby-lang
imperator has quit [Quit: This computer has gone to sleep]
MaddinXx has joined #ruby-lang
erichmenge has left #ruby-lang [#ruby-lang]
<rking>
yorickpeterse: The thing is, bundler only makes a single Gemfile.lock for a given configuration
erichmenge has joined #ruby-lang
<rking>
yorickpeterse: So you can definitely check RUBY_PLATFORM in your Gemfile, but you'll have to generate plural things, like Gemfile.lock.osx + Gemfile.lock.lnx
<yorickpeterse>
hm
jbald has quit [Quit: jbald]
swav has quit [Remote host closed the connection]
artOfWar has joined #ruby-lang
vlad_starkov has joined #ruby-lang
artOfWar has quit [Remote host closed the connection]
sent-hil has joined #ruby-lang
tbuehlmann has quit [Remote host closed the connection]
_sillymarketing has joined #ruby-lang
_sillymarketing has left #ruby-lang [#ruby-lang]
_sillymarkets has joined #ruby-lang
postmodern has joined #ruby-lang
<_sillymarkets>
alo
<_sillymarkets>
is anyone good with "diffy" or using diff in ruby ?
<postmodern>
_sillymarkets, you probably want to use diff-lcs
MaddinXx has quit [Remote host closed the connection]
<_sillymarkets>
hm, okay... looking into it now
postmodern has quit [Client Quit]
<whitequark>
yorickpeterse: there's a hack... you do :require => ('file' if RUBY_PLATFORM =~ /linux/)
<whitequark>
but it doesn't work with all gems
<yorickpeterse>
That's what I currently have in the gemspec
<yorickpeterse>
There are some tests that are platform/implementation specific and require specific gems
<yorickpeterse>
but it feels dirty
<yorickpeterse>
if RUBY_PLATFORM.include?('darwin')
<yorickpeterse>
...
<yorickpeterse>
end
<yorickpeterse>
etc
<rking>
whitequark: That still only generates one Gemfile.lock
postmodern has joined #ruby-lang
kurko_ has joined #ruby-lang
<yorickpeterse>
rking: non issue, it's not tracked in the repo
<yorickpeterse>
I'm only using bundler to ease the process of installing deps
PhilCK has joined #ruby-lang
<rking>
OK, that's a much easier problem.
<rking>
What you're doing is fine.
vlad_starkov has quit [Remote host closed the connection]
ryanlecompte has quit [Ping timeout: 246 seconds]
jsilver has quit [Read error: Connection reset by peer]
ryanlecompte has joined #ruby-lang
musl has quit [Quit: WeeChat 0.3.9.2]
dankest is now known as dankest|away
burgestrand has joined #ruby-lang
workmad3 has joined #ruby-lang
wyhaines has joined #ruby-lang
PhilCK has left #ruby-lang [#ruby-lang]
<_sillymarkets>
postmodern - have any examples of diff-lcs parsing two files and highlighting differences to html ?
srbaker has quit [Quit: Computer has gone to sleep.]
<headius>
you have to release a separate gem with -java and its own list of deps
<soahccc>
Does anyone know a reference for something like this: A rack app (presumably Sinatra) with multiple workers (via unicorn) by all having access to a single shared thread (which gathers remote data). Is that even possible with unicorn workers?
<yorickpeterse>
headius: it's for testing mostly
<yorickpeterse>
there are some deps that only work on platform X so there's no point in adding them as a dev dep (and thus try to install them when running `bundle install`)
ruurd has quit [Quit: Leaving...]
willdrew has joined #ruby-lang
<yorickpeterse>
headius: While you are here, is it true that Syslog in stdlib doesn't run on jruby?
ruurd has joined #ruby-lang
ryanf has joined #ruby-lang
sabfer has joined #ruby-lang
<headius>
yorickpeterse: I think we have an FFI-based syslog that works fine
<yorickpeterse>
Does that come with the jruby stdlib? I noticed some hacks in this code that basically disable Syslog tests because I at some point found out Syslog didn't work
<yorickpeterse>
Though I'm unsure if that's still the case
<yorickpeterse>
* disables
swav has joined #ruby-lang
musl has joined #ruby-lang
sabfer has quit [Read error: Connection reset by peer]
apeiros_ has quit [Remote host closed the connection]
apeiros_ has joined #ruby-lang
swav has quit [Ping timeout: 250 seconds]
intellitech has joined #ruby-lang
Mon_Ouie has quit [Ping timeout: 240 seconds]
<whitequark>
ok folks, I promised to write an article
<whitequark>
sent-hil: cucumber, quite certainly. rspec, but some people don't consider that kind of stuff a "real" DSL.
intellitech has joined #ruby-lang
<matled>
whitequark: looks nice. I think its worth to look into the performance gains possible with this approach also on normal machines, and not only microcontrollers.
<whitequark>
sent-hil: anything embedded in a game engine. Lua, unless it's used to write standalone programs, but that's again arguable.
<whitequark>
matled: it seems for me that in the time-memory tradeoff time wins
workmad3 has joined #ruby-lang
<whitequark>
i.e. the JVM/Rubinius approach has a very strong ground and it would be very hard to compete with it
<whitequark>
after all, I'm pretty sure that a hypothetical version of JRuby which also optimizes code on Ruby level, apart from just using JVM optimizations, could well compete with my implementation for performance, albeit with a warm JIT and significantly higher memory usage
mjio has joined #ruby-lang
sailias has quit [Read error: No route to host]
<headius>
we can already compete with Java in cases that don't involve numerics
<whitequark>
(AFAIK JRuby already has some infrastructure for doing that kind of optimizations, but it isn't really used for doing anything interesting right now.)
<whitequark>
yup
<whitequark>
I believe that interactive, GUI apps could get some gains from a non-JIT approach; you could see that in ObjC
<whitequark>
ObjC method dispatch basically has the same semantics as Ruby one does, but instead of caching methods at a call site ObjC caches methods in the classes
<sent-hil>
whitequark: cool, thx
savage- has quit [Remote host closed the connection]
<whitequark>
i.e. in JRuby a method call might incur 1 instruction of overhead or even be inlined, but that comes after a long time the JIT will warm up, whereas in ObjC there is around 60 instructions of overhead, but it settles on those 60 instructions right after the first invocation
<headius>
jruby caches methods at the call site *and* in the classes :)
slyphon has quit [Ping timeout: 245 seconds]
<whitequark>
what's even better is that ObjC caching consumes very little memory compared to what a JIT commonly has, doesn't depend on a call site being (mostly) monomorphic, and doesn't require an incredibly complex runtime
<whitequark>
MacRuby works this way, and it's pretty good. I've actually considered writing such an implementation, but I've done some research and it seems that there is very little market for such a product.
<whitequark>
so, I decided to focus on embedded instead, where nothing similar exists. C++ has similar feature and performance characteristics to what I'm proposing, but it also includes a thousand and one way to shoot yourself in the leg.
dankest|away is now known as dankest
<yorickpeterse>
So does this actually run as Ruby or does it compile down to X
<whitequark>
headius: that's pretty good, but I'm still wary of Java method call overhead there
<whitequark>
yorickpeterse: "this" as in what?
<yorickpeterse>
Your Ruby implementation
PhilCK has joined #ruby-lang
<whitequark>
yorickpeterse: no, it's not Ruby. For example, there is no way to compile `pry'. That's by design.
<yorickpeterse>
or language would be a better name
<whitequark>
It's basically a language and runtime which use Ruby as a DSL to define another program, which itself gets compiled to native code.
<whitequark>
there's no way you could fit a "proper" ruby in 8K, or maybe 512B of RAM. just no.
<yorickpeterse>
heh
wardrop has joined #ruby-lang
<whitequark>
yeah, arduino is a possible target. I consider it as a toy, but hey, people play with toys before getting serious.
<yorickpeterse>
would be nice for it to become a viable alternative to Lua at some point
<yorickpeterse>
or at least something in that direction
ryanlecompte has joined #ruby-lang
<firefux>
Lua is still much smaller thatn mRuby
<headius>
macruby's quite a bit slower than the other impls at this point
<headius>
except for specific things
<headius>
I don't know about rubymotion
<whitequark>
well, the obvious huge disadvantage of the ObjC way is that you can't optimize anything.
<whitequark>
so you can use it as a high-level specification of how your program should work, and complement it with actual low-level implementations of basic actions
<whitequark>
like drawing on screen or working with bitmaps, or whatever
<whitequark>
ObjC has that for free because it includes C. MacRuby has that for free because it links with ObjC runtime and ObjC code.
<headius>
it's not not quite as fluid to drop to C from MacRuby
<headius>
er, it's just not
<headius>
so that's a down side of using macruby instead of objc I've seen people report
<whitequark>
but yeah, on its own grounds it's not a very good idea. again, I've only considered doing it to link Qt inside and distribute it as a nice complete package for doing GUIs in Ruby
<RickHull>
qq, is the general sense of "bitmap" anything that uses individual bits as flags? and the windows bitmap image format -- wouldn't it be more properly described as bytemap?
<whitequark>
(ever tried to distribute ruby-gtk or ruby-qt apps? I did, and I'd rather drink acid or something. It's just horrible.)
<whitequark>
RickHull: hysterical raisins
<RickHull>
eh? non sequitur?
<whitequark>
"historical reasons" :)
<yorickpeterse>
headius: while you're here, does jruby exposes the jruby parser using a Ruby API? If so, where can I find info on it?
<headius>
yorickpeterse: we don't expose a separate API, but it's all just objects
<whitequark>
RickHull: early on, those bitmaps were actually bitmaps due to being b&w.
<RickHull>
oh right
<headius>
you can access our AST from Ruby by calling the JRuby Java APIs
<RickHull>
yeah, makes sense
<headius>
or better would be to use the jrubyparser project's parser and AST…it's a richer AST
<yorickpeterse>
What the hell, jruby has ripper?
<yorickpeterse>
hmmm
<zenspider>
headius: hey... while you're here...
<yorickpeterse>
"the `ripper' lib is not supported on JRuby" hrmpf
<zenspider>
headius: I've got reports that minitest tests fail on jruby. probably the same type of stuff as last time (mock seeing internal calls)
<zenspider>
headius: you guys ship with minitest, yes?
<rking>
zenspider: Do you have any interest in minitest-spork and guard-minitest ?
<zenspider>
rking: interest in what sense?
davidbalber|away is now known as davidbalbert
charliesome has joined #ruby-lang
<rking>
zenspider: Well, I was hoping maybe you would throw your opinion on a particular deadlocked issue. guard-minitest sends args that minitest-spork can't handle, so the whole system is borked.
<headius>
zenspider: we ship with whatever's current 1.9.3 stdlib minitest, yes
<headius>
yorickpeterse: we don't have ripper yet, but enebo thinks he can add it
Sambalero has joined #ruby-lang
<headius>
matter of time and resources
<zenspider>
headius: including the minitest tests?
<zenspider>
hrm... I wonder why they fail now.
<headius>
we don't ship any tests in our dist
<zenspider>
no, not ship. but use.
<yorickpeterse>
headius: hm, does the jruby parser allow you to define your own AST in similar fashion to Ripper?
<zenspider>
rking: using guard and spork at the same time? aren't they basically the same thing?
<rking>
zenspider: Nope, rather orthogonal. Spork's role is to keep a long-running process of the parts that aren't changing (like Rails itself) but forking and running the tests after that
<headius>
yorickpeterse: the jruby parser presents you with our Ruby AST
<headius>
zenspider: oh sure…we use minitest + excludes to run MRI's suite
<headius>
in CI
<rking>
Guard is a file-change watcher that decides to run certain tests depending on a DSL that maps Test ↔ Implementation files.
<zenspider>
headius: huh.
<yorickpeterse>
headius: The reason for it is because I'll need to change the AST so it's in a uniform format similar to other parsers I plan on using (in this case Ripper on MRI)
<rking>
(Well, Guard is more general, but in the case of guard-minitest that's what it does)
<zenspider>
rking: oh. I thought spork also had file monitoring
<rking>
zenspider: Nope. Both Spork and Guard are pretty simple, actually.
PhilCK has left #ruby-lang [#ruby-lang]
<rking>
zenspider: BTW, before I bother, would you consider a patch to minitest/mock for a .multi_stub method so you don't have to nest 3 or 4 blocks to get 3 or 4 stubs?
<headius>
ok
<headius>
zenspider: hmm
<headius>
some of those look like the same mocking bug
<headius>
and it's running against 1.7.0, so that's not surprising I guess
<headius>
1.7.1 has the fix for that
<headius>
dunno about the others
willdrew has quit [Remote host closed the connection]
BigFatFatty has joined #ruby-lang
BigFatFatty has left #ruby-lang [#ruby-lang]
slaytanic has quit [Read error: Connection reset by peer]
slaytani1 has joined #ruby-lang
slaytani1 is now known as slaytanic
intellitech has quit [Quit: intellitech]
intellitech has joined #ruby-lang
adambeynon has joined #ruby-lang
davidbalbert is now known as davidbalber|away
dankest has joined #ruby-lang
ruurd has quit [Quit: Leaving...]
davidbalber|away is now known as davidbalbert
slyphon has joined #ruby-lang
<zenspider>
headius: ok. I won't care then. thanks.
<zenspider>
rking: yeah. I'd consider it
<rking>
zenspider: K. I'll tinker with it to see if there's a decent API possible. One issue I'm not sure about is if it should only apply to one class, or that it would operate on several somehow, or that it would work with either, somehow.
<whitequark>
>It has been reported that this specification has severe security concerns
runeb has quit [Ping timeout: 252 seconds]
<zenspider>
I'm only 18th on contributions... but 11th on deletions! :P
mjio has joined #ruby-lang
sent-hil has joined #ruby-lang
ttilley has joined #ruby-lang
solars has quit [Ping timeout: 260 seconds]
<zzak>
nice, i am #19 for both.. drbrain is top 5 for both
<zzak>
only like 40 more commits and i will beat you :D
<zenspider>
rking: "Spork-testunit parsed all options itself and did not pass them to MiniTest. I don't want that. I want all options to be passed through to MiniTest Unit runner and let it interpret them. This is a feature."
<RickHull>
i wonder if you could have a reliable metric for e.g. "replaced 100 LOC with 10"
<zenspider>
I think that's the crux of the issue, no?
<RickHull>
so long as you "trust" the deleter's judgment, i'd say deletions is the best metric
<zenspider>
you'd have to do something like flog instead, or even jsut plain AST node counts
<RickHull>
best *simple* metric
<rking>
zenspider: Right. It's a deadlock. The guard-spork guy isn't accepting the (perfectly sensible, IMO) pull req to remove the explicit default_runner.rb thing, and then that quote you pasted prevents the other side from handling that.
<zenspider>
I can go delete all the rdoc and get LOTS of points for deletions :P
<RickHull>
might cost you some trust
setmeaway2 has joined #ruby-lang
sent-hil has quit [Remote host closed the connection]