<senoralastair>
BraddPitt: ahh. that looks like it's what I'm after
<senoralastair>
shevy: is that Object#send you're talking about? I've just pulled up the docs on it. I've read about it briefly before, but have not yet had a chance to use & learn it
<shevy>
senoralastair if there is an attr-method for it yes
<Aeyrix>
dorei: I believe trying that caused the application to hang. I'll give it a shot.
startupality has quit [Quit: startupality]
<shevy>
senoralastair note that in the last case, the foo.send :foo could become: foo.send your_variable_here.to_sym
<shevy>
in your case what you had stored in the array = [ 'name', 'age' ]
<shevy>
btw you can write it shorter as: array = %w( name age )
<senoralastair>
shevy: ahhhh. that's really cool.
<shevy>
you can also use .instance_variable_get() I think
<shevy>
but I love .send
<senoralastair>
shevy: Yeah, both options look like they'll fit the bill. I'll document both in my notes and I'm sure they'll both be really handy to know. I think I've come across 2 instances in the last 2 days where I could use one of these two. :-)
otisZart has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Lucky__ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Kallis has quit [Read error: Connection reset by peer]
<Burgestr_>
Aeyrix: you found yourself a nice little problem there.
chipotle has joined #ruby
<Aeyrix>
Burgestr_: yeah
<Burgestr_>
Aeyrix: if I've read everything correct you cannot unlink the file in your response block at all, because the file is not really read before your block finishes.
<Aeyrix>
ye
Burgestr_ is now known as Burgestrand
<shevy>
senoralastair \o/ it may become much cooler lateron when you generate some methods dynamically
<drbrain>
Burgestrand: I think only on windows
northfurr has joined #ruby
rehat has quit [Remote host closed the connection]
tcrypt has quit [Ping timeout: 245 seconds]
<Burgestrand>
drbrain: I haven't seen anything platform-specific in either Sinatra::Base#send_file or Rack::File
<Aeyrix>
It's not platform-specific.
<Aeyrix>
This happens on Unix.
<Aeyrix>
I run it on Debian, and test it on OS X.
bluOxigen has joined #ruby
<drbrain>
Aeyrix: this should use Tempfile with a block to avoid leaving file descriptors around if there are exceptions
blueOxigen has quit [Ping timeout: 246 seconds]
RegulationD has joined #ruby
<Burgestrand>
To me it looks like Rack::File simply responds to #each, and opens the file once the underlying rack handler starts reading the response (which could happen at some arbitrary time later).
<drbrain>
Aeyrix: yeah, use Tempfile with a block to get #42 to execute
<senoralastair>
shevy: Yeah. I'm at the beginning of my ruby journey, but really enjoying how cool it is. Now that you've reminded me, I think it was in dynamic methods that I had read about send()
<shevy>
senoralastair yeah, just keep things simple until you really got the simple parts all right, moving to more complex things will be much easier then
<shevy>
typically for dynamic methods, one uses things such as self.instance_eval {} or .class_eval {}, and even more importantly so, define_method() {}
<drbrain>
Aeyrix: I would write `Tempfile.open(…) do |temp_file| … send_file … end`, but adding the ensure is the same
<shevy>
I don't use it in many of my projects... perhaps only ~4%
<Aeyrix>
Huh
<Aeyrix>
good point
coban2k has quit [Remote host closed the connection]
RegulationD has quit [Ping timeout: 244 seconds]
Ropeney has joined #ruby
matugm has quit [Quit: Leaving]
<drbrain>
too bad send_file doesn't accept an fd
NeverDie has quit [Ping timeout: 260 seconds]
yh_ has quit [Ping timeout: 260 seconds]
kies has joined #ruby
<Burgestrand>
Aeyrix: keep in mind that Tempfile.open will only unlink the tempfile after ruby garbage collects the Tempfile object, which may or may not happen reasonably soon.
<Burgestrand>
i.e. File.exist?(Tempfile.open("some-prefix") { |io| io.path }) # => true
northfurr has quit [Ping timeout: 246 seconds]
northfurr has joined #ruby
sdwrage has quit [Quit: This computer has gone to sleep]
<Burgestrand>
drbrain: I still haven't found any windows-specific thing in here, would you happen to know where that code would reside? Is it inside Rack?
<Aeyrix>
Burgestrand: Basically
<Aeyrix>
I'm writing to a temp-file
<Aeyrix>
on the fly
<Aeyrix>
as you can see
<Aeyrix>
which means I need to call @temp_file.close
<Aeyrix>
Ignore line 16, I used that to get the folder dir to check clearing on OS X
<Burgestrand>
Aeyrix: this is because of what I just wrote, it won't unlink the file, it will only close it.
<drbrain>
Aeyrix: as Burgestrand pointed out, you'll want to close! in an ensure after send_file
<Burgestrand>
drbrain: … :(
<Aeyrix>
Burgestrand: But terminating the process would call garbage collection, right?
sdwrage has joined #ruby
<Burgestrand>
Aeyrix: terminating it cleanly, sure.
<drbrain>
↑ yes
<Aeyrix>
Burgestrand: SIGQUIT, not SIGKILL
<Aeyrix>
Burgestrand: It doesn't.
<Aeyrix>
Those files are still there after being terminated.
<drbrain>
(I prefer libraries that let me hand an fd over since I can unlink from the start)
<Aeyrix>
Sorry, SIGINT, not SIGQUIT.
failshell has joined #ruby
<Aeyrix>
Yep, confirmed still there.
<Aeyrix>
:\
<Burgestrand>
I feel like half of what I'm saying is gone out the window.
<Aeyrix>
Your recommendation is the Reaper middleware then?
<Aeyrix>
I was hoping I wouldn't need to fit forty parts together to get a simple file drop working with Sinatra tbh.
<Burgestrand>
Aeyrix: from what I can read in the sinatra/rack source, it's the *only* solution because you're using send_file, unless you want to hand-roll it.
<Burgestrand>
I'll verify it, give me a minute or two.
<Aeyrix>
`after`?
B1n4r10 has quit [Ping timeout: 246 seconds]
[H]unt3r has quit [Quit: Leaving]
Inside has left #ruby ["Leaving"]
<drbrain>
Tempfile.open(…) do |temp_file| begin … send_file … ensure temp_file.close! end end
<Aeyrix>
drbrain: That was my original code.
<Aeyrix>
It won't work because of the way Sinatra is delegating responses.
<darix>
drbrain: wouldnt the block close tempfile anyway?
fella6s has quit [Read error: Connection reset by peer]
<Aeyrix>
It closes it, but doesn't unlink it.
<Aeyrix>
Unless you do temp_file.close(true)
<drbrain>
darix: no, Burgestrand pointed out that it only unlinks during GC
<Aeyrix>
^
<drbrain>
↑
hashrocket has joined #ruby
<Aeyrix>
But I confirmed that the GC isn't clearing these tempfiles.
<Aeyrix>
w e i r d
baweaver_ has quit [Read error: Connection reset by peer]
<Burgestrand>
Tempfile.open() {} will close the file, but won't unlink it. Once the object is garbage collected, the finalizer will unlink it. I'm not positive that it will be GCd on process exit.
<darix>
drbrain: seems weird
<drbrain>
darix: yeah, which is why it would be nice if you could hand send_file an opened IO
<Aeyrix>
^'
<Aeyrix>
That's what I wanted to try instead.
<Aeyrix>
It's a base64 encoded file unless it's text.
<Aeyrix>
Then it's, well, just text.
<Aeyrix>
Oh wait I changed that, it's always b64.
<drbrain>
then you could Tempfile.open do |temp_file| temp_file.unlink; …; send_file temp_file end
allcentury has joined #ruby
<darix>
lighty has x-send-tempfile
EllisTAA has quit [Quit: EllisTAA]
<darix>
then you could leave it to the webserver
<Aeyrix>
>lighty
<Aeyrix>
>2015
<Aeyrix>
People still use that in good conscience?
jenrzzz has joined #ruby
Lucky__ has joined #ruby
<darix>
Aeyrix: we even still develop it!
<Aeyrix>
lmao
<Aeyrix>
Why?
<darix>
because we can
<Aeyrix>
Fair enough I guess.
hotpancakes has quit [Remote host closed the connection]
<darix>
and lighty 2 has a few really nice features
<darix>
like vhost map
bronson has joined #ruby
shakes has joined #ruby
yxhuvud has quit [Ping timeout: 244 seconds]
lampshades has joined #ruby
monoprotic has joined #ruby
hotpancakes has joined #ruby
oo_ has joined #ruby
<Burgestrand>
Aeyrix: alright, I've verified it, at least on my machine (Mac OS), if you unlink the file *anywhere* in your response handler block, the downloaded file will be empty.
<Aeyrix>
Yep.
hashrocket has quit [Ping timeout: 244 seconds]
<Burgestrand>
Aeyrix: in short, you cannot unlink the file right then and there, you must use the Reaper.
omegamike has joined #ruby
kies has quit [Ping timeout: 250 seconds]
<darix>
Burgestrand: is send_file using the x-sendfile feature ?
Rixius has quit [Ping timeout: 260 seconds]
michael_mbp has quit [Excess Flood]
nofxx has quit [Ping timeout: 245 seconds]
lampshad_ has joined #ruby
nofxx has joined #ruby
nofxx has joined #ruby
nofxx has quit [Changing host]
lady_valenz has joined #ruby
<darix>
X-Accel* in nginx
rehat has joined #ruby
Rixius has joined #ruby
<Burgestrand>
Aeyrix: the Reaper sounds scarier than what it is. The rack specification says that if the response body responds to #close, it will be called. The reaper exploits this by sending a "fake" body, that delegates to the real body, except when #close is called on this fake body it will unlink all tempfiles it knows about. This happens once the client has downloaded the response.
<Burgestrand>
darix: I haven't seen anything related to it in the quick view of the source I took just now. I recall there's a special middleware for using X-Sendfile though.
michael_mbp has joined #ruby
marr has quit [Ping timeout: 240 seconds]
<darix>
Burgestrand: in that case the close might be called too early
snockerton has quit [Quit: Leaving.]
lampshades has quit [Ping timeout: 250 seconds]
<Burgestrand>
Yeah, assuming the underlying webserver supports X-Sendfile, I wonder if #close is still called.
<havenn>
rubie: From Regexp docs: (?<=pat) - Positive lookbehind assertion: ensures that the preceding characters match pat, but doesn't include those characters in the matched text
<rubie>
that should work thanks
tmtwd has quit [Remote host closed the connection]
<rehat>
Having trouble reading ruby docs. I am using a method open(some_url, 'wb') but I don't know where this 'wb' is? I think the method is from open-uri but I don't see that param in the docs
<rehat>
but I don't know how to find the list of modes I can use
<Hal_9000_>
well, i think it is something like modes yes
<Hal_9000_>
let me look
NeverDie has quit [Max SendQ exceeded]
hotpancakes has joined #ruby
baweaver_ has joined #ruby
ruby-lang122 has joined #ruby
<Hal_9000_>
this may be the key phrase - look under Kernel - “Otherwise, the original #open is called.”
baweave__ has joined #ruby
shred45 has joined #ruby
devbug has joined #ruby
<ruby-lang122>
Quick question, I am calling a method and I have a loop inside the method but it is not running, The method exits after one iteration. Is there some kinda rule that when you call a method it has to be called inside a loop? It should just loop inside itself until it's done I would think
<ruby-lang122>
Where would I post the code so you could look at it?
<Radar>
ruby-lang122: Show us the code please.
<Radar>
?gist
<ruboto>
https://gist.github.com - Multiple files, syntax highlighting, even automatically with matching filenames, can be edited
gix has quit [Ping timeout: 264 seconds]
<ruby-lang122>
do you need the entire code or just the method that I'm trying to loop?
<havenn>
ruby-lang122: Are you wanting to map to the new values? You're using #each not #map.
hotpancakes has quit [Ping timeout: 260 seconds]
<havenn>
ruby-lang122: There are other returns.
<ruby-lang122>
I'm just using each of the element's in the array to name the next card that's drawed
<havenn>
ruby-lang122: Take out the early returns and it won't return early.
RegulationD has joined #ruby
<ruby-lang122>
but I need them, they have purpose. This code runs perfect if it's inside the exsiting method but I took it out to clean things up and put it in it's own method
SuMo_D has quit [Quit: Off into this... Real world place...]
coban2k has joined #ruby
BTRE has quit [Quit: Leaving]
mary5030 has quit [Remote host closed the connection]
olivierrr has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<havenn>
ruby-lang122: Hard to say from what you've shown.
mary5030 has joined #ruby
havenn is now known as havenwood
RegulationD has quit [Ping timeout: 260 seconds]
baweave__ is now known as baweaver_
Torrieri has quit [Quit: Be back later ...]
baweaver has quit [Disconnected by services]
baweaver_ is now known as baweaver
baweaver_ has joined #ruby
<ruby-lang122>
I understand, But just to clear thing's up, The method should run until 1 of 3 are met, 1. They bust (go over 21) 2. Their total is equal to 21 and 3. They enter "n" to exit
<ruby-lang122>
Also I can take all of the code directly out of that method and place it back inside the method that is calling it and it works perfect. It's the fact that i put it inside it's own method and calling it that is messing things up
<miah>
seems like your network is fubar in some way
ta has quit [Remote host closed the connection]
dhjondoh has joined #ruby
RobertBirnie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
troulouliou_div2 has joined #ruby
danieli has joined #ruby
rehat has quit [Remote host closed the connection]
leat has joined #ruby
krz has joined #ruby
<Radar>
ironcamel: how did you install Ruby?
<Radar>
Is it possible to return the parent+child in these ElasticSearch queries? https://gist.github.com/radar/9f0c2c2c5c3e1d620207 For instance, I want to see both the info for "Bont Vaypor Road Cycling Shoe" as well as the variant that matched the query.
Igor2__ has joined #ruby
rubie has joined #ruby
<Radar>
I can of course make two queries (one for product and one for variant) but I was hoping someone knew the way to do only one query.
kies has quit [Ping timeout: 240 seconds]
TomyLobo has quit [Ping timeout: 260 seconds]
sbhatore has quit [Read error: Connection reset by peer]
leat has quit [Ping timeout: 246 seconds]
sinkensabe has joined #ruby
sbhatore has joined #ruby
skade has joined #ruby
weemsledeux has quit [Read error: Connection reset by peer]
charliesome has quit [Quit: zzz]
iamninja has joined #ruby
skade has quit [Quit: Computer has gone to sleep.]
charliesome has joined #ruby
charliesome has quit [Client Quit]
krz has quit [Quit: WeeChat 1.2]
k3asd` has joined #ruby
charliesome has joined #ruby
<ironcamel>
Radar: i'm using rvm. everything all of a sudden started working now
<Radar>
MAGIC
<ironcamel>
i probably was having a network hiccup
<baweaver_>
it fears Radar, and rightly so
iamninja has quit [Ping timeout: 265 seconds]
baweaver_ is now known as baweaver
hotpancakes has joined #ruby
davedev24 has joined #ruby
skade has joined #ruby
Philipp__ has joined #ruby
vdamewood has quit [Quit: Life beckons.]
greenarrow has joined #ruby
maletor has joined #ruby
hotpancakes has quit [Ping timeout: 244 seconds]
Cust0sLim3n has quit [Ping timeout: 240 seconds]
psy_ has quit [Remote host closed the connection]
niemcu has joined #ruby
leat has joined #ruby
oo_ has quit [Remote host closed the connection]
niemcu has quit [Client Quit]
RegulationD has joined #ruby
rubie has quit [Remote host closed the connection]
roolo has quit [Remote host closed the connection]
TvL2386 has quit [Ping timeout: 252 seconds]
rubie has joined #ruby
roolo has joined #ruby
<Ropeney>
radar: Was that ES stuff before for spree?
charliesome_ has joined #ruby
charliesome_ has quit [Client Quit]
charliesome_ has joined #ruby
eGGsha has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
duncannz has joined #ruby
RegulationD has quit [Ping timeout: 246 seconds]
duncannz has quit [Max SendQ exceeded]
charliesome has quit [Quit: zzz]
charliesome_ has quit [Client Quit]
charliesome has joined #ruby
ta has joined #ruby
djbkd has joined #ruby
duncannz has joined #ruby
sdwrage has quit [Quit: This computer has gone to sleep]
Cust0sLim3n has joined #ruby
krz has joined #ruby
dcarmich has joined #ruby
<certainty>
moin hackers :)
tubuliferous_ has quit [Ping timeout: 246 seconds]
Juanchito has joined #ruby
eGGsha has joined #ruby
triangles has quit [Ping timeout: 264 seconds]
oo_ has joined #ruby
baweaver has quit [Remote host closed the connection]
ecksit has joined #ruby
TvL2386 has joined #ruby
<miah>
moin
<miah>
almost bed time for me though =)
robbyoconnor has quit [Remote host closed the connection]
ndrei has joined #ruby
bronson has quit [Remote host closed the connection]
jtdoncas has joined #ruby
tubuliferous_ has joined #ruby
sameerynho has joined #ruby
robbyoconnor has joined #ruby
lxsameer_ has quit [Ping timeout: 244 seconds]
oo__ has joined #ruby
oo_ has quit [Read error: Connection reset by peer]
tubuliferous_ has quit [Ping timeout: 264 seconds]
hotpancakes has joined #ruby
Iskarlar has joined #ruby
DoubleMalt has joined #ruby
arup_r has joined #ruby
robbyoconnor has quit [Remote host closed the connection]
kp666 has quit [Remote host closed the connection]
<advorak>
https://gist.github.com/advorak/99d8067df501626c05d8 - on line 13-15, when I click an a.clickable_run_number link, the first click doesn't register (it registers an error "data = undefined") and the second and subsequent times I click a.clickable_run_number it works. Maybe I need a good night's sleep in order to troubleshoot this, but any suggestions are appreciated :-)
baweaver has quit [Remote host closed the connection]
<akjf>
can anyone define method in elegent way?
Tempesta has quit [Quit: Going offline, see ya! (( www.adiirc.com )]
<ljarvis>
advorak: this is the Ruby channel
<advorak>
oops :-)
<advorak>
thanks.
<advorak>
sorry .. wrong tab :-)
<adaedra>
akjf: what do you mean
<advorak>
that's definitely confirmation i should sleep :-)
* adaedra
throws advorak a pillow
<advorak>
thanks, adaedra ! :-)
xcesariox has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<arup_r>
and me ? :)
<hanmac>
ping shevy
<adaedra>
arup_r: sorry, that was my last one
<akjf>
define method in appropirate way?
<adaedra>
def method(param, param2)
<adaedra>
end
Oka has quit [Quit: さようなら]
<arup_r>
any way.. I am also in the incorrect channel posted it seems
<adaedra>
that's how you define a method, akjf
<adaedra>
If you have a problem, state it clearly
<ljarvis>
arup_r: I don't personally think this has anything to do with Ruby or whenever
<ljarvis>
arup_r: whenevr just writes your cron, if they're not running it's because of something else
thiagovsk has joined #ruby
<arup_r>
Yes.. I am trying to figure out what is the reason..
anisha has joined #ruby
AlphaAtom has joined #ruby
DoubleMalt has quit [Ping timeout: 260 seconds]
poguez_ has quit [Quit: Connection closed for inactivity]
postmodern has quit [Quit: Leaving]
ndrei has joined #ruby
stardiviner has joined #ruby
Violentr has joined #ruby
baroquebobcat has joined #ruby
mikecmpbll has joined #ruby
devoldmx has joined #ruby
devoldmx has quit [Read error: Connection reset by peer]
AlphaAtom has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
devoldmx has joined #ruby
sameerynho has quit [Quit: Leaving]
sameerynho has joined #ruby
mikecmpbll has quit [Read error: Connection reset by peer]
shred45 has quit [Ping timeout: 240 seconds]
jacyzon has quit [Quit: Connection closed for inactivity]
Tempesta has joined #ruby
yh_ has quit [Ping timeout: 250 seconds]
devoldmx has quit [Ping timeout: 246 seconds]
jenrzzz has quit [Ping timeout: 264 seconds]
omegamike has joined #ruby
ecksit has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
advorak has quit [Quit: This computer has gone to sleep]
maletor has quit [Quit: Computer has gone to sleep.]
jenrzzz has joined #ruby
tomphp_ has joined #ruby
symm- has quit [Ping timeout: 245 seconds]
eGGsha has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
baroquebobcat has quit [Quit: baroquebobcat]
eGGsha has joined #ruby
mikecmpbll has joined #ruby
hotpancakes has joined #ruby
Violentr has quit [Ping timeout: 240 seconds]
jackjackdripper has joined #ruby
jackjackdripper has quit [Client Quit]
eGGsha has quit [Client Quit]
eGGsha has joined #ruby
<Igor2__>
[spoiler]: ping
conor_ has joined #ruby
omegamike has quit [Ping timeout: 255 seconds]
<[spoiler]>
Igor2__: yo :)
theRoUS has quit [Ping timeout: 255 seconds]
hotpancakes has quit [Ping timeout: 255 seconds]
<Igor2__>
hi
<Igor2__>
this morning I spent some time experimenting with mruby
<Igor2__>
it was a gerat idea, tahnks again!
ferhaty has quit []
<Igor2__>
took like half an hour to hack up a workign prototype of the main featuers i'll need
<Igor2__>
getting the function name in the dispatcher is not clean, tho:
<Igor2__>
there's a self object on the argument list of the c function
troulouliou_div2 has quit [Quit: Leaving]
<Igor2__>
but that points to the object that initiated the call, so it's the caller's object, not the callee's
<Igor2__>
I didn't find any clean way to extract callee info
<Igor2__>
but I've found a hackish path through the mrb state to a stack where i could extrac my symbol ID
troulouliou_div2 has joined #ruby
<[spoiler]>
the self is the receiver of the method (function) call
<Igor2__>
so it would work, although it's a bit ugly at that part
<Igor2__>
yeah, it's called recv in vm.c
<Igor2__>
(i have no idea what a receiver is, i'm not an OOP guy)
joonty has joined #ruby
<[spoiler]>
object.method() object receives a method call (function call) method
<apeiros>
Igor2__: in my_array.first(4), my_array is the receiver (you call the method on that object)
<[spoiler]>
ok sorry for the weird naming, let me reiterate
<[spoiler]>
foo.bar() object foo receives a method call (function call) bar
<Igor2__>
clear now, thanks
<Igor2__>
i've grepped the API for callee but didn't find anything
<[spoiler]>
in C, that is like passing a pointer in the first aparameter (which is what mruby API does, except that it's the second parameter since the first one is the mrb state)
<Igor2__>
checked vm.c but i think it doesn't pass on any argument that gives me the callee name/ID cleanly
<[spoiler]>
Igor2__: actually, there's nothing that will pass that information *but* let me test something real quick
<[spoiler]>
Ah I don't have mruby installed at work, drat. Gimme a few minutes then to download it
<Igor2__>
ok, thanks in advance
bodgix has joined #ruby
ferhaty has joined #ruby
leafybas_ has quit [Remote host closed the connection]
rdark has joined #ruby
mandarinkin has joined #ruby
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
clocKwize has joined #ruby
shredding has joined #ruby
clocKwize has quit [Max SendQ exceeded]
devbug has quit [Read error: Connection reset by peer]
akjf has quit [Ping timeout: 246 seconds]
tomphp_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
rubie has quit [Ping timeout: 265 seconds]
<[spoiler]>
ok just to see ifi got it right, you need the name of the current method being called, or the method which called the method?
<[spoiler]>
if I*
tkuchiki has quit [Remote host closed the connection]
pawnbox has quit [Remote host closed the connection]
tkuchiki has joined #ruby
tkuchiki has quit [Remote host closed the connection]
tkuchiki has joined #ruby
code1o6 has quit [Read error: Connection reset by peer]
<[spoiler]>
Igor2__: vim +16 mrbgems/mruby-kernel-ext/src/kernel.c # inside mruby-1.1.0
bronson has joined #ruby
Macaveli has joined #ruby
<ruby-lang447>
How would you change two duplicate item's in an array into to separate values, here is an example https://gist.github.com/anonymous/6f863d3f24d847a46e29 this way save's both with the same value obviously, how can I change each one?
<[spoiler]>
ruby-lang447: I am not sure what you want to do
nuttermb has joined #ruby
<Igor2__>
hmm, is this a public call?
<[spoiler]>
Do you want the result to be [1, 11]?
stardiviner has quit [Ping timeout: 264 seconds]
<Igor2__>
can't seem to find it in any of the system installed headers
<ruby-lang447>
I would like to change one "A" to 1 and one "A" to 11 or both to 11 or both to 1
charliesome has joined #ruby
<[spoiler]>
Igor2__: Huh? It's part of the Kernel module (Kerbel#__method__)
Iskarlar has joined #ruby
<[spoiler]>
so it'll likely be inside mrbgems
marr has joined #ruby
<ruby-lang447>
basically the user has two choices 1 or 11 and they get to pick which value to use for the "A"'s
<[spoiler]>
ruby-lang447: ah. Just move your gets inside the map block
<[spoiler]>
and your puts, probably
<[spoiler]>
and put them inside the if body, too
<shredding>
My ubuntu crashes once in a while with Aug 10 21:54:03 tools kernel: [63481.188427] schedule[11674]: segfault at 7ffef72980e0 ip 00007f3296ed2e2f sp 00007ffef72980e0 error 6 in libruby-2.2.so.2.2.0[7f3296d3b000+263000]
<[spoiler]>
Igor2__: did you install it from the repo?
<Igor2__>
in 1.0.0, it's a static function
<Igor2__>
from debian testing
startupality has joined #ruby
<[spoiler]>
yes it should be a function
<Igor2__>
i mean it's a static function so i won't be able to call it from my project
<[spoiler]>
later it should be deined as a method: ` mrb_define_method(mrb, krn, "__method__", mrb_f_method, MRB_ARGS_NONE());`
<shredding>
apeiros: How would i update that? I thought it's the latest (the server got setup a few days ago)
<[spoiler]>
Why not? :o
<apeiros>
2.2.2 is the latest. but libruby-2.2.so.2.2.0 sounds like it was 2.2.0. wondering whether they use the ABI version number there.
<apeiros>
but can't find the .dylibs or .bundle's rvm creates. so can't compare.
<Igor2__>
[spoiler]: if that "Why not? :o" was for me: well, i'm not developing mruby, i'm developing an application that's using mruby through the public API, so i can't call any hidden internal stuff (and a static function is a hidden internal)
sdwrage has joined #ruby
<shredding>
apeiros: "ruby2.2 is already the newest version."
<[spoiler]>
Igor2__: oh okay
<shredding>
i don't use rvm.
<Igor2__>
I think my current hack sort of works
<[spoiler]>
then do `mrb_load_string(mrb, "__method__");`
<Igor2__>
hmm, checking
sideshowcoder has joined #ruby
<Igor2__>
i get empty string for that
startupality has quit [Read error: Connection reset by peer]
<[spoiler]>
Igor2__: it should return a symbol
<Igor2__>
and the symbol ID i got differs from the function symbols i registered
<[spoiler]>
bizarre; what did you get?
<Igor2__>
i got a symbol, 361
<Igor2__>
foo and foo2 are 622 and 623
<Igor2__>
i guess 361 is the caller's ID
<[spoiler]>
symbols are all integers, you need to resolve it
<Igor2__>
clear
pawnbox has joined #ruby
<Igor2__>
but i'd expect i'd see the same value
<mikecmpbll>
/join #reactjs
<Igor2__>
i mean the same ID for the same sym
<mikecmpbll>
fail.
<greenarrow>
l0l
<mikecmpbll>
rouge spaces :'(
<mikecmpbll>
rogue*
<greenarrow>
9am
<yorickpeterse>
morning
casadei has joined #ruby
<Igor2__>
<interrupt, brb>
ta has quit [Remote host closed the connection]
<TTilus>
mikecmpbll: i've got them, only trailing are rouge though ;)
pawnbox has quit [Remote host closed the connection]
<mikecmpbll>
:)
<[spoiler]>
Igor2__: (for later) can you put up the mrb specific code so I can take a look at it? I have a few ideas, but I won't be sure until I can see what's happening
zitar has joined #ruby
ndrei has quit [Remote host closed the connection]
<hanmac>
bodgix not that i know, but it looks interesting and more or less easy to build in ruby ... the only problem would be the usage of eval should avoided if possible
gregf_ has joined #ruby
hmnhf has joined #ruby
<bodgix>
hanmac: that's exactly my concern. I wouldn't want to eval a user-supplied config
stan has joined #ruby
pawnbox has joined #ruby
<irctc311>
hello i had cocoa pods installed and something was going wrong so i totally uninstalled it. anyway i was wondering what i should do if all my ruby is installed in the folder where Applications, Desktop folders are on Mac
<shevy>
I wanna sneak in a rm
<irctc311>
should i install cocoapods there too? if so how can i
quimrstorres has joined #ruby
Coldblackice has quit [Read error: Connection reset by peer]
_blizzy_ has quit [Read error: Connection reset by peer]
<Radar>
Ropeney: No, it's for my own thing
quimrstorres has quit [Remote host closed the connection]
iamninja has quit [Ping timeout: 244 seconds]
zitar has quit [Quit: Leaving]
hotpancakes has joined #ruby
arup_r has quit [Remote host closed the connection]
<MarcWeber>
Is tehre a simple dag (directed acyclic graph) library supporting multiple roots which already can create a simple text tree representation ?
<nobitanobi>
I'm using HTTParty to do POST requests - Right now I am catching HTTParty::Error, but I am concerned on other types of errors that can happen during the http connection, such as layer 4 errors. Anybody knows which exception classes should I be looking for here?
<TTilus>
bodgix: no, wait! the other way round (looked at wrong project)
rubie has joined #ruby
<bodgix>
TTilus: cucumber/bool seems more difficult to install. I think it a C library with ruby bindings
tubuliferous_ has joined #ruby
<irctc311>
hello i had cocoa pods installed and something was going wrong so i totally uninstalled it. anyway i was wondering what i should do if all my ruby is installed in the folder where Applications, Desktop folders are on Mac
zitar has joined #ruby
zitar has quit [Max SendQ exceeded]
zitar has joined #ruby
conor_ has joined #ruby
j4cknewt has quit [Remote host closed the connection]
tubuliferous_ has quit [Ping timeout: 256 seconds]
irctc311 has quit [Quit: Page closed]
yh has quit [Ping timeout: 264 seconds]
Kalov has joined #ruby
zitar has quit [Quit: Leaving]
slackbotgz has joined #ruby
leafybasil has joined #ruby
rdark has quit [Quit: leaving]
rdark has joined #ruby
pawnbox has quit [Read error: No route to host]
djbkd has joined #ruby
einarj has joined #ruby
youngbaks has joined #ruby
ndrei has quit [Ping timeout: 265 seconds]
pawnbox has joined #ruby
matcouto has joined #ruby
hoolio_ has joined #ruby
symm- has joined #ruby
astrobun_ has quit [Remote host closed the connection]
<hoolio_>
hey guys, i was wondering if i could get a hand with something. im really new too ruby :)
TheHodge has joined #ruby
AlexRussia has joined #ruby
<jhass>
?ask hoolio_
<ruboto>
hoolio_, Don't ask to ask. Just ask your question, and if anybody can help, they will likely try to do so.
einarj has quit [Ping timeout: 245 seconds]
<mandarinkin>
does string class have "shift" method ?
sectionme has joined #ruby
<jhass>
?try mandarinkin
<ruboto>
mandarinkin, Why don't you try it and see for yourself?
<ruboto>
pastebin.com loads slowly for most, has ads which are distracting and has terrible formatting.
<mandarinkin>
or similar
<shevy>
>>> "abc".shift
<ruboto>
shevy # => /tmp/execpad-30595ab21d94/source-30595ab21d94:2: syntax error, unexpected '>' ...check link for more (https://eval.in/415660)
Pupeno has joined #ruby
<shevy>
oops I failed
zenguy_pc has quit [Read error: Connection reset by peer]
<shevy>
mandarinkin String does not have .shift() method by default
<jhass>
hoolio_: let's read the error message together
<mandarinkin>
i googled
<jhass>
so first, what's the exact error message
<hoolio_>
the error is : ex3-1.rb:3: syntax error, unexpected tIDENTIFIER, expecting end-of-input puts 43 x 7
zenguy_pc has joined #ruby
<jhass>
hoolio_: so, which character in that expression would you think could be the cause for that?
yh_ has joined #ruby
<mandarinkin>
i want find simpe way transform string from '1234567' to '123567' without 4
<hoolio_>
maybe the x ?
<jhass>
hoolio_: exactly!
<jhass>
multiplication is *, x is just a variable or method name
<hoolio_>
oh ok , so x isnt the multiplication symbol ?
<hoolio_>
ohhh, i feel like a douche hahah
<jhass>
mandarinkin: .delete("4") ?
<shevy>
yeah it is not
<adaedra>
no, it's a x
<adaedra>
:v
Motoservo has quit [Ping timeout: 265 seconds]
<jhass>
hoolio_: and that's what ruby means with identifier, variable or method name
joonty has quit [Quit: joonty]
<mandarinkin>
jhass, i want move substring
khebbie has quit [Remote host closed the connection]
BTRE has joined #ruby
<jhass>
mandarinkin: provide an example that shows that then?
<hoolio_>
well thank you guys ^.^
<jhass>
?guys hoolio_
<ruboto>
hoolio_, You probably don't mean to exclude, but not everyone relates to being "one of the guys". Maybe consider using "folks", "y'all" or "everyone" instead?
<mandarinkin>
'5678' move to left on 2 position , resalt should be '125678'
<jhass>
?fake mandarinkin
<ruboto>
mandarinkin, Please show your real code to illustrate your problem. Using fake code often hides it or won't bring up the best possible solution.
startupality has joined #ruby
<Igor2__>
[spoiler]: haha, this is nice, the __method__ in mrb_load_string is always "__printstr__"
<[spoiler]>
yeah
<[spoiler]>
it makes sense though
<[spoiler]>
lol
startupality has quit [Read error: Connection reset by peer]
djbkd has quit [Remote host closed the connection]
startupality has joined #ruby
<Igor2__>
(resolving the ID i found in mrb state ->c->ci->mid brings up the right function name,tho)
arup_r has joined #ruby
Vile` has joined #ruby
<mandarinkin>
ruboto, i have string ss='22221111000' i want delete from string ss[2..3] and get new string '221111000'
<ruboto>
mandarinkin, I'm the channel bot, linker of the rules, adept of the facts, wielder of the banhammer.
<[spoiler]>
Sorry I also got distracted a bit at wok
<[spoiler]>
wok
<[spoiler]>
asdfghjkl; work"
<[spoiler]>
omg I can't even get punctuation right
sameerynho has quit [Ping timeout: 246 seconds]
joonty has joined #ruby
<jhass>
mandarinkin: "#{s[0..1]}#{s[3..-1]}"
<Igor2__>
working at a wok restaurant? lol
ta has quit [Remote host closed the connection]
<[spoiler]>
No :)
<[spoiler]>
But I wouldn't mind. I love wok food
Motoservo has joined #ruby
<yorickpeterse>
you'll think otherwise when you smell it 9 hours a day
<yorickpeterse>
or when standing in the heat 9 hours a day
<yorickpeterse>
if not longer
<[spoiler]>
yorickpeterse: point taken
ta has joined #ruby
michaeldeol has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<mandarinkin>
jhass, ss[2..3] = '' is good
sheldonh has joined #ruby
<sheldonh>
is there something i can do to get rdoc to automatically include a list of contained classes in the documentation of a module?
omegamike has joined #ruby
curses has joined #ruby
SOLDIERz has joined #ruby
<sheldonh>
or alternatively, a way to get the module to stop showing up in the "Classes and modules" list. # :nodoc: doesn't exclude the module name from that list
startupality has quit [Quit: startupality]
startupality has joined #ruby
omegamike has quit [Ping timeout: 244 seconds]
ta has quit [Remote host closed the connection]
<Igor2__>
[spoiler]: cool, this works, thanks!
jenrzzz has joined #ruby
sepp2k has joined #ruby
bruno- has joined #ruby
symm- has quit [Quit: Leaving...]
<[spoiler]>
Igor2__: woo! :)
<[spoiler]>
Igor2__: no problem
<[spoiler]>
Igor2__: I wrote it from the top of my head, so there might be a shorter approach or a macro
thang has quit [Ping timeout: 264 seconds]
djbkd has quit [Remote host closed the connection]
noethics has quit [Quit: Leaving]
thang has joined #ruby
<Igor2__>
actually I don't need anything short, rather something that won't break as versions change
sameerynho has joined #ruby
jenrzzz has quit [Ping timeout: 252 seconds]
<[spoiler]>
Igor2__: btw, there's #mruby but it is a bit dead (or was). It was me and one other person who were answering questions in there
<Igor2__>
your solution looks much more stable than my other one depending on struct internal
<Igor2__>
i see
<[spoiler]>
and most of the time we were answering eachother's questions LOL
<[spoiler]>
or trying to figure stuff out
ta has joined #ruby
<Igor2__>
cool
<Igor2__>
I think the rest will be easy
bruno- has quit [Ping timeout: 265 seconds]
<Igor2__>
maybe i won't even have further questions
<[spoiler]>
It's always better to use the API, yeah
shibly has joined #ruby
startupality has quit [Quit: startupality]
sdwrage has quit [Quit: This computer has gone to sleep]
<Igor2__>
i just need to extend the example with some args and return alues and stuff
shibly has quit [Client Quit]
<Igor2__>
btw, i like the api of mruby
k3asd` has quit [Ping timeout: 250 seconds]
<Igor2__>
in some aspects it's very similar to my libmawk API
<Igor2__>
(and it will really work with multiple script instances)
<[spoiler]>
Igor2__: for args, I warmly recommend using mrb_get_args()
<Igor2__>
thanks
nfk has joined #ruby
<[spoiler]>
if they'e being called from ruby
<Igor2__>
i think i will keep the old module too, maybe rename it to ruby18
<[spoiler]>
allows much more control and safety
skade has quit [Quit: Computer has gone to sleep.]
<[spoiler]>
mruby needs better documentation; I started working on it for myself, but the project kinda got pushed aside and so did the documentation I was writingm, but I see someone people have started addings really good docs
<Igor2__>
to be honest i can't really judge
<Igor2__>
i'm not into ruby that much to read detailed docs
<Igor2__>
i'm sort of a turist
<Igor2__>
want something simple and go into just enough details to get it solved
<Igor2__>
in mruby, there are some example code for simple things in doc/
<Igor2__>
that helped a lot
<Igor2__>
and the header is nice too
Pisuke has quit [Read error: Connection reset by peer]
ta has quit [Remote host closed the connection]
<Igor2__>
if you want to get ruby easy for turists like me, a set of smallish examples, one per feature is probably the best way
chipotle has joined #ruby
<Igor2__>
now OTL, brb
Pisuke has joined #ruby
devoldmx has joined #ruby
DoubleMalt has joined #ruby
Chau has joined #ruby
symm- has joined #ruby
ndrei has joined #ruby
khebbie has joined #ruby
closer has quit [Ping timeout: 272 seconds]
hoolio_ has quit [Ping timeout: 246 seconds]
sameerynho has quit [Ping timeout: 246 seconds]
tonios57 has joined #ruby
otisZart has joined #ruby
devoldmx has quit [Ping timeout: 255 seconds]
quimrstorres has quit [Remote host closed the connection]
oo__ has quit [Remote host closed the connection]
closer has joined #ruby
yfeldblum has quit [Ping timeout: 244 seconds]
symm- has quit [Quit: Leaving...]
einarj has joined #ruby
dionysus69 has joined #ruby
dumdedum has joined #ruby
kraljev11 has joined #ruby
pafin has joined #ruby
conor_ has quit [Remote host closed the connection]
iamninja has quit [Ping timeout: 255 seconds]
anisha has quit [Quit: Leaving]
[k- has joined #ruby
pawnbox has quit [Remote host closed the connection]
Rickmasta has joined #ruby
techsethi has quit [Ping timeout: 244 seconds]
conor_ has joined #ruby
olivierrr has joined #ruby
olivierrr has quit [Client Quit]
sameerynho has joined #ruby
alex88 has joined #ruby
techsethi has joined #ruby
Rickmasta has quit [Ping timeout: 260 seconds]
hotpancakes has joined #ruby
blackmesa has joined #ruby
oo_ has joined #ruby
<mandarinkin>
whats the best way to do something like ss[2,3,4]='*'
<mandarinkin>
ss is string
pawnbox has joined #ruby
<ljarvis>
mandarinkin: you need to do it separately
casadei has joined #ruby
<mandarinkin>
so [2,3,4].each{|ind| ss[ind]='*'}
Rinzlit1 has quit [Read error: Connection reset by peer]
<apeiros>
"MV's screen resolution is now 816x624 pixels." o0
<apeiros>
for realsies?
v0n has joined #ruby
<apeiros>
that's like 1/30 of my screen…
<hanmac>
hm its more than before ;P (and its designed to work in mobile devices too)
<workmad3>
hanmac: I wonder if opal will work in it :D
<hanmac>
hm i do not care about that one and i am still developing on my own one (or more concret on one of the dependencies of it)
<apeiros>
well, it's 1/2 of my iphone's screen size…
tkuchiki has quit [Remote host closed the connection]
startupality has joined #ruby
xaxisx_ has quit [Quit: Leaving]
krz has joined #ruby
tkuchiki has joined #ruby
<hanmac>
still working on my rwx thing (a binding for wxwidgets) ... trying to make it fail proof ... (that it doesnt crash / segfault) unnecessary what the user does input
<yorickpeterse>
heh, wx
yh_ has joined #ruby
khebbie has quit [Remote host closed the connection]
sdwrage has joined #ruby
rbennacer has joined #ruby
scripore has quit [Quit: This computer has gone to sleep]
xcesariox has joined #ruby
<hanmac>
yorickpeterse: yeah, you seems to know about it?
jokke has joined #ruby
<jokke>
hi
<jokke>
is it possible to write a threadpool with _real_ processes as workers?
tkuchiki has quit [Remote host closed the connection]
<yorickpeterse>
hanmac: I've dabbled with it in the past
<jhass>
wouldn't that be a process pool then?
<yorickpeterse>
^
<yorickpeterse>
that's called a process pool :P
<jokke>
oh
<jokke>
ok
<jokke>
sorry :D
<jokke>
so a process pool
youngbaks has quit [Quit: WeeChat 1.2]
<jhass>
but sure, just use some sort of IPC instead of Queue or whatever to distribute the workloads
<jokke>
ah ipc
<jokke>
mmh
joonty has quit [Quit: joonty]
<yorickpeterse>
Hm, surprised concurrent-ruby doesn't have a process pool
<apeiros>
somebody probably already wrote one
martinium has quit [Read error: Connection reset by peer]
<jokke>
the gem Parallel can't do this, right?
<yorickpeterse>
jhass: you can't share a Queue between processes
<apeiros>
and if not, I suggest to take a look at https://github.com/apeiros/fork - it provides forks as objects, including IPC
yh_ has quit [Ping timeout: 246 seconds]
allcentury has quit [Ping timeout: 260 seconds]
<jhass>
yorickpeterse: that's what I said, read again ;)
banister has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Ropeney has joined #ruby
<yorickpeterse>
oh heh
<jokke>
i guess it can't be helped
<yorickpeterse>
I read "or Queue"
<darix>
you could probably borrow a lot of code from things like unicorn/rainbow for it
prestorium has joined #ruby
<jokke>
since the workload comes from a lazy enumerator and the items yielded contain a lot of data
<jokke>
(which is why i made the iterator lazy)
<jokke>
or enumerator
<yorickpeterse>
jokke: can you not just use a thread pool?
joelataylor has joined #ruby
<jokke>
yorickpeterse: i'm doing image processing
<jokke>
ooh
<yorickpeterse>
you can still do that using threads
<jokke>
but they spawn own processe
<jokke>
s
<yorickpeterse>
That shouldn't be a problem
<jokke>
yeah
<jokke>
except that i'm doing a shasum in pure ruby..
<yorickpeterse>
you can still do that using threads
michael_mbp has quit [Excess Flood]
<jokke>
i sure can, but it won't be multiprocessed, right?
<jokke>
(is that a word?)
<yorickpeterse>
The workers themselves would be multi-threaded, but they can still spawn processes for whatever they need
banister has joined #ruby
<jokke>
yorickpeterse: sure, but they don't spawn a process for getting the shasum
<jokke>
and shasums are pretty expensive to compute
<jokke>
especially for big files
<jokke>
threads can only work concurrently when they're waiting for io or so
<jhass>
which you will do a lot when reading big files
joonty has joined #ruby
<yorickpeterse>
jokke: bullshit
<yorickpeterse>
On MRI there's the GIL yes, but it's not bound by just IO
paulcsmith has joined #ruby
<yorickpeterse>
And there's also Rubinius/JRuby
<jokke>
yeah
<jokke>
i'm not switching over to jruby for this :D
paulcsmith has quit [Client Quit]
michael_mbp has joined #ruby
<yorickpeterse>
MRI can interrupt threads whenever C code calls certain functions (rb_thread_check_ints() IIRC), not just when it does something with IO
<yorickpeterse>
Granted it requires code to explicitly opt-in
<yorickpeterse>
jokke: if you're dealing with C and what not, try Rubinius
terlar has joined #ruby
<yorickpeterse>
But even on MRI nothing prevents you from mixing threads and processes
Azure has joined #ruby
blackmesa has quit [Ping timeout: 252 seconds]
conor_ has quit [Remote host closed the connection]
phutchins1 has joined #ruby
arup_r has quit [Remote host closed the connection]
Philipp__ has quit [Ping timeout: 250 seconds]
matcouto has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Philipp__ has joined #ruby
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
dimasg has joined #ruby
Feyn has quit [Ping timeout: 250 seconds]
linuxboytoo has quit [Remote host closed the connection]
linuxboytoo has joined #ruby
bmurt has joined #ruby
VeganGreg has quit [Ping timeout: 240 seconds]
joonty has quit [Quit: joonty]
tubuliferous_ has joined #ruby
vt102 has quit [Ping timeout: 255 seconds]
jeremy04 has joined #ruby
linuxboytoo has quit [Ping timeout: 256 seconds]
olivierrr has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
rodferso1 has joined #ruby
khebbie has joined #ruby
pawnbox has quit [Remote host closed the connection]
blackmesa has joined #ruby
<jokke>
if i want to create a thread safe enumerator is it enough to synchronize a mutex around yielder << item ?
hotpancakes has joined #ruby
tkuchiki has joined #ruby
Iskarlar has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<jokke>
so that multiple threads can use enumerator.next
<jokke>
probably not..
vt102 has joined #ruby
Iskarlar has joined #ruby
vt102 has quit [Remote host closed the connection]
c7n has quit [Ping timeout: 246 seconds]
tubuliferous_ has quit [Ping timeout: 255 seconds]
rodfersou has quit [Ping timeout: 256 seconds]
matcouto has joined #ruby
pawnbox has joined #ruby
jeremy04 has quit [Ping timeout: 264 seconds]
senayar has joined #ruby
senayar has joined #ruby
phutchins1 has quit [Quit: WeeChat 1.1.1]
VeganGreg has joined #ruby
tkuchiki has quit [Remote host closed the connection]
victortyau has joined #ruby
davedev24 has joined #ruby
sgambino has joined #ruby
<yorickpeterse>
gist it
scripore has joined #ruby
hotpancakes has quit [Ping timeout: 255 seconds]
Ropeney has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
linuxboytoo has joined #ruby
techsethi has quit [Quit: techsethi]
OrbitalKitten has joined #ruby
hotpancakes has joined #ruby
fmcgeough has joined #ruby
sectionme has quit [Ping timeout: 260 seconds]
iamninja has quit [Read error: Connection reset by peer]
<ljarvis>
yorickpeterse: pretty sure there's a margin attribute you can use for the node, what lib are you using? I remember having to do this ages ago
dEPy has joined #ruby
<yorickpeterse>
just graphviz directly
<yorickpeterse>
That is, /usr/bin/dot basically
jenrzzz has joined #ruby
<livcd>
how should i call functions X,Y,Z,W on each element in ARRAY ? Can anyone post an example of map with composed functions ?
<yorickpeterse>
livcd: what have you tried?
Iskarlar has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
millerti has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
sdothum has quit [Read error: Connection reset by peer]
yh has joined #ruby
timanema has joined #ruby
<livcd>
yorickpeterse: iterating through array and calling the functions
jzigmund has joined #ruby
rbennacer has quit [Remote host closed the connection]
ta has quit [Remote host closed the connection]
sdothum has joined #ruby
ta has joined #ruby
khebbie has quit [Remote host closed the connection]
ferhaty has quit []
jenrzzz has quit [Ping timeout: 260 seconds]
whippythellama has joined #ruby
linuxboytoo has quit [Remote host closed the connection]
conor_ has joined #ruby
<jhass>
?code livcd
<ruboto>
livcd, We can't help you without your code, please post it to https://gist.github.com
lucianosousa has joined #ruby
<jhass>
?fake livcd
<ruboto>
livcd, Please show your real code to illustrate your problem. Using fake code often hides it or won't bring up the best possible solution.
Iskarlar has joined #ruby
casadei has joined #ruby
<apeiros>
yorickpeterse: sadist? not masochist?
<livcd>
jhass: i have no code i am just asking
ponga has joined #ruby
<jhass>
why would you ask if you have no real problem?
dented42 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<livcd>
i am curious
sdothum has quit [Read error: Connection reset by peer]
<jhass>
then my answer is that it'll become obvious once you actually encounter a real need for it
jerius has joined #ruby
dopie has quit [Quit: This computer has gone to sleep]
skade has quit [Quit: Computer has gone to sleep.]
<apeiros>
mistnim: `attr_accessor :a` essentially defines two methods for you: `def a=(value); @a = value; end` and `def a; return @a; end`
<jokke>
except for the "setting iteration plan" one
Kallis has joined #ruby
Azure has quit [Ping timeout: 260 seconds]
Kallis has quit [Max SendQ exceeded]
sshuff|gone is now known as sshuff
michael_mbp has joined #ruby
<apeiros>
jokke: so debug your call chain
joonty has quit [Quit: joonty]
<apeiros>
figure out why it never hits yielder <<
vt102 has joined #ruby
<jokke>
yeah i tried
<jokke>
with the puts at least
<jokke>
but none are called
gamename has quit []
<jokke>
i wonder why..
<apeiros>
can't do that as all I have is your code and nothing to reproduce (though, I'd be out of that anyway, too much)
<mistnim>
apeiros: ok, but why can't you use normal assignment syntax to it?
<apeiros>
mistnim: because `c.a=` is not assignment. it's a method call.
govg has quit [Ping timeout: 252 seconds]
<adaedra>
c.a = foo is the same as c.a=(foo)
<apeiros>
mistnim: the normal assignment is `@a =`, and in order to use that, you have to be in the context of the object to which the ivar belongs. e.g. in an instance method.
joonty has joined #ruby
<apeiros>
mistnim: in other words: you can't write or read instance variables from outside without going through a method call.
_blizzy_ has quit [Ping timeout: 244 seconds]
Azure has joined #ruby
<mistnim>
apeiros: ok ok, but I don't get why you wouldn't allow that
<adaedra>
because it's internal
<adaedra>
you don't want bad objects outside of yours to access your internals
<adaedra>
But there's attr_reader, attr_writer and attr_accessor to write quickly accessors
<apeiros>
mistnim: the concept is called "encapsulation"
<apeiros>
internal state must be explicitly made public, otherwise it remains internal.
hj2007 has quit [Quit: This computer has gone to sleep]
<apeiros>
it's a design decision
<apeiros>
JS e.g. does it the opposite way
<jokke>
ah
<jokke>
i see
<apeiros>
the result of this decision is that it forces you, the programmer, to plan what you reveal and what not.
<jokke>
or do i...
<jokke>
m(
<apeiros>
as a user, you can always bypass those limits, though. see instance_variable_get, _set
<apeiros>
also see instance_eval and _exec
saintcajetan has quit [Quit: Connection closed for inactivity]
quimrstorres has joined #ruby
dented42 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
casadei has joined #ruby
hotpancakes has joined #ruby
govg has joined #ruby
<jokke>
Class.new { def each; Enumerator.new { |y| y << 'hello }; end }.new.each { |foo| puts(foo) }
<adaedra>
that's cheating!
<jokke>
this doesn't work
dEPy has quit [Quit: (null)]
<jokke>
it returns an enumerator
mrtg9970 has quit [Remote host closed the connection]
rbennacer has joined #ruby
<mistnim>
apeirons: ok I guess I understand, thanks
<mistnim>
ok so you use a attr_reader because you don't want your ivar to be changed externally, but isn't it pointless when there are some ivar methods, like map!, that can actually change its value?
sarkyniin has joined #ruby
mago0 has quit [Ping timeout: 252 seconds]
haylon has joined #ruby
<adaedra>
attr_reader is just a quick way of creating accessors
<adaedra>
'ivar methods' means nothing
Porfa has joined #ruby
<adaedra>
access and modification to internal state (ivars) is done by methods on the object
jordanm has joined #ruby
Porfa has quit [Read error: Connection reset by peer]
dopamean_ has quit [Client Quit]
hinbody has joined #ruby
nfk has quit [Quit: Try memory.free_dirty_pages=true in about:config]
dopamean_ has joined #ruby
dopamean_ has quit [Client Quit]
dopamean_ has joined #ruby
skade has quit [Quit: Computer has gone to sleep.]
<apeiros>
mistnim: map! does not change an ivar. it changes an object.
<apeiros>
the concepts of object and variables are quite different.
silkfox has quit [Ping timeout: 245 seconds]
skade has joined #ruby
haxrbyte has joined #ruby
linuxboytoo has joined #ruby
Iskarlar has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<apeiros>
and to answer your question: no, the existence of mutating methods does not make it pointless.
terlar has quit [Quit: WeeChat 1.2]
freerobby has joined #ruby
stan has quit [Ping timeout: 246 seconds]
mago0 has joined #ruby
x0c0d3 has quit [Quit: Leaving]
freerobby has quit [Client Quit]
Iskarlar has joined #ruby
railsraider has joined #ruby
<shock_one>
mistnim: you use attr_reader for the same old reasons: to abstract away internal access to a variable or to have a public getter.
banister has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
skade has quit [Quit: Computer has gone to sleep.]
_lovehandle_ has joined #ruby
terlar has joined #ruby
Philipp__ has quit [Ping timeout: 246 seconds]
tmtwd has quit [Ping timeout: 245 seconds]
Zeroe_ has joined #ruby
Philipp__ has joined #ruby
<mistnim>
well, ok I have studied some basic c++ before ruby, and I am accustomed to the idea that when using only a getter, whatever you do with what you get won't influence the object state
Rutix has joined #ruby
Rutix has joined #ruby
tubuliferous_ has joined #ruby
JoshL has joined #ruby
Zeroe has quit [Ping timeout: 256 seconds]
baroquebobcat has joined #ruby
havenwood has joined #ruby
Philipp__ has quit [Remote host closed the connection]
Porfa has joined #ruby
khebbie has quit [Remote host closed the connection]
Philipp__ has joined #ruby
blackmesa has joined #ruby
Quandl has quit [Read error: Connection reset by peer]
<Porfa>
hello! I'm in need of a newbie tutorial on mechanize, i just really need to submit a form, I've learned yesterday how to navigate throughout the stuff i wanna go and mess with, but now i can't submit it, I'm missing something really simple I'm sure ( https://gist.github.com/anonymous/d200b616c9c1670d2e9c ) that's my gist.
codecop has joined #ruby
<Porfa>
would that work?
<Porfa>
i was doing this more intensively a month ago, but something happened and i had to leave :(
ta has joined #ruby
sheldonh has quit [Quit: Leaving]
tubuliferous_ has quit [Ping timeout: 246 seconds]
linuxboytoo has quit [Remote host closed the connection]
c0m0 has joined #ruby
Chau has joined #ruby
linuxboytoo has joined #ruby
<c0m0>
can use delf self.mymethod for declare a method inside my class?
RegulationD has joined #ruby
<c0m0>
sorry def self.mymethod
coban2k has quit [Remote host closed the connection]
<[k-_>
c0m0: what do you mean by "inside my class"
<[k-_>
c0m0: how do you want to call the method?
<Igor2__>
i like mrb_get_arg() so much that I'll probably implement something similar in libmawk
<c0m0>
I have a class Animal, I will show the code
haxrbyte has quit [Quit: Leaving...]
scripore has joined #ruby
blue_deref has joined #ruby
blackmesa has quit [Ping timeout: 264 seconds]
linuxboytoo has quit [Ping timeout: 240 seconds]
jpfuentes2 has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<shevy>
It has a runtime dependenciey on opal ~> 0.6.0
<shevy>
now havenwood knows who the offender is, he can unwrap his surgical toolset soon
chouhoulis has joined #ruby
<sivan1525>
The requirement is such that I need it in this form 10.000000 rather than 10.0
<adaedra>
sivan1525: where do you want it in this form?
<thermatix>
which installs active support 0.1.0
akitada has joined #ruby
RobertBirnie has joined #ruby
<shevy>
sivan1525 but look at the above example, ruby will keep it as 10.0 rather than 10.000; your only option is to compare formatted-strings then if you need more than one 0
kapowaz has joined #ruby
duoi has joined #ruby
duoi has quit [Changing host]
duoi has joined #ruby
rflot has joined #ruby
trwyth has quit [Client Quit]
<sivan1525>
there was a programming contest on hackerearth which needed in the 10.000 form
trwyth has joined #ruby
basmoura_ has quit [Remote host closed the connection]
<thermatix>
so I set opal to 0.6.0 annnd sprockets is now too high, so I downgrade sprockets to "2.12.4"
Zeroe has joined #ruby
jenrzzz has quit [Ping timeout: 246 seconds]
Guest85414______ has joined #ruby
<thermatix>
and then when I run my ruby code
<adaedra>
sivan1525: to *display* in this form, right?
<sivan1525>
there was a programming contest on hackerearth which needed in the 10.000 form as they had written test case fot it in that way and I had no control over it
<thermatix>
I get Unable to activate react.rb-0.3.0, because opal-0.8.0 conflicts with opal (~> 0.6.0), sprockets-3.2.0 conflicts with sprockets (< 3.0.0, >= 2.2.3)
basmoura has joined #ruby
jgpawletko has joined #ruby
<shevy>
yeah, the -> dependency does not allow a version difference
<shevy>
sorry
<shevy>
the ~> one
<thermatix>
so what do I do?
bove has joined #ruby
tmtwd has joined #ruby
<thermatix>
react.rb wants a lower one but one of it's dependenies wants a higher one
<adaedra>
you file an issue to the developper.
skarn has joined #ruby
<thermatix>
which developer?
<shevy>
yeah I see, the sprocket dependencies is also hardlocked in react.rb
<shevy>
can you paste the code or requirement on a pastie site?
<adaedra>
sivan1525: if it's an /output/ required, you can format to a string then display.
hotpancakes has joined #ruby
pyon-nanon has quit [Ping timeout: 246 seconds]
<shevy>
thermatix if everything fails, you could modify the .gemspec file to get rid of the hard lock dependency, but this may not work :D
dr3w has joined #ruby
<thermatix>
it's github hasn't been touched in 2 months :(
<Porfa>
can anyone hep me out submitting a form in ruby + mechanize ? I'm reading a a lot of stuff, but i need some questions answered i can't in google… for i.e., do i need to emulate a browser for me to submit a simple form, on a open site like.. google? do i need to send the data in specific formatation or i just need to change the forms values as i please and submit?
angrywombat has joined #ruby
<shevy>
thermatix 2 months is semi-ok, there are projects with +5 years no modifications!
<thermatix>
and it has numerous issues and PR's as well
startupality has joined #ruby
kevrom has joined #ruby
<angrywombat>
hey guys, i'm having trouble with running ruby in zsh
<shevy>
sivan1525 I am sure they use a method that ensures the right amount of decimal values. if you have stored things properly internally, you can format it in any way; there is no way ruby internally has a 10.000 though, it would always be a 10.0 if it is a float, so all of them must do a conversion
Iskarlar has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<jhass>
I'd guess #to_bson or something
Cache_Money has joined #ruby
tmtwd has joined #ruby
<phutchins1>
jhass: yeah i'm on bson 3.2.1 now... ah, taking a look
saddad has quit [Ping timeout: 244 seconds]
VeganGreg has quit [Quit: WeeChat 1.2]
sarkyniin has quit [Remote host closed the connection]
hotpancakes has joined #ruby
hotpancakes has quit [Remote host closed the connection]
pawnbox has quit [Remote host closed the connection]
senayar has quit [Ping timeout: 250 seconds]
prestorium has joined #ruby
Guest85 has joined #ruby
Iskarlar has joined #ruby
<sivan1525>
shevy , okay will check into making a seperate method for displaying that, thanks for looking out :)
robh71 has joined #ruby
presto has quit [Ping timeout: 256 seconds]
jerematic has joined #ruby
Pisuke has quit [Read error: Connection reset by peer]
mrtg9970 has quit [Remote host closed the connection]
nobitanobi has quit [Remote host closed the connection]
<tuor>
it's my first ruby programm. My first (more the 10 line) programm. I know bash but that's it. So pleas tell me what you would do better or so. thx. :)
diego_ar is now known as dperalta_
zitar has joined #ruby
trwyth has quit [Quit: trwyth]
<ljarvis>
tuor: your question is incredibly vague. Is there a part of your code you'd like help on? or do you actually want someone to review all of it?
techsethi has joined #ruby
bnizzle has quit [Client Quit]
dperalta has quit [Disconnected by services]
dperalta_ is now known as dperalta
bnizzle has joined #ruby
<tuor>
it's working. So review^^ I mean if someone has time. Or just review "fast". Or just how the syntax is.
towski_ has joined #ruby
<atmosx>
dorei: how's life :-)
<tuor>
It's about how to write ruby in global.
malconis_ has joined #ruby
malconis_ has quit [Remote host closed the connection]
<tuor>
ljarvis, <-
<ljarvis>
tuor: ok, I think your initialize argument spanning multiple lines is a bit ugly
senayar has quit []
malconis_ has joined #ruby
malconis has quit [Ping timeout: 260 seconds]
terlar has quit [Read error: No route to host]
zitar has quit [Client Quit]
bnizzle has left #ruby [#ruby]
devoldmx has joined #ruby
<shevy>
it makes it more readable
<ljarvis>
tuor: also, in general, constants are UPPER_CASE
bnizzle has joined #ruby
<shevy>
line 51 seems off
robh71 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
quimrstorres has quit [Remote host closed the connection]
blackmesa has quit [Ping timeout: 256 seconds]
chrissonar has quit [Remote host closed the connection]
<ljarvis>
"it makes it more readable" => "line 51 seems off" -- lol
<[k-_>
SCREAMING_UPPER_SNAKE_CASE
<shevy>
yeah
<yorickpeterse>
METAL_SNAKE_CASE
<shevy>
it's on the same indent level as the end
<[k-_>
another "admin" username as default :s
<ljarvis>
it's on the same line as the method definition
<atmosx>
tuor: I would also implement a logger to 'log' everything that is happening and use some Exception Handling to catch possible errors in a more 'graceful way' (if the code was made to be used by others in production env)
<mikecmpbll>
lol, deluge.
bnizzle has joined #ruby
<Diabolik>
undefined method `[]' for nil:NilClass
bodgix has quit [Quit: Leaving.]
<tuor>
shevy, what do you meen with: "line 51 seems off"
banister has joined #ruby
<ljarvis>
Diabolik: that's because @booking_details or the value at :appointment_information is nil
<mikecmpbll>
tuor: use the json style hash syntax for symbolic keys, too. it's way cooler.
<Diabolik>
ljarvis within the hash the value is appointment_information: {time: DateTime.now + 30.minutes}}
<tuor>
[k-_, thats the normal username when you install. So if you want to test then it works. When you use it, you give your own stuff to .new()
tjohnson has joined #ruby
<ljarvis>
Diabolik: then your ivar isn't set when you try and access it
<Diabolik>
the line before sets it :(
<atmosx>
tuor: you know, people pay for the kind of thing we're doing at your code right now :-P
riotjones has quit [Ping timeout: 246 seconds]
<mondo>
What's the easiest way to make a simple HTTP GET request in Ruby? Without a 3rd party library do I have to use net:http?
rdark has quit [Quit: leaving]
<[k-_>
tuor: i do not keep state, i do not know what you refer to
<ljarvis>
mondo: net/http or open-uri
<ljarvis>
mondo: both are in stdlib
<atmosx>
mondo: open-uri
benlieb has joined #ruby
bricker has joined #ruby
<mondo>
open-uri will do, thanks!
<tuor>
atmosx, I don't understand why not using variables. ( I wouldn't use instance variabels in teh code, I'd use attr_reader to depend on behavior not ata)
<atmosx>
tuor: because your code will be harder to maintain in the future. Any changes to that instance variable will instantly reflect to the entire program.
Coldblackice has quit [Ping timeout: 264 seconds]
<[k-_>
all in all, i do not like it
<ljarvis>
yorickpeterse: yes that's the worst part of it..
<atmosx>
[k-_: that's evil.
<tuor>
atmosx, ah ok.
<yorickpeterse>
ljarvis: haha
<[k-_>
atmosx: im not reading the whole chat, what do you mean
<yorickpeterse>
granted if I use block form everywhere it's probably a tad easier on the eyes
<yorickpeterse>
but first, train home!
pyon has joined #ruby
akosednar has joined #ruby
<ljarvis>
choo choo
<atmosx>
tuor: judging by your code, I think you're kinda ready to read this book http://www.poodr.com it will help a lot.
<atmosx>
[k-_: nadah, it was a joke about the 'I do not like it' part.
pyon has quit [Read error: Connection reset by peer]
banister has quit [Read error: Connection reset by peer]
pyon has joined #ruby
railsraider has joined #ruby
ledestin has joined #ruby
yardenbar has quit [Quit: Leaving]
kies has joined #ruby
tomme has joined #ruby
tomme has left #ruby [#ruby]
dumdedum has quit [Quit: foo]
darkf has quit [Quit: Leaving]
hanmac has joined #ruby
tubuliferous_ has joined #ruby
NeverDie has quit [Ping timeout: 272 seconds]
Alayde has joined #ruby
dperalta has quit [Remote host closed the connection]
<shevy>
Any potential pitfalls I should keep in mind when subclassing from StringIO? I am about to make some changes to an existing project in an upcoming rewrite, the main class will be the one that then subclasses from StringIO
ruby-lang528 has joined #ruby
tchebb has joined #ruby
xcesariox has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
ruby-lang528 has quit [Client Quit]
thermatix has quit [Ping timeout: 255 seconds]
tubuliferous_ has quit [Ping timeout: 240 seconds]
* tuor
will slowly go over all you wrote and thx for so much answers! Tuor will later post the changed code.
renderful has joined #ruby
finisherr has joined #ruby
pietr0 has joined #ruby
swgillespie has joined #ruby
alex88 has quit []
Zeroe has quit [Quit: Zeroe]
viki_ has quit [Ping timeout: 256 seconds]
pyon has quit [Ping timeout: 272 seconds]
mikecmpbll has quit [Ping timeout: 244 seconds]
Pisuke has quit [Read error: Connection reset by peer]
Pisuke has joined #ruby
momomomomo has quit [Quit: momomomomo]
ferhaty has joined #ruby
Synthbread has quit [Read error: Connection reset by peer]
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
josh3 has joined #ruby
jenrzzz has joined #ruby
railsraider has quit [Quit: railsraider]
freerobby has joined #ruby
jpfuentes2 has joined #ruby
pyon has joined #ruby
chouhoulis has quit [Remote host closed the connection]
chabil has joined #ruby
bronson has joined #ruby
hashrocket has joined #ruby
<TomyLobo>
raise 'hell'
hotpancakes has quit [Ping timeout: 246 seconds]
jenrzzz has quit [Ping timeout: 255 seconds]
dumdedum has joined #ruby
malconis_ has quit [Remote host closed the connection]
tomphp_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
malconis has joined #ruby
c0m0 has quit [Ping timeout: 240 seconds]
thermatix has joined #ruby
michaeldeol has joined #ruby
bronson has quit [Ping timeout: 244 seconds]
<lagweezle>
rescue ?
basmoura_ has quit [Remote host closed the connection]
tmtwd has quit [Ping timeout: 245 seconds]
basmoura has joined #ruby
dr3w has quit [Remote host closed the connection]
dr3w has joined #ruby
<suchness>
rescue FunError
<suchness>
ensure
<suchness>
Bordom.new
<suchness>
end
pyon has quit [Ping timeout: 260 seconds]
niiamon has joined #ruby
nuttermb has joined #ruby
<shevy>
Bordom hmm
<suchness>
also rescue spelling error
niiamon has quit [Remote host closed the connection]
<lagweezle>
BorDOM?
NeverDie has joined #ruby
hobodave has quit [Quit: Computer has gone to sleep.]
<TomyLobo>
go to the root of the BorDOM
jeremy04 has joined #ruby
<TomyLobo>
and delete it
hotpancakes has joined #ruby
unver has quit [Ping timeout: 264 seconds]
last_staff has joined #ruby
thermatix has quit [Ping timeout: 255 seconds]
saddad has quit [Ping timeout: 246 seconds]
j4cknewt has joined #ruby
weemsledeux has quit [Read error: Connection reset by peer]
hmnhf has quit [Ping timeout: 250 seconds]
Guest32 has joined #ruby
rakm has joined #ruby
hmnhf has joined #ruby
Violentr has joined #ruby
<suchness>
-> DOM
skade has joined #ruby
Guest32 has quit [Read error: Connection reset by peer]
skade has quit [Client Quit]
big|bad|wolf has quit []
juanpaucar has joined #ruby
rbennacer has joined #ruby
unver has joined #ruby
hj2007 has joined #ruby
quimrstorres has quit [Remote host closed the connection]
yh has quit [Ping timeout: 265 seconds]
hmnhf has quit [Read error: Connection reset by peer]
hmnhf has joined #ruby
khebbie has joined #ruby
blue_deref has joined #ruby
scripore has quit [Quit: This computer has gone to sleep]
advorak has joined #ruby
jstacks has joined #ruby
tkuchiki_ has quit [Remote host closed the connection]
<tuor>
atmosx, a logger & error handling will be a bigger task, can't do it in 5 min. So I'll do it in future. (it's on my list now)
<atmosx>
tuor: yeah :-)
psy_ has joined #ruby
Trynemjoel has quit [Ping timeout: 250 seconds]
<havenwood>
tuor: The traditional convention for constants in Ruby is SCREAMING_SNAKE_CASE (or some use CamelCase), so I'd suggest `DEFAULT_RULES` instead of `Rules_default`.
<tuor>
mikecmpbll, "18:14:54 use the json style hash syntax for symbolic keys" I don't understand what you meen.
hmnhf has quit [Client Quit]
<mikecmpbll>
tuor: { :foo => "bar" } is equivalent to { foo: "bar" }
hj2007 has joined #ruby
hmnhf has joined #ruby
<havenwood>
tuor: Putting `DEFAULT_` in front seems to read better and would group the defaults a bit.
<mikecmpbll>
the latter syntax was added as an alternative in ruby 1.9.3
Guest85 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
oxpom has joined #ruby
<mikecmpbll>
it's more succinct for hashes where the keys are symbols.
Guest85 has joined #ruby
platzhirsch has joined #ruby
<tuor>
atmosx, yes I know that people pay for checking code and I'm very grateful.
Trynemjoel has joined #ruby
<[k-_>
this is free if you use rubocop
<[k-_>
that heinous thing
dented42 has quit [Ping timeout: 244 seconds]
<tuor>
atmosx, "judging by your code, I think you're kinda ready to read this book...": I have a book about ruby basics. I'll have to read (and train) this one first. But Then I'll see (I have it in a bookmark)
<atmosx>
tuor: poodr is awesome and it's not strictly about ruby code, it's about design, which is another level of abstraction. The good thing is that uses ruby code so it's hands-on for ruby codes.
<atmosx>
s/codes/programmers
Jackneill has joined #ruby
leafybasil has quit [Remote host closed the connection]
<shevy>
EllisTAA that code is sorta confusing to me :D
<tuor>
havenwood, just forgott about this one, but why DEFAULT_RULES and not RULES_DEFAULT? I meen I just like to write names like this. So is it important which way?
<tuor>
atmosx, ah ok.
leafybasil has joined #ruby
tmtwd has joined #ruby
Zeroe has joined #ruby
<shevy>
EllisTAA where do you get nil btw? I get: 0 1 1 1 1 - btw I think break() may return nil
hobodave has quit [Quit: Computer has gone to sleep.]
<tuor>
mikecmpbll, ah ok.
<shevy>
or puts... either of them
<havenwood>
tuor: It isn't important to the computer. What are the rules default? What are the default rules?
spider-mario has joined #ruby
<EllisTAA>
shevy: i got nil in irb
<havenwood>
tuor: Which sounds right to you?
<EllisTAA>
it keeps saying i am missing a parenthses
michaeldeol has quit [Client Quit]
<tuor>
havenwood, I know that the computer doesn't care. and: RULES_DEFAULT ^^
dented42 has quit [Ping timeout: 265 seconds]
michaeldeol has joined #ruby
<havenwood>
tuor: So the rules default for how you say thing is order reverse?
quimrstorres has quit [Remote host closed the connection]
<shevy>
EllisTAA I put your code in a .rb file and it ran without error
<havenwood>
tuor: :P
michaeldeol has quit [Client Quit]
<EllisTAA>
shevy: yeah but it isn’t working, when i ask does this string have this incompatible expression, it returns nil
<tuor>
havenwood, no, but it's just about rules and there are the default ones. So the name begins with rules and default is just an aditional information about which rules. ;)
<EllisTAA>
in irb this "[)" =~ /'['/ returns SyntaxError: (irb):55: premature end of char-class: /'['/
<tuor>
But I see it's not realy logic for other people.
<tuor>
I'll think of changing it.
<EllisTAA>
and this also returns nil "[)" =~ /'\[\'/
michaeldeol has joined #ruby
leafybasil has quit [Ping timeout: 255 seconds]
<tuor>
So Thx all of you for your help! :)
finisherr has quit [Quit: finisherr]
leafybasil has joined #ruby
Burgestrand has joined #ruby
finisherr has joined #ruby
msnyon has quit [Ping timeout: 240 seconds]
Trynemjoel has quit [Ping timeout: 245 seconds]
leafybasil has quit [Remote host closed the connection]
ht__ has joined #ruby
<shevy>
EllisTAA I can not reproduce that, it works in my irb just fine as well
jhack has joined #ruby
jhack has joined #ruby
<shevy>
the code you showed does not have: "[)" =~ /'['/
jstacks has quit [Quit: Leaving...]
finisherr has quit [Client Quit]
<shevy>
[ is a special character in a regex
shock_one has quit []
<[spoiler]>
EllisTAA: you need to escape the `[`
khebbie has quit [Remote host closed the connection]
lannonbr has joined #ruby
shock_one has joined #ruby
<[spoiler]>
and there's no `'` character in "[)" so of course it will return nil, you're looking for "['"
<[spoiler]>
warning: it might get stuck in your head
Violentr has quit [Ping timeout: 244 seconds]
<TomyLobo>
oh god, weebl even made this
bodgix has quit [Quit: Leaving.]
omegamike has quit [Remote host closed the connection]
<mondo>
Anyone that uses Sublime text, is there a way to fix this issue where "#{myvar}" doesn't tab complete? so I type "#{my and hit tab, but it doesn't complete the variable name even though it's showing the autocomplete drop down
Jackneill has joined #ruby
failshell has joined #ruby
zendrix has quit []
<[spoiler]>
mondo: I switched to atom, because of issues like that in sublime
<[spoiler]>
mondo: v2 or v3? I think there's a way to fix it by downloading a better language pack
<mondo>
v3, 3083 is what im on
dumdedum has quit [Quit: foo]
troulouliou_div2 has quit [Ping timeout: 250 seconds]
josh3 has joined #ruby
<[spoiler]>
best bet would be to look for something to replace the default ruby highlighter
<[spoiler]>
which adds features
failshell has quit [Client Quit]
timanema has quit [Quit: leaving]
allcentury has quit [Ping timeout: 260 seconds]
baweaver has joined #ruby
jhack has quit [Remote host closed the connection]
trwyth has joined #ruby
<BraddPitt>
I'm loving Atom (recently switched)
dfockler has quit [Remote host closed the connection]
<c_nick>
i have ruby x64 and ruby x86 installed. x64 has bundler 1.7.4 while x86 has 1.6.3 when i try to build the project using pik use x86 bundler crashes saying fatal error in bundler please reinstall makes no sense to me
devoldmx has joined #ruby
bricker has quit [Ping timeout: 264 seconds]
suchness has quit [Ping timeout: 244 seconds]
<EllisTAA>
balls. Hired.com’s test is hard ><
<drbrain>
EllisTAA: your current code is checking whether the length of each item in check_braces is odd or even
<EllisTAA>
drbrain, should it check to see if contains the incompatible expression before it checks the length
hmnhf_ has joined #ruby
<BraddPitt>
Hired didnt give me a test
finisherr has joined #ruby
<drbrain>
you want to use /#{exp}/ then
hmnhf has quit [Ping timeout: 260 seconds]
northfurr has joined #ruby
northfurr has quit [Client Quit]
<EllisTAA>
i tried that and i tried /“#{exp}”/
leat has quit [Ping timeout: 244 seconds]
arturhoo_ has joined #ruby
<EllisTAA>
thanks for your help
arturhoo has quit [Ping timeout: 246 seconds]
arturhoo_ is now known as arturhoo
devoldmx has quit [Ping timeout: 260 seconds]
arturhoo has quit [Remote host closed the connection]
choke_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
choke has joined #ruby
blackmesa has joined #ruby
ramfjord has joined #ruby
Xiti has joined #ruby
michaeldeol has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
dr3w has quit [Ping timeout: 256 seconds]
michaeldeol has joined #ruby
bodgix has joined #ruby
kies has quit [Ping timeout: 265 seconds]
<drbrain>
EllisTAA: since you have two tasks, make two methods
<drbrain>
one to check if its incompatible
<EllisTAA>
drbrain: ah man that’s a good idea
<[spoiler]>
BraddPitt: I love Atom, but it does "choke" for and up to half a minute on big files, but once they're loaded it seems fine-ish
<drbrain>
and get that working, then do the second task in a second method
<drbrain>
then add a third method that calls each
NeverDie has quit [Max SendQ exceeded]
Burgestrand has quit []
<EllisTAA>
drbrain: failing in high pressure situations is cool, i won’t make those mistakes again
<BraddPitt>
yeah [spoiler] sadly thats still an issue
hpoydar has quit []
blackmesa has quit [Ping timeout: 272 seconds]
<[spoiler]>
BraddPitt: it was *much* worse the first time I tried it, I don't mind the few seconds, I quickly do something else in the meantime
Burgestrand has joined #ruby
finisherr has quit [Quit: finisherr]
NeverDie has joined #ruby
leafybasil has joined #ruby
finisherr has joined #ruby
MissionCritical has quit [Ping timeout: 244 seconds]
baweaver has joined #ruby
jbw_ has joined #ruby
<BraddPitt>
otherwise i really like it
sperant has joined #ruby
<c_nick>
array1 - array 2 or should i literally go array1.each {delete(x)}
keen__ has joined #ruby
<[spoiler]>
c_nick: you could use the first approach if you need to delete multiple elements
jbw has quit [Ping timeout: 250 seconds]
keen_ has quit [Ping timeout: 252 seconds]
<[spoiler]>
also a delete_if block might be more apt if the logic is more complex
benlieb has quit [Quit: benlieb]
vaedd has quit [Quit: Connection closed for inactivity]
kies has joined #ruby
hmnhf_ has quit [Read error: Connection reset by peer]
michaeldeol has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
nuttermb has quit [Ping timeout: 255 seconds]
thiagovsk has quit [Quit: Connection closed for inactivity]
trwyth has quit [Quit: trwyth]
<c_nick>
[spoiler]: one or more.. internally its doing the same thing right?
michaeldeol has joined #ruby
<[spoiler]>
c_nick: not really
<c_nick>
just operator overloading ?
<c_nick>
hmm
<[spoiler]>
`a1 - a2` is basically `a1.delete_if {|e| a2.include? e }`
lucianosousa has quit [Quit: lucianosousa]
Mission-Critical has joined #ruby
<[spoiler]>
but more optimised
<[spoiler]>
delete_if can test for more complex stuff
<nahtnam>
cball: jhass Then that leads me to a second question. Is there something like javascripts `.then()`? So I can call one function, and if its successful, then run a second method?
kadoppe has joined #ruby
msnyon has quit [Ping timeout: 245 seconds]
<nahtnam>
So each method would contain a BRE
<jhass>
Scriptonaut: try to make the method a verb and the variable a noun. tab = open_tab
<Scriptonaut>
jhass: ya, the problem is open_tab is both a noun and a verb
<Scriptonaut>
I went with tab like you said
lucianosousa has joined #ruby
<ccbn>
nahtnam: , put the BRE in a method, use a Proc for the rescue block, and after the E in the BRE, use yield to pass an optional block. I think that would work
chouhoul_ has joined #ruby
<ccbn>
If the raise condition fires, yield wont because the proc will exit from the enclosing method
chouhoulis has quit [Read error: Connection reset by peer]
<ruboto>
nahtnam, To properly use gist, please enable syntax highlighting, either by choosing the language manually or by entering a proper filename. If you post multiple things, separate them into multiple files. If you have a Github account, please update your gist with new information instead of posting a new one.
<nahtnam>
Sorry, fixed
scripore has quit [Quit: This computer has gone to sleep]
shock_one has joined #ruby
baweaver has quit [Remote host closed the connection]
hotpancakes has quit [Ping timeout: 250 seconds]
<jhass>
nahtnam: as already said, use methods
Cache_Money has joined #ruby
chouhoulis has joined #ruby
<jhass>
nahtnam: also you shouldn't rely on exceptions for something like this, try to find a check that you can use in an if / else
<jhass>
nahtnam: at least rescue the most specific exception(s) possible
<jhass>
and you got a repeating pattern there, just extract it into a method really
<nahtnam>
Yeah, will do. This is just a "first draft". The final code will be written in another language
<nahtnam>
(compiled)
JoshL has quit []
youngbaks has joined #ruby
<jhass>
ah yeah, you were the one preparing some work for the lawyers
<nahtnam>
For the record, this one doesnt have a captcha or a rate limiter
youngbaks has quit [Read error: Connection reset by peer]
DLSteve has quit [Quit: Leaving]
nfk has joined #ruby
nuttermb has quit [Ping timeout: 244 seconds]
C1V0 has joined #ruby
DLSteve has joined #ruby
chouhoul_ has quit [Ping timeout: 255 seconds]
startupality has joined #ruby
scripore has joined #ruby
<nahtnam>
Would the method look like this? https://gist.github.com/nahtnam/13068e653ed038f268e6 If so then how do I call a different method after this? If there is an exception, I want the app to exit, so i only want the next method to execute if the first is a success
<lagweezle>
open_tab being both noun and verb makes me think about 'sign up' and 'signup' and the uses of them driving me nuts with the code at work. :(
<jhass>
nahtnam: just call exit
<nahtnam>
jhass: in the rescue?
<jhass>
nahtnam: and please rescue Selenium::NoSuchElement or whatever the specific exception was, open rescue's are horrible
<jhass>
yes
<nahtnam>
kk
<nahtnam>
Will do
<nahtnam>
Thanks
dr3w has joined #ruby
startupality has quit [Client Quit]
big|bad|wolf has joined #ruby
maletor has quit [Quit: Computer has gone to sleep.]
maletor has joined #ruby
big|bad|wolf has quit [Max SendQ exceeded]
<nahtnam>
One more question
<shevy>
YOUR LAST QUESTION?
<nahtnam>
NO
<shevy>
;P
finisherr has joined #ruby
jgpawletko has quit [Quit: jgpawletko]
<nahtnam>
Is there a way I can make a "rake application" where basically its just a bunch of ruby files and just have certain commands (rake or whatever) execute them?
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
<jhack>
If i were to choose a random word from a text file i have, would it be something like this? -> File.open("text.txt", r) { |file| secret_word << file.rand }
<jhass>
doesn't sound like you need any features from rake
<jhass>
just ship a bunch of ruby scripts?
<jhass>
?try jhack
<ruboto>
jhack, Why don't you try it and see for yourself?
<nahtnam>
Well I want to compile them into a easy to use system
choke has quit [Read error: Connection reset by peer]
choke_ has joined #ruby
<jhass>
nahtnam: it's too vague for any specific advice, sorry
<nahtnam>
Hm, ok.
<jhass>
"just do it" is the only sane answer to "I have some code and I want to run it"
spider-mario has joined #ruby
<shevy>
jhack if you have it in form of an Array, you can use array.sample
centrx has quit [Quit: "You cannot fix a machine by just power-cycling it with no understanding of what is going wrong."]
<shevy>
jhack for instance: random_word = File.readlines('text.txt').sample
<shevy>
hey... jhack sounds almost like jhass
EllisTAA has joined #ruby
<nahtnam>
Maybe thor is what im looking for?
frecciac9 has joined #ruby
<frecciac9>
ciao
hotpanca_ has quit [Read error: Connection reset by peer]
howdoi has quit [Quit: Connection closed for inactivity]
sepp2k has quit [Quit: Leaving.]
vdamewood has joined #ruby
Burgestrand has quit []
trwyth has joined #ruby
<nahtnam>
No idea why it doesnt work
<jhass>
nahtnam: directory creates a task to create the directory if it doesn't exist
<jhass>
to load code use standard require
tynamite___ has joined #ruby
<jhass>
check rake -aT
finisherr has joined #ruby
<nahtnam>
rake lib #
<nahtnam>
rake lib/tasks #
<tynamite___>
Hi I'm using ruby 1.9.3 and when I enter ruby -e 'p Encoding.default_external' It says I'm using the CP850 encoding. How do I change it to UTF-8 ?
<jhass>
tynamite___: best would be to take the chance to change your system locale to UTF-8
<nahtnam>
jhass: So would I do require 'lib/tasks/asdf.rb'?
<jhass>
also note that Ruby 1.9 is EOL, 2.0 will be soon enough, consider upgrading to Ruby 2.2
<tynamite___>
I'm using Windows, but I get the same encoding on Heroku that doesn't use windows.
<tynamite___>
How do I change the system locale for windows?
djcp has joined #ruby
<nahtnam>
or is there a good way to auto import all rake tasks from a folder?
<jhass>
nahtnam: require is relative to $LOAD_PATH and you don't need the .rb suffix explicitly, but yes
davedev24 has quit [Ping timeout: 250 seconds]
sperant has joined #ruby
finisherr has quit [Client Quit]
<havenwood>
tynamite___: In Ruby 2.0 the default encoding was switched to UTF-8. Since Ruby 1.9 is past End-of-Life you should upgrade to 2.1+ anyways.
<tynamite___>
Seeing as Stack Overflow couldn't solve my problem, I'll see if upgrading ruby solves anything. I'm using a portable setup so I don't have to install anything.
lucianosousa has joined #ruby
baweaver has joined #ruby
<nahtnam>
jhass: `LoadError: cannot load such file -- lib/tasks/asdf` and `LoadError: cannot load such file -- lib/tasks/asdf.rb`
<jhass>
nahtnam: yes, read what I said. It's relative to $LOAD_PATH
davedev24 has joined #ruby
<nahtnam>
Ahhh
<nahtnam>
Ok
<nahtnam>
Its working now
<nahtnam>
TY
rikkipitt has joined #ruby
jgpawletko has joined #ruby
Oog_ has joined #ruby
trwyth has quit [Quit: trwyth]
chabil has joined #ruby
jpfuentes2 has quit [Ping timeout: 252 seconds]
jpfuentes2 has joined #ruby
allcentury has quit [Ping timeout: 245 seconds]
benlieb has joined #ruby
finisherr has joined #ruby
juanpablo_ has joined #ruby
fantazo has quit [Quit: Verlassend]
roolo has quit [Remote host closed the connection]
neohunter has joined #ruby
coban2k has quit [Remote host closed the connection]
pyon_ has joined #ruby
<neohunter>
Hi there!!
framling has quit [Remote host closed the connection]
<neohunter>
is there a way to access an instance variable bassed on another variable? like php $($hello)
roolo has joined #ruby
finisherr has quit [Client Quit]
bruno- has joined #ruby
finisherr has joined #ruby
NeverDie has quit [Max SendQ exceeded]
<neohunter>
I want to do something like args.each {|k,v| @k = v}
codecop has quit [Remote host closed the connection]
jpfuentes2 has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
prestorium has joined #ruby
<tynamite___>
I've upgraded to ruby 2.1.5 and the encoding is CP850. How do I change it to UTF-8?
pyon has quit [Ping timeout: 244 seconds]
dc_ has joined #ruby
devoldmx has quit [Ping timeout: 265 seconds]
tuxero has joined #ruby
<jhass>
tynamite___: either explicitly open files with the right encoding (all methods take parameters for that), use Encoding.default_external=, invoke ruby with the -E parameter set accordingly or as said change your system encoding
_aeris_ has joined #ruby
Cust0sLim3n has joined #ruby
chipotle has quit [Quit: cheerio]
baweaver has joined #ruby
<tynamite___>
But I have the wrong encoding on both Windows and Heroku.
<tynamite___>
Can I change the ruby encoding on the command line?
<_aeris_>
hello #ruby !
<jhass>
tynamite___: yes, I just wrote that you can ...
<jhass>
and how
<_aeris_>
how I can force ruby to search for .so extension on a specific folder ?
yfeldblum has joined #ruby
<_aeris_>
i use LD_LIBRARY_PATH, but works only with plain ruby, not with bundler :(
<jhass>
?xy
<ruboto>
it seems like you are asking for a specific solution to a problem, instead of asking about your problem. This often leads to bad solutions and increases frustration for you and those trying to help you. More: http://meta.stackexchange.com/a/66378
<tynamite___>
I typed in ruby -e Encoding.default_internal = Encoding:UTF_8 in the command line, and nothing happened.
<_aeris_>
jhass > ok, this is the plain context :P
<_aeris_>
i develop a tool to check TLS configuration, and for this, i need to patch both openssl lib and ruby extension
<jhass>
tynamite___: those are a list of alternatives, you mixed two up
renderful has quit [Remote host closed the connection]
<_aeris_>
but i don’t want to patch the ruby nor openssl system, because patch reintroduce weak ciphers for testing
renderful has joined #ruby
<jhass>
_aeris_: mmh, I guess you can try require_relative
<tynamite___>
I tried the external one instead and it doesn't work.
<tynamite___>
I tried both the internal and external one.
renderful has quit [Remote host closed the connection]
<jhass>
what exactly did you try
renderful has joined #ruby
<_aeris_>
jhass > this is not only .rb, this is also the openssl.so ruby ext
<tynamite___>
When I use ruby -e Encoding.default_external = Encoding::UTF_8 The encoding doesn't change to UTF-8. Nothing happens.
finisherr has joined #ruby
<jhass>
tynamite___: that's of course only for the current Ruby process, it doesn't change future invocations
<tynamite___>
Hmm that's what stack overflow said to do. How do I change it for all invocations?
<jhass>
do it in all invocations
<jhass>
or read my previous answer
AlphaAtom has joined #ruby
devdazed has quit [Quit: Computer has gone to sleep.]
msnyon has joined #ruby
dperalta has quit []
devdazed has joined #ruby
railsraider has joined #ruby
bronson has quit [Ping timeout: 260 seconds]
mleung has quit [Quit: mleung]
gambl0re has joined #ruby
dblessing has quit [Ping timeout: 260 seconds]
prestorium has quit [Ping timeout: 272 seconds]
lwu has joined #ruby
Alayde has joined #ruby
dc_ has quit [Read error: Connection reset by peer]
dc__ has joined #ruby
<shevy>
was ruby more successful than smalltalk?
tomphp has joined #ruby
<eam>
way yeah
startupality has joined #ruby
coban2k has joined #ruby
<infernix>
with Socket I can use getifaddrs to retrieve interface ips etc. which class has route info (e.g. ip route)? i'm not finding it in Socket
timanema has joined #ruby
dc__ has quit [Ping timeout: 265 seconds]
j4cknewt has quit [Remote host closed the connection]
TvL2386 has quit [Quit: Ex-Chat]
pyon has joined #ruby
mleung has joined #ruby
baweaver has joined #ruby
<eam>
infernix: probably none, try a gem
<tynamite___>
jhass you told me to either use Encoding.default_external= or change my system encoding.
banister has joined #ruby
<tynamite___>
But the wrong encoding is also on heroku, so I can only change it with ruby
<jhass>
tynamite___: or -E or just specify it every time you open a file
sumark has quit [Remote host closed the connection]
hfp has joined #ruby
nisstyre has joined #ruby
sumark has joined #ruby
jpfuentes2 has joined #ruby
<tynamite___>
I put Encoding.default_external = 'utf-8' Encoding.default_internal = Encoding::UTF_8 at the top of my ruby files and it didn't do anything.
<jhass>
maybe your methodology of verifying your claim is plain wrong
hinbody has quit [Quit: leaving]
last_sta1 has joined #ruby
last_staff has quit [Ping timeout: 244 seconds]
rideh has quit [Client Quit]
<tynamite___>
I say it doesn't do anything because when I put the £ symbol on an xhtml page, I get an exception saying that I cannot print a utf-8 character on a cp850 page.
mleung has joined #ruby
diegoviola has quit [Quit: WeeChat 1.2]
Motoservo has joined #ruby
n008f4g_ has quit [Ping timeout: 252 seconds]
<hfp>
Hey all, I don't understand this code from POODR: https://github.com/skmetz/poodr/blob/master/chapter_8.rb#L423-L476. When you call `Bicycle.spares', it goes to Parts.spares but then where does it get `part` from on L447? I see from the doc that `select` should be applied to an Enumerable so `[1, 2, 3].select` is fine but if `select` is not sent as a message to anything then how does it know what it applies to?
<jhass>
tynamite___: is it a Ruby exception? copy paste it
startupality has quit [Quit: startupality]
devdazed has quit [Quit: Computer has gone to sleep.]
TheNet has quit [Remote host closed the connection]
finisherr has quit [Ping timeout: 250 seconds]
<jhass>
hfp: Enumerable is based on .each, Parts#each is a forward to @parts.each, Enumerable is included into Parts thus Enumerable#select is available as Parts#select
tvw has quit [Ping timeout: 256 seconds]
<elaptics>
hfp: it's the parts held in spares
startupality has joined #ruby
devdazed has joined #ruby
jgpawletko has quit [Quit: jgpawletko]
nisstyre has quit [Changing host]
nisstyre has joined #ruby
centrx has joined #ruby
<hfp>
jhass: Right, but why isn't it written as self.select?
<jhass>
yes, it's identical for all you need to care about atm
<hfp>
ok
dblessing has joined #ruby
ht__ has quit [Quit: Konversation terminated!]
northfurr has joined #ruby
<hfp>
And L439: `def_delegators :@parts, :size, :each` means that whenever you call size and each on @parts, it will forward this to each thing in @parts? So it's a bit like reverse inheritance?
<hfp>
whereas it goes down the inheritance chain instead of up?
northfurr has quit [Client Quit]
felltir has joined #ruby
cornerma1 has joined #ruby
prettiestPony11 has joined #ruby
unver has quit [Quit: ERC (IRC client for Emacs 24.5.1)]
tomphp has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Kalov has quit []
tomphp has joined #ruby
fundies has joined #ruby
<fundies>
can someone help me with omniauth-twitter? I''m getting 401 Authorization Required
tmtwd has quit [Quit: Leaving]
JoshL has quit []
cornerman has quit [Ping timeout: 252 seconds]
cornerma1 is now known as cornerman
IceyEC has quit [Remote host closed the connection]
sperant has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
bmurt has quit []
pyon has quit [Ping timeout: 260 seconds]
roolo_ has joined #ruby
blue_deref has joined #ruby
hippyphysicist has joined #ruby
j4cknewt has joined #ruby
roolo has quit [Ping timeout: 260 seconds]
shinnya has joined #ruby
Symbiosisz2 has joined #ruby
umgrosscol has quit [Remote host closed the connection]
neohunter has joined #ruby
<neohunter>
I've this.. module Aaa; class A end; end; module Aaa; class B end; end;
Oog_ has quit []
<jhass>
hfp: it's called delegation, it's a form of composition, not inheritance
<jhass>
jhack: but you should've just tried it prior asking and then ask if it's the best solution ;
<jhass>
;)
Alayde has quit [Quit: WeeChat 1.1.1]
<jhack>
yeah my b
fmcgeough has quit [Quit: fmcgeough]
jamesaxl has joined #ruby
shock_one has quit [Remote host closed the connection]
bhorn1 is now known as bhorn1|away
shevy is now known as jhask
<jhask>
ok guys let's rock
Alayde has joined #ruby
<jhass>
?guys jhask
<ruboto>
jhask, You probably don't mean to exclude, but not everyone relates to being "one of the guys". Maybe consider using "folks", "y'all" or "everyone" instead?
<al2o3-cr>
Wow, I thought a was seeing someone type to oneself for a minute then
<jhask>
hey I did not say that, that was jhack
<jhass>
you all need clients with better color coding
<jhask>
al2o3-cr lol
<jhack>
LOL
<jhack>
hey, that was clearly jhask
<jhask>
this is confusing me... and the heat is also making things worse
tuxero has quit [Quit: tuxero]
<jhack>
jhask: no AC?!
<jhass>
jhask: you're pink, jhack is green, can't fool me
<jhack>
jw, how old are yall
<al2o3-cr>
heh jhass blue jhack blue jhask green :)
<jhask>
it takes me a few seconds to find out who of you two asked this :\
galeido has quit [Read error: Connection reset by peer]
jhass is now known as al2oe-cr
al2oe-cr is now known as al2o3-cr
<jhask>
lol
<jhask>
you can't get the al nick because it's so hard to type
<al2o3-cr>
:D
jhask is now known as jhaks
<jhaks>
ok let's all switch back again?
<jhack>
starting the jha trend
<jhack>
lets gettit
sperant has joined #ruby
jerius has quit [Quit: /quit]
ndrei has quit [Ping timeout: 260 seconds]
<shevy>
nah, I keep this one and tell everybody to use UTF-8 and never built anything from source
Hal_9000_ has joined #ruby
Symbiosisz has quit [Remote host closed the connection]
Symbiosisz2 has quit [Remote host closed the connection]
<jhaks>
:(
<jhaks>
I don't know who is who anymore
<shevy>
see, that's how sad you usually make me
ndrei has joined #ruby
<al2o3-cr>
the gold old whowas :)
<TheMysticWyvern>
How do programming languages work if the one writing it speaks a different language, like Japanese or German? Would they have their own syntax, or would an English person be able to read their programming?
AccordsLTN has quit []
michaeldeol has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
shevy is now known as jhass
<jhass>
TheMysticWyvern: developers you want to work with will use english identifiers and comments
shock_one has joined #ruby
<jhass>
those that don't... try to avoid them :P
<TheMysticWyvern>
jhass: So, a Japanese person, for example, would actually use the Japanese word for "variable" in their programming instead of, well, "variable?"
<jhack>
How do i access an array i have in a different class? Ex: i have class Computer, i want to access an array from the Computer class in my Player class
scripore has quit [Quit: This computer has gone to sleep]
<ryuu>
who do i talk to to get the ?guys alias removed? it's ridiculous and actually offensive
<jhass>
TheMysticWyvern: I just said the opposite
<Coraline>
How is it offensive?
<Coraline>
Actually, respond on #ruby-offtopic
doodleha_ has quit [Remote host closed the connection]
FernandoBasso has joined #ruby
<jhass>
ryuu: ^ continuing the topic here will get you removed, please respect moving to #ruby-offtopic
baweaver has quit [Remote host closed the connection]
jbw_ has quit [Ping timeout: 265 seconds]
<jhass>
jhack: that desire is a strong indicator that the array shouldn't live in the Computer class in the first place
pyon has quit [Ping timeout: 252 seconds]
<jhack>
The computer class gets the sample from an external textfile and places it into the array though
pyon has joined #ruby
<jhass>
there's no though in there
silkfox has quit [Ping timeout: 250 seconds]
<jhass>
it doesn't invalidate the point at all
<rehat>
is there a good way to remember to prefix or postfix a ':' for symbols? When I use then in a hash def it's postfix but if I try to grab the value from a hash using [] the colon is prefixed
shock_one has quit [Ping timeout: 246 seconds]
scripore has joined #ruby
<hfp>
jhass, elaptics: Thanks for the explanation earlier
<jhass>
rehat: prefix is the standard and normal way, hash literals are the only optional exception
freerobby has quit [Quit: Leaving.]
<jhass>
rehat: that is :foo => bar still works in them too
radgeRayden has joined #ruby
<apeiros>
jhass: also keyword args (symbols when passing, not symbols when defining)
<apeiros>
that part has potential for confusion for newcomers
baweaver has joined #ruby
jhaks is now known as shevy
hotpancakes has quit [Remote host closed the connection]
<jhass>
mmh, true, though are they really symbols? aren't they just syntax?
<shevy>
TheMysticWyvern they use english names really
sdwrage has quit [Quit: Leaving]
<[spoiler]>
jhass: they're just syntax
<hfp>
TheMysticWyvern: The litterals and functions don't change, they are always in English. How you name your variables and your own functions depends on you and your team; you can very well give all your vars and functions German names but the ones from the Ruby language will always be in English. i.e. an Array will always be an Array no matter what locale your team is using
Rutix has quit []
radgeRayden_ has joined #ruby
<TheMysticWyvern>
That's what I was wondering about. Thank you, everyone! :3
<[spoiler]>
apeiros: hmm why would it confuse newcomers?
<jhass>
you can, but you'd be a horrible person to do so
<hfp>
Of interest, I remember Microsoft tried to localize the standard function names in Excel. It was a nightmare! Say you are proficient in Excel "programming" in English and you want to use a French version of Office... Well nothing works anymore because SUM() became SOMME()
mary5030 has quit [Remote host closed the connection]
<[spoiler]>
apeiros: oh you mean because they'd expect to be able to do `:foo => 9001`?
<[spoiler]>
in the definition
User458764 has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
bronson has joined #ruby
<shevy>
hfp that's what I hated about openoffce/libreoffice excel - when I had the german language, the function names for excel were different
<apeiros>
jhass: which ones?
<shevy>
since that confused the hell outta me, I switched to english always
<apeiros>
definition or passing?
<jhass>
mmh, both actually
radgeRayden__ has joined #ruby
shock_one has joined #ruby
dr3w has quit [Ping timeout: 260 seconds]
radgeRayden has quit [Ping timeout: 246 seconds]
dr3w has joined #ruby
pyon has quit [Ping timeout: 250 seconds]
bumbar_ has quit [Ping timeout: 246 seconds]
<rehat>
jhass: ok thanks
sperant has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
startupality has quit [Quit: startupality]
htmldrum has joined #ruby
radgeRayden_ has quit [Ping timeout: 246 seconds]
radgeRayden has joined #ruby
<neohunter>
is possible to define a method with multiple arguments in 2 lines?
<neohunter>
i mean the def(...) line
<jhass>
?try
<ruboto>
Why don't you try it and see for yourself?
<[spoiler]>
I am actually still unsure how I feel about kwargs. I find it a bit annoying that we can't do `def meth(a:1, b:2)` and call it as `meth(4,5) or `meth(4)`. I foten forget I need to call it as `meth(a:4)`
yqt has joined #ruby
<[spoiler]>
often*
<jhass>
yeah, python got that better, you can just use the names of regular args
djbkd has joined #ruby
NeverDie has joined #ruby
<jhass>
crystal too does that for args with default values and I have some hope we'll get it for required args too
<[spoiler]>
I mostly use the a=1, b=2 syntax
sperant has joined #ruby
<[spoiler]>
jhass: see, that is nice
jbw has joined #ruby
baweaver has quit [Remote host closed the connection]
<[spoiler]>
and I find it weird how, internally when you call those methods, it's a hash
radgeRayden_ has joined #ruby
monsieurp has quit [Remote host closed the connection]
radgeRayden__ has quit [Ping timeout: 246 seconds]
<[spoiler]>
but at least we can do `foo(some_hash)` lol
<shadeslayer>
zenspider: ok, I'll use nested blocks, but for the sake of education completedness, what method does one overload to execute things when something goes out of scope
juanpablo__ has joined #ruby
<shadeslayer>
hmm
<shadeslayer>
I see
<shadeslayer>
ok
_blizzy_ has joined #ruby
juanpablo__ has quit [Client Quit]
n_blownapart has quit [Remote host closed the connection]
juanpablo__ has joined #ruby
big|bad|wolf has quit [Ping timeout: 264 seconds]
<zenspider>
not sure I understand your question
juanpablo_ has quit [Ping timeout: 240 seconds]
casadei has quit [Remote host closed the connection]
NeverDie has quit [Quit: I'm off to sleep. ZZZzzz…]
<shadeslayer>
zenspider: I'm looking for the opposite of the initialize method :)
<shadeslayer>
the dtor in C++ speak :P
<zenspider>
you use a finalizer like someone suggested... but it doesn't work the way C++'s destructors work. You'll never control when it triggers
<shadeslayer>
right
<shadeslayer>
that's what I can find on google as well :(
choke has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
dimasg has quit [Ping timeout: 252 seconds]
Timba-as has joined #ruby
danieli has quit [Quit: *does an epic backflip into nowhere*]
ItSANgo has quit [Quit: Leaving...]
bmurt has quit [Read error: Connection reset by peer]
baweaver has joined #ruby
felltir has quit [Remote host closed the connection]
bmurt has joined #ruby
baweaver has quit [Remote host closed the connection]
amclain has joined #ruby
Kallis has quit [Read error: Connection reset by peer]
quimrstorres has joined #ruby
NeverDie has joined #ruby
dopamean_ has joined #ruby
einarj has quit [Remote host closed the connection]
arescorpio has joined #ruby
<hays>
i had a script today at work that stopped working when i started accessing ARGV. specifically gets didn't seem to know to pull from stdin.. is this normal?
<zenspider>
what does ARGV and gets have to do with each other?
havenwood is now known as havenn
zenspider is now known as zs
zs is now known as zenspider
<hays>
i don't know
<hays>
it just mysteriously started throwing an error
quimrstorres has quit [Remote host closed the connection]
<zenspider>
hays: you just want to read from files passed on cmdline?
choke has joined #ruby
choke has quit [Client Quit]
htmldrum has joined #ruby
dimasg has joined #ruby
<hays>
nah, my args were just parameter
<hays>
parameters
<zenspider>
so what was the error?
michaeldeol has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
rcvalle has quit [Quit: rcvalle]
<hays>
let me see if i can reproduce it at home.. i was on a winbox
<zenspider>
ri Kernel.gets: "Returns (and assigns to $_) the next line from the list of files in ARGV (or $*), or from standard input if no files are present on the command line."
pietr0 has quit [Quit: pietr0]
Rickmasta has joined #ruby
<zenspider>
you can be explicit by using $stdin.gets
<zenspider>
or you can be explict by using ARGF as an IO
Synthead has joined #ruby
Azure has joined #ruby
ishahnaz has quit []
sideshowcoder has quit [Quit: Connection closed for inactivity]
hashrocket has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
chouhoulis has quit [Remote host closed the connection]
devdazed has joined #ruby
Renich has joined #ruby
michaeldeol has joined #ruby
hashrocket has joined #ruby
<hays>
dang. can't reproduce at home
<hays>
I had something like while gets.chomp != 'STOP'; puts 'Type STOP to exit';end
hotpancakes has joined #ruby
fundies has quit [Read error: Connection reset by peer]
tomphp has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
hydrozen has joined #ruby
<hays>
ah well
<hays>
i'll try gain tomorrow with $stdin.gets.chomp
<zenspider>
hays: and normally your ARGV was empty, but you started adding flags or something?
sperant has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
hotpancakes has quit [Remote host closed the connection]
<hays>
zenspider: yeah
hotpancakes has joined #ruby
sperant has joined #ruby
<zenspider>
kk. either process all your flags up front and ensure ARGV is empty, or be explicit about where you're getting your input
<zenspider>
run `ri Kernel.gets` for full doco
<hays>
ahhhhhh
drewo has joined #ruby
linuxboy_ has joined #ruby
dr3w has quit [Read error: Connection reset by peer]
northfurr has joined #ruby
bmurt has quit []
coban2k has quit [Remote host closed the connection]
hashrocket has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
linuxboytoo has quit [Ping timeout: 244 seconds]
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
hotpancakes has quit [Read error: Connection reset by peer]
marr has quit [Ping timeout: 264 seconds]
cpruitt has quit [Quit: cpruitt]
hotpancakes has joined #ruby
RegulationD has quit [Remote host closed the connection]
dimasg has quit [Ping timeout: 246 seconds]
rbennacer has quit [Remote host closed the connection]
havenn is now known as havenwood
jhack has quit [Ping timeout: 265 seconds]
Alayde has quit [Ping timeout: 240 seconds]
Oka has quit [Read error: Connection reset by peer]
coban2k has joined #ruby
AccordLTN has joined #ruby
Oka has joined #ruby
dimasg has joined #ruby
rbennacer has joined #ruby
bodgix_ has joined #ruby
WillAmes has quit [Remote host closed the connection]
sperant has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
WillAmes has joined #ruby
hashrocket has joined #ruby
michaeldeol has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
northfurr has quit [Ping timeout: 244 seconds]
jpfuentes2 has quit [Read error: Connection reset by peer]
jpfuente_ has joined #ruby
Ropeney has joined #ruby
charliesome has joined #ruby
tkuchiki has quit [Remote host closed the connection]
Shibo has joined #ruby
michaeldeol has joined #ruby
tkuchiki has joined #ruby
TheNet has quit [Remote host closed the connection]
dfockler has quit [Remote host closed the connection]