bzalasky has quit [Remote host closed the connection]
srbaker has joined #ruby-lang
setmeaway has joined #ruby-lang
<Wardrop>
Rakko: Thanks, I guess the answer is no, though depending on your scenario they're may be a good work-around. I might raise a feature request at bugs.ruby-lang.org to start a discussion.
<Wardrop>
If ruby really wants to embrace duck-typing, it needs to have a more succinct means of dealing with potentially non-existent methods.
srbaker has quit [Client Quit]
<Rakko>
Maybe.
<Rakko>
I think the #try mentioned in the first link is a Rails addon
Technodrome has joined #ruby-lang
Gaelan has joined #ruby-lang
Technodrome has quit [Quit: Technodrome]
Rakko has quit [Quit: leaving]
tbuehlmann has quit [Ping timeout: 246 seconds]
<Wardrop>
Rakko: Yep, it's rails.
Technodrome has joined #ruby-lang
<Technodrome>
is class << self etc etc the same thing as def self.methodname ?
mwjcomputing has joined #ruby-lang
idkazuma has joined #ruby-lang
aef has quit [Remote host closed the connection]
srbaker has joined #ruby-lang
aef has joined #ruby-lang
reactormonk has quit [Quit: WeeChat 0.4.0]
srbaker has quit [Quit: Computer has gone to sleep.]
srbaker has joined #ruby-lang
srbaker has quit [Quit: Computer has gone to sleep.]
idkazuma has quit [Remote host closed the connection]
sonots has joined #ruby-lang
Nisstyre-laptop has joined #ruby-lang
tcopp has joined #ruby-lang
Technodrome has quit [Quit: Technodrome]
postmodern has joined #ruby-lang
setmeaway has quit [Quit: Leaving]
setmeaway has joined #ruby-lang
mistym has joined #ruby-lang
mistym has quit [Changing host]
mistym has joined #ruby-lang
djwonk has quit []
djwonk has joined #ruby-lang
breakingthings has joined #ruby-lang
agarie has joined #ruby-lang
mytrile has joined #ruby-lang
mytrile has quit [Ping timeout: 240 seconds]
davidedgertonjr has joined #ruby-lang
davidedgertonjr has left #ruby-lang [#ruby-lang]
vlad_starkov has quit [Read error: Connection reset by peer]
mwjcomputing has quit [Ping timeout: 246 seconds]
charliesome has joined #ruby-lang
megha has joined #ruby-lang
baba has quit [Ping timeout: 245 seconds]
Technodrome has joined #ruby-lang
symm- has quit [Ping timeout: 256 seconds]
kgrz has quit [Quit: Computer has gone to sleep.]
idkazuma has joined #ruby-lang
idkazuma has quit [Remote host closed the connection]
kgrz has joined #ruby-lang
mytrile has joined #ruby-lang
mytrile has quit [Ping timeout: 245 seconds]
Gaelan has quit [Remote host closed the connection]
Gaelan has joined #ruby-lang
Gaelan has quit [Ping timeout: 260 seconds]
swav has joined #ruby-lang
Gaelan has joined #ruby-lang
Squee-D has quit [Quit: The computer fell asleep]
Squee-D has joined #ruby-lang
intellitech has quit [Quit: intellitech]
Squee-D has quit [Ping timeout: 260 seconds]
Guest85414 has quit [Remote host closed the connection]
herpless___ has quit [Remote host closed the connection]
beawesomeinstead has quit [Remote host closed the connection]
thejspr_ has quit [Remote host closed the connection]
norplr has quit [Remote host closed the connection]
anildigital_work has quit [Remote host closed the connection]
UziMonkey__ has quit [Remote host closed the connection]
Spaceghost|cloud has quit [Remote host closed the connection]
wycats__ has quit [Write error: Connection reset by peer]
akahn has quit [Write error: Broken pipe]
randym has quit [Write error: Broken pipe]
bzalasky has joined #ruby-lang
wycats__ has joined #ruby-lang
<drbrain>
Technodrome: yes*
<drbrain>
* but you can create attr_* in class << self
fosky has joined #ruby-lang
cms has joined #ruby-lang
Technodrome has quit [Quit: Technodrome]
yianna has joined #ruby-lang
<yianna>
hey has anyone read Peter Coopers Beginning ruby from Newb to Pro
<swombat>
the relevant line in the first gist is 157
<swombat>
I've included the whole class because I suspect there's some strange effect going on that is outside the otherwise extremely simple syntax that's blowing up
<swombat>
strangely, if I replace that simple loop with its one-line syntactical equivalent ( [1,2,3].each { |i| puts i } ) then it doesn't blow up
<swombat>
so it's only the multi-line block that blows up
akahn has joined #ruby-lang
nXqd has joined #ruby-lang
srbaker has joined #ruby-lang
Squee-D has joined #ruby-lang
Technodrome has joined #ruby-lang
<swombat>
don't all answer at once :-)
srbaker has quit [Quit: Computer has gone to sleep.]
ledestin has joined #ruby-lang
soknee has joined #ruby-lang
Squee-D has quit [Quit: The computer fell asleep]
Squee-D has joined #ruby-lang
Squee-D has quit [Ping timeout: 255 seconds]
Technodrome has quit [Quit: Technodrome]
soknee has quit [Quit: Leaving.]
crynix has joined #ruby-lang
crynix is now known as zach
zach is now known as zachlatta
zachlatta is now known as zach
zach is now known as zachlatta
soknee has joined #ruby-lang
soknee has quit [Client Quit]
DEac- has quit [Ping timeout: 240 seconds]
<zachlatta>
When opening a file for writing, is there any particular reason why "w" is passed as a string and not a symbol? I'm assuming this is because the File class is written in C?
<Wardrop>
zachlatta: Your guess is as good as anyone's
Spaceghost|cloud has joined #ruby-lang
<Wardrop>
zachlatta: It wouldn't be that useful as a symbol anyway, as the + sign required for half the modes would mean you'd have to quote the symbol
<Wardrop>
Hardly short-hand
<zachlatta>
Ah, I see.
tomzx_mac has joined #ruby-lang
<Wardrop>
swombat: Have you solved the issue yet?
<swombat>
nope
<Wardrop>
What ruby version are you running?
<Wardrop>
Does the block of code work in isolation...
<Wardrop>
[1, 2, 3].each do |i|
<Wardrop>
puts i
<Wardrop>
end
<swombat>
yep
<swombat>
it just doesn't work inside the define_method/instance_eval block
<swombat>
and it works when put in { } instead of do/end blocks
<swombat>
but it feels dirty not to know why the do/end block is blowing up
<Wardrop>
Use the method of passing a block as suggested by inject, and wrap the method name in paranthesis
<injekt>
yeah this might actually be related
<injekt>
also injekt* ;)
<Wardrop>
By leaving parenthesis off the call to `define_method`, you're creating an ambiguity.
baz_ has quit [Ping timeout: 245 seconds]
mytrile has joined #ruby-lang
<injekt>
doing define_method :foo, ->(..) do .. end is weird
<swombat>
hmm, ok, let me see if the other syntax works
randym has joined #ruby-lang
jxie has quit [Quit: leaving]
runeb has quit [Read error: Connection reset by peer]
<Wardrop>
injekt: I agree. The "->" is not a method call. It uses a special syntax. It's not surprising it doesn't work in this context,
<swombat>
well, the -> works fine until I stick a do/end block inside
<swombat>
oh, now i remember why I had to use ->
<swombat>
no default params with do |a, b|
<injekt>
uh
<injekt>
did you try?
<injekt>
do |a=1, b=2|
<swombat>
I think I did, when I first coded this...
<swombat>
but let's try again
<swombat>
after all, my present self is infinitely more clever than my past self
<swombat>
huh, seems to parse
<Wardrop>
You can keep using you're odd lambda, just wrap parenthesis around the arguments to #define_method
* swombat
sends a note with the word "STUPID!" on it to his past self
<Wardrop>
E.g. define_method(:foo, ->() do … end)
abstr4ct has joined #ruby-lang
<injekt>
vomit
rsl has quit [Ping timeout: 252 seconds]
DEac- has joined #ruby-lang
<swombat>
NameError: undefined local variable or method `vomit' for main:Object
<swombat>
thanks injekt, Wardrop :-)
<swombat>
looks like it's fixed now
<Wardrop>
No worries
<abstr4ct>
Trying to work out a way using xpath/nokogiri to start at a given string and output all text until another string. What i have so far works to some degree, but i dont need the extra "not" analysis. I feel like i should be a ble to use a "until" instead of the way i am doing it.
<injekt>
define_method isn't even supposed to be used like that anyway, the only reason if works is because define_method is meant to accept Method instances so you can do define_method(foo, method(:bar))
<injekt>
abstr4ct: show us what you have so far with example html
<Wardrop>
abstr4ct: Ok, I think I know what you mean. You want to retrieve all the text between two strings as they appear within a HTML/XML document.
<abstr4ct>
exactly
<injekt>
you're grouping the menus by day?
<abstr4ct>
yes
sonots has joined #ruby-lang
<Wardrop>
Is there some reason why you're just using Regex on the document, or all the text in the document?
<Wardrop>
E.g. /start string.+?end string/
<abstr4ct>
i can do that with nokogiri?
<Wardrop>
Well, you can get a HTML fragment out of Nokogiri, or any text fragment, and then Regexp it.
<injekt>
why would you use regexp when you have an html parser at hand?
<abstr4ct>
the nokogiri html parser makes the text clean
<abstr4ct>
thats my main reason for using it. but i am not expert
<abstr4ct>
not=no
<Wardrop>
By make it clear, I assume you mean it removes the markup, correct?
<Wardrop>
make it clean*
<abstr4ct>
yes
<Wardrop>
Use nokogiri to extract the text without the markup.
<Wardrop>
Let me lookup the API to see if I can find what you should use
<injekt>
ugh
<injekt>
please dont do that
chessguy has quit [Remote host closed the connection]
<abstr4ct>
what you got in mind ink?
<injekt>
abstr4ct: just writing something
<abstr4ct>
k, no rush
<abstr4ct>
this is just some silly side project for me to learn ruby with
<Wardrop>
This will get all the text, without markup: Nokogiri::HTML(src).text
grandy has joined #ruby-lang
<Wardrop>
Where `src` is the HTML stored in a string
<abstr4ct>
gotcha
<Wardrop>
I have no idea how you're using this, so don't know if this is appropriate or not, but based on your brief description of your requirements, this should work.
<Wardrop>
I'm not sure what injekt is cooking up.
<abstr4ct>
yes, i appreciate all the ideas.. I kind of hit a mental block so i came here for some new ideas.
<injekt>
and it's easy to adapt it without you having to specify the days too, but I'll leave that as an exercise for you
<injekt>
all the crazy xpath is fine but when you get websites like this that have no idea how to markup their page, fancy xpath goes out the window
<abstr4ct>
wow
<abstr4ct>
that is awesomely simple. not let me see how to use it in my overly complicated existing framework
<abstr4ct>
hehe
<injekt>
:P
madb055 has quit [Ping timeout: 272 seconds]
<injekt>
I love writing extreme xpath but usually it's the simpliest thing that works
adambeynon has joined #ruby-lang
<abstr4ct>
extreme xpath. hahaha
<injekt>
yeah this is one of my favs and it's actually not even too complicated: //h2[. = 'Foo bar']/following-sibling::p [1 = count(preceding-sibling::h2[1] | ../h2[. = 'Foo bar'])]
mytrile has quit [Remote host closed the connection]
mytrile has joined #ruby-lang
wallerdev has joined #ruby-lang
mytrile has quit [Remote host closed the connection]
mytrile has joined #ruby-lang
r0bglees0n has quit [Ping timeout: 256 seconds]
mytrile has quit [Remote host closed the connection]
mytrile has joined #ruby-lang
mytrile has quit [Remote host closed the connection]
mytrile has joined #ruby-lang
mytrile has quit [Remote host closed the connection]
mytrile has joined #ruby-lang
norplr has joined #ruby-lang
postmodern has quit [Remote host closed the connection]
<abstr4ct>
inkjet, in your example "day" works as a pattern to match?
<abstr4ct>
doh nm.. haha
ledestin has quit [Ping timeout: 245 seconds]
ledestin has joined #ruby-lang
mytrile has quit [Remote host closed the connection]
mytrile has joined #ruby-lang
<whitequark>
what the hell
srbaker has quit [Quit: Computer has gone to sleep.]
<whitequark>
>> def a; BEGIN { puts 1 }; end
<eval-in>
whitequark => /tmp/execpad-16aa69529cb4/source-16aa69529cb4:2: BEGIN is permitted only at toplevel ... (http://eval.in/14053)
<whitequark>
hm.
mytrile has quit [Remote host closed the connection]
mytrile has joined #ruby-lang
srbaker has joined #ruby-lang
mrfelix has quit [Quit: Computer has gone to sleep.]
Technodrome has joined #ruby-lang
tcopp has joined #ruby-lang
mytrile has quit [Remote host closed the connection]
mytrile has joined #ruby-lang
<abstr4ct>
thanks wardrop and inkjet! i apprciate the assistance
r0bglees0n has joined #ruby-lang
<yorickpeterse>
whitequark: on 1.9 it raises a syntax error
<yorickpeterse>
(without the "permitted..." stuff)
<whitequark>
yorickpeterse: yep I know
<whitequark>
also hm.
<whitequark>
>> 1; else 2
<eval-in>
whitequark => /tmp/execpad-197e3b22ed55/source-197e3b22ed55:3: warning: else without rescue is useless ... (http://eval.in/14054)
<abstr4ct>
inkjet: i still dont understand in your example how it knows when to stop. I see the starts with. but how does it know to end?
<whitequark>
plus anti-configurability, plus "we totally need to have a QR code generator in init".
<yorickpeterse>
whitequark: personally I don't give a damn about the whole "BUT IT'S NOT FOLLOWING THE UNIX PHILOSOPHY!!!" stuff
<whitequark>
yorickpeterse: it's not really about unix philosophy
<charliesome>
whitequark: qr code generator wat lol
<charliesome>
yorickpeterse: thats pretty cool
<whitequark>
it's about reimplementing every single library they see
<charliesome>
yorickpeterse: what distro do you use?
<whitequark>
dbus, etc
<whitequark>
the whole pulseaudio is basically a buggy and slow reimplementation of ALSA
<yorickpeterse>
whitequark: as long as it works I don't really care about the internals. I've had more bullshit issues with dbus in the past not to really care about it anymore.
<yorickpeterse>
charliesome: arse linux
<charliesome>
yorickpeterse: nice
<charliesome>
whats wrong with arch?
<yorickpeterse>
Not much, but not very suited for more than 1 server
<charliesome>
sure it is you just gotta roll that yourself, that's The Arch Way
<yorickpeterse>
keeping 3 installations (2 laptops and a server) is a bit of a pita at times
<yorickpeterse>
* up to date
<yorickpeterse>
Personally I'd just stick with Debian the next time I need to install a server
<yorickpeterse>
But for the time being this works just fine
sonots has quit [Quit: Leaving...]
<charliesome>
i see my server as an extension of my personal computing activities
<charliesome>
so arch works well
<charliesome>
if i needed to maintain a server for srs bsns and stuff i'd use ubuntu
<yorickpeterse>
meh, I'm personally done with Canonical going full retard
* whitequark
sighs
<yorickpeterse>
plus there aren't really any benefits of using Ubuntu over Debian if you'd ask me
<whitequark>
yorickpeterse: more recent packages
drumond19 has joined #ruby-lang
<charliesome>
^^^^
<whitequark>
according to our ops guy
<yorickpeterse>
that's a repository issue
<charliesome>
i run arch cos i don't enjoy maintaining my own distro
<yorickpeterse>
You can get perfectly up to date packages on any given OS depending on what repositories you activate
<yorickpeterse>
I believe Debian has "testing-whatever" with all the new stuff
<charliesome>
where "new stuff" is "slightly less old stuff"?
* yorickpeterse
hasn't used Debian in a while
* whitequark
has a server with debian stable+testing, defaulting to stable
<whitequark>
best of the both worlds.
<Technodrome>
application hosting for the win
* Technodrome
doesn't do hardly any server admin anymore
<whitequark>
Technodrome: like, heroku?
<Technodrome>
or openshift
<yorickpeterse>
Neither do I, we have a separate OPs team.
<whitequark>
it's fine if you can afford to pay 2x-10x more and have way less features available
<yorickpeterse>
They're now moving all our stuff to Cent OS/Amazon Linux. Not sure how I feel about that.
<charliesome>
the best bit about heroku is watching people work around its insane artifical limitations
<Technodrome>
appfrog to
<Technodrome>
open shift is pretty cheap whitequark
* whitequark
writes a ruby 1.8 parser
<charliesome>
whitequark: why? :(
<charliesome>
let 1.8 die
<Technodrome>
but i do use oracle linux sometimes in a vm
<Technodrome>
oracle linux << sounds scary!
<abstr4ct>
you mean, expensive
<whitequark>
charliesome: people have to deal with 1.8
<Technodrome>
its actually free abstr4ct
<whitequark>
the parser doesn't *run* on 1.8, mind you
<charliesome>
oracle linux has voip built in
<charliesome>
so you can call their sales people from the package manager
<Technodrome>
oracle linux is easy to setup oracle db, hence why i installed it
<charliesome>
whitequark: but 1.8 needs to die
<zachlatta>
Basic question: I'm having trouble with including a variable from another file. I know this is a scope issue, but the issue doesn't seem resolve when using a global variable. Some of you may recognize the code from Why's poignant guide: https://gist.github.com/zachlatta/30ad8c997ac076df21a4
<abstr4ct>
its rhel, with all their patchs, they got sick of having to go through redhat
<Technodrome>
they also undercut red hats support contracts by like 30 percent to
<abstr4ct>
but i thought it was free?
<abstr4ct>
;)
<Technodrome>
of course you can buy support
<Technodrome>
just like red hat
<Technodrome>
but i think oracle is wrong for doing it
<Technodrome>
using red hats software, and undercutting their support
<whitequark>
lol
<charliesome>
abstr4ct: you should be able to use a global variable there
<abstr4ct>
so, you must be up to date to get support. but you cannot update without support.. so is it free?
<charliesome>
its not the best idea in the world
<charliesome>
whoops, zachlatta ^
<Technodrome>
abstr4ct: you can update
<abstr4ct>
then i guess that is differnt from rhel..
<Technodrome>
well define update
<abstr4ct>
im just very used to oracles crack model.. its cheap/free until you want to actually use the good stuff
<abstr4ct>
which is fine.. im just saying they are known for it
<abstr4ct>
orcale standard vs enterprise.. night and day pricing
<Technodrome>
as far as i know there is no update like in debian for rhea based stuff
<Technodrome>
rhel*
<abstr4ct>
rhel uses satelite i beleive
<abstr4ct>
charlie, what was that about a global variable?
<charliesome>
abstr4ct: i meant to mention zachlatta
<charliesome>
you're both green in textual so i got confused
<Technodrome>
a fresh install for every new major version update
<whitequark>
>> def a; class << self; A = 1; end; end; a
<andrewvos>
It's a remote gui for Transmission.app...
<andrewvos>
But it looks exactly like uTorrent.
<yorickpeterse>
rking: ping
<yorickpeterse>
andrewvos: what's the point of it? Transmission already has a perfectly fine web UI
<yorickpeterse>
also lol, it looks shit on OS X/Umbongo
voker57_ has quit [Changing host]
voker57_ has joined #ruby-lang
voker57_ is now known as Voker57
djwonk has quit []
judofyr has joined #ruby-lang
<judofyr>
hey folks
maxmanders has quit [Ping timeout: 245 seconds]
<yorickpeterse>
hai
<judofyr>
what's up?
maxmanders has joined #ruby-lang
nXqd has joined #ruby-lang
<yorickpeterse>
judofyr: you need to talk about that super secret project on Euruko
<abstr4ct>
trying to capture the text between monday and tuesday, but due to the special layout my usual follow doesnt work. any ideas http://www.eastvillagegrill.com/Menus.cfm
<yorickpeterse>
also because I want to meet the people I've been chatting with for the past 2 years
<judofyr>
yorickpeterse: hm… I haven't been able to finish it :/
<yorickpeterse>
then hurry
retro|cz has joined #ruby-lang
<yorickpeterse>
also, it doesn't have to be finished as long as you can have a nice talk about it
<judofyr>
:)
<judofyr>
and now I'm single handed for the moment (accident). vim is hard with only one hand…
runeb has quit [Remote host closed the connection]
<yorickpeterse>
<insert bad joke about fapping>
<judofyr>
:D
sush24 has joined #ruby-lang
maxmanders has quit [Client Quit]
<yorickpeterse>
hmpf, either I have to patch String to add #snake_case or I have to add some helper module/class
<yorickpeterse>
not sure which one is worse
<yorickpeterse>
inb4 refinements
nXqd has quit [Ping timeout: 252 seconds]
<judofyr>
what's wrong with Utils.snake_case?
<yorickpeterse>
that could work too, the alternative is something like `unless instance_methods.include?(:snake_case); ....; end`
nXqd has joined #ruby-lang
<judofyr>
why not #respond_to?
<yorickpeterse>
That won't work when in a class body since that will evaluate the respond_to on class level
<whitequark>
also t.cc:9: error: no match for 'operator+' in '(((a*)P) + (*(long int*)(P->foo::<anonymous>.a::_vptr$a + -0x00000000000000020)))->a::bar() + * P'
<whitequark>
gcc is awesome :3
<yorickpeterse>
DiagnosticEngineBuilderDiagnostic
<yorickpeterse>
.factory
<whitequark>
the sad part is that it is actually required to have all of getLineNumber, getSpellingLineNumber, getExpansionLineNumber and getPresumedLineNumber
runeb has joined #ruby-lang
<whitequark>
though WTF is the last
* judofyr
turned his browser into greyscale this Easter
<whitequark>
judofyr: y?
<judofyr>
whitequark: dunno really. I stumbled upon an aprilFools.css that contained various tricks for messing with custom stylesheets (the idea being adding it to a co-workers computer)
<whitequark>
oooh crap
<whitequark>
clang's diagnostic reporting involves several various kinds of LRU caches
<whitequark>
and also paging. paging!
* whitequark
wonders if it's turing-complete and/or if it is possible to implement an OS with it
<Technodrome>
any of you guys winning?
<yorickpeterse>
with?
<Technodrome>
heh stupid question maybe :)
<Technodrome>
well at this time in my life i equate winning == getting money
<Technodrome>
and maybe let's say >10k a week would be "winning" but of course less than that would be "doing well"
drumond19 has quit [Remote host closed the connection]
<whitequark>
money is overrated
<abstr4ct>
greater than 10k a week? thats very good
<Technodrome>
abstr4ct: hence the term "winning"
<abstr4ct>
just under half a mill a year
<abstr4ct>
hrm most people consider 80k a year to winning.
<Technodrome>
well, as I said its perspective
<Technodrome>
80k a year for many is good living for sure, depending on where you live
<andrewvos>
yorickpeterse: Yeah and it installed with a .pkg file too so I probably have crap lying around now.
<andrewvos>
yorickpeterse: Well the point is that the web ui is limited.
mytrile has joined #ruby-lang
runeb has quit [Read error: Connection reset by peer]
wallerdev has quit [Quit: wallerdev]
cesar274 has joined #ruby-lang
Nisstyre-laptop has joined #ruby-lang
cesar274 has quit [Read error: Connection reset by peer]
<zachlatta>
So it's general practice to not use them?
<yorickpeterse>
yes
<zachlatta>
Alright, thanks!
<yorickpeterse>
np
cored has quit [Ping timeout: 245 seconds]
maxmanders has joined #ruby-lang
<zachlatta>
I updated https://gist.github.com/zachlatta/30ad8c997ac076df21a4 to reflect the change you suggested. I'm still getting undefined method'each' for nil:NilClass (NoMethodError) though. Any idea why it wouldn't be instantiating correctly?
thebastl has joined #ruby-lang
cored has joined #ruby-lang
cored has quit [Changing host]
cored has joined #ruby-lang
<yorickpeterse>
zachlatta: works for me. If you're on Ruby 1.9 make sure you use `require './wordlist'` since "." is no longer in the load path
<zachlatta>
That's probably my issue. Let me try that.
thebastl has quit [Remote host closed the connection]
stev_____ has joined #ruby-lang
<zachlatta>
Same issue.
<zachlatta>
Let me update to Ruby 2.0. Currently running the version that comes with macs.
stev_____ has left #ruby-lang [#ruby-lang]
ssssss has joined #ruby-lang
<yorickpeterse>
eh, wat
<zachlatta>
?
ssssss has left #ruby-lang [#ruby-lang]
<yorickpeterse>
unless you have some seriously broken Ruby setup that should work fine
Gaelan has joined #ruby-lang
<zachlatta>
I've been meaning to compile it from source anyways.
<yorickpeterse>
use ruby-build for that and save yourself trouble
ssssss has joined #ruby-lang
<ssssss>
How would I do this in ruby? [1,2,3,4] -> [[1,2],[3,4]] ?
<zachlatta>
Really sorry for being stupid and wasting your time.
<drbrain>
zachlatta: nah, it's cool
<drbrain>
I made typos like that all the time when I was first learning stuff
<whitequark>
mbj: OK
<mbj>
whitequark: Expect commits. Walking through the code changing all the method calls.
<drbrain>
unfortunately there wasn't a nice IRC channel like this one, or any paste services, to point out the simple things I did wrong
<yorickpeterse>
Fuck you Ruby, fuck you for having a recursive list of the same constants
<whitequark>
mbj: yep. I'll probably write them again like that in the future--I don't really notice the difference between two styles--feel free to change them as you see fit.
<mbj>
whitequark: thx for accepting that change. I can read code with that specific style fastest, I'm trained ;)
<ssssss>
How would I do this in ruby, e.g. create links between my array items? [1,2,3,4] -> [[1,2], [2,3], [3,4]]
<whitequark>
ssssss: array.each_cons(2)
<mbj>
whitequark: BTW I only use parentheses for methods that take arguments! No so you'll not see foo.bar()
<ssssss>
whitequark: thanks :-)
<whitequark>
ssssss: I think it's the first time in my life when that method was useful
<whitequark>
what are you using it for?
<whitequark>
mbj: sure
<ssssss>
I have a list of points, and I want to draw lines between them. Making the array a list of joined points seems nicer than iterating and remembering the last point as I go, if that makes sense
<mbj>
whitequark: Problem to use strict CQS, command methods that mutate state return self, query methods the query result and do NOT mutate the instance.
<mbj>
whitequark: So attr writers would return self.
<whitequark>
ssssss: you cau use array.each_cons(2) do |first, second| ... end
<whitequark>
mbj: yeah I see your point. that particular method isn't used in that fashion but it's better that way nevertheless
<mbj>
whitequark: I follow CQS very strictly, reduces longterm error count.
<mbj>
whitequark: Are you used to metric tools such as flay / flog / reek ?
<mbj>
whitequark: Especially flay is very good in helping to find duplicated code / duplicated structures.
<whitequark>
mbj: I use codeclimate
<whitequark>
all these tools will fail on autogenerated code, which is the majority of code in parser
<mbj>
whitequark: Codeclimate uses flay internally, but it is not very strict. Typicall code we wrote for dm2 core libs is A once I push the first time.
sush24 has quit [Quit: This computer has gone to sleep]
cms has quit [Remote host closed the connection]
<mbj>
whitequark: I'll add these tools and ignore autogenerated stuff?
<whitequark>
it's the same reason actually. require 'parser/ruby19' won't require 'parser'
<mbj>
whitequark: parser/ruby19 could require 'parser'
<whitequark>
mbj: but then it will also require parser/18 parser/20 etc
<mbj>
whitequark: Than lets add parser/dependencies
<whitequark>
thus pulling in all the stuff I have tried to avoid pulling in
<mbj>
whitequark: So parser/ruby19 could pull that file.
<mbj>
whitequark: Just like parser/{18,20}
<whitequark>
mbj: I have a better idea: let's have parser/all which pulls parser and parser/ruby{18,19,20}
<whitequark>
and parser will pull in everything else
<mbj>
whitequark: yeah
<mbj>
whitequark: good one.
<mbj>
whitequark: Changeing
nertzy2 has joined #ruby-lang
<mbj>
whitequark: There will only be one leyer for 18 19 and 20 ?
<mbj>
s/leyer/lexer/
<whitequark>
mbj: yes
<whitequark>
the changes to lexer are insignificant
Gaelan has quit [Remote host closed the connection]
<whitequark>
well, not significant enough to mandate forking it
<mbj>
yeah
breakingthings has joined #ruby-lang
Gaelan has joined #ruby-lang
<mbj>
whitequark: From specs I typically only do require '$main_lib_here'
<mbj>
whitequark: No "selective require"
nertzy has quit [Ping timeout: 240 seconds]
<whitequark>
mbj: why not?
<whitequark>
it encourages decoupling
<mbj>
whitequark: So we do not have to care if each class / module under test can act like a require entry point.
<mbj>
whitequark: Lets say we test foo/bar/baz
<mbj>
whitequark: Do we now foo/bar/baz knows to require all the dependencies in correct order?
<yorickpeterse>
whitequark: you don't happen to have some code lying around that fetches all constants of X recursively? The stuff I have shits up for some reason (sec)
<mbj>
whitequark: Maintaining all files as possible require entrypoints is a pain in the ass.
<yorickpeterse>
it bars because of a SystemStackError due to File/Dir being recursive somehow
<yorickpeterse>
even though the ignore list should prevent that from happening
<whitequark>
mbj: ok
<mbj>
whitequark: This project is aimed to be small, but IMHO it is good pratcies to only explicitly maintain specific entrypoints. {parser,parser/{all,18,19,20}} in our case.
<whitequark>
mbj: you have a point, yea
cms has quit [Remote host closed the connection]
<mbj>
whitequark: Sorry for reparsing ;) thx for accepting.
S1kx has joined #ruby-lang
S1kx has quit [Changing host]
S1kx has joined #ruby-lang
S2kx has quit [Ping timeout: 256 seconds]
<mbj>
whitequark: I'll not add parentheses for assertions n tests. I typically consider the assertion methods as keywords.
<mbj>
whitequark: Just when parsing mentally.
<whitequark>
mbj: ... you don't want to know how exactly parenthesesized arguments to keywords are handled
<whitequark>
you REALLY don't want to know.
<mbj>
whitequark: heh
* whitequark
cries
<mbj>
whitequark: I read through the lexer already, it is understandable but for now I only scratched the surface.
<whitequark>
mbj: I'll soon have the Ruby Hacking Guide chapter 11 translated from Japanese, it explains the MRI lexer in detail
<mbj>
whitequark: yeah
<whitequark>
the Ragel lexer is a far descendant of the MRI lexer with most of weird quirks removed, but RHGc11 still helps
<mbj>
whitequark: Isnt there good information about lexing in the ruby iso standard?
<whitequark>
mbj: nope, it only provides the formal grammar
<mbj>
whitequark: EBNF?
<whitequark>
it could be used as an input to a PEG parser, maybe, after quite a few adjustments. but not more
<whitequark>
mbj: EBNF, yes.
<mbj>
whitequark: on my ever growing "to read" list ;)
<mbj>
yorickpeterse: If you access a constant in a scope such as Foo::Bar and Bar is NOT defined in Foo BUT defined in :: (toplevel) you get a warning and the toplevel one returned.
<yorickpeterse>
Yes, but the odd thing here is that Rbx behaves differently
<yorickpeterse>
e.g. Dir.constants *does* return a list of constants
<whitequark>
yorickpeterse: rbx is odd in a lot of places.
<yorickpeterse>
God damn it, this explains my stack error I think
drumond19 has joined #ruby-lang
<mbj>
I do not like the "use toplevel const with warning" behavior. I hope the warning is a sign this behavior will be removed in future versions of ruby.
<whitequark>
mbj: btw, consider adding yourself to LICENSE.txt and README as a contributor
<mbj>
whitequark: Will do so, once I think my contribution is significant enough
<whitequark>
mbj: also do you think if it's a good idea to move LexerLiteral under lexer/ and Lexer:: ?
<whitequark>
it's actually a part of lexer extracted into another file for readability
<mbj>
whitequark: This was on my "to speak about" list ;)
<mbj>
whitequark: I prefer single substantive namespaces
<mbj>
whitequark: So Parser::Lexer::Literal would be perfect for me.
<whitequark>
very well
<mbj>
whitequark: Also I expect we can have a Parser::Environment::{Static,Dynamic,Whatever} on the longterm.
<whitequark>
mbj: no, it's only StaticEnvironment.
<whitequark>
it's finished
<whitequark>
"static environment" is a CS term.
<mbj>
whitequark: CS term > SingleNounRule !
<whitequark>
:D
<mbj>
nice
judofyr has quit [Remote host closed the connection]
amerine has joined #ruby-lang
<mbj>
whitequark: Back in around 2h driving. Moving back from family easter business ;)
mbj has quit [Quit: leaving]
tcopp has joined #ruby-lang
thufir_ has joined #ruby-lang
Gaelan has quit [Remote host closed the connection]
Qwak has joined #ruby-lang
Gaelan has joined #ruby-lang
Gaelan has quit [Remote host closed the connection]
Gaelan has joined #ruby-lang
madb055 has joined #ruby-lang
Gaelan has quit [Remote host closed the connection]
ubersapiens has quit [Ping timeout: 245 seconds]
Asher has quit [Quit: Leaving.]
Gaelan has joined #ruby-lang
tsion has joined #ruby-lang
tsion has quit [Changing host]
tsion has joined #ruby-lang
Asher has joined #ruby-lang
hakunin has joined #ruby-lang
<whitequark>
antonym to "assign"?
<whitequark>
"get"? "read"? "query"?
<whitequark>
or, more precisely, I need an antonym to "assignable"
symm- has joined #ruby-lang
bzalasky has quit [Remote host closed the connection]
amerine has quit [Quit: Computer has gone to sleep.]
ruby-lang670 has joined #ruby-lang
tcopp has quit [Ping timeout: 240 seconds]
runeb has joined #ruby-lang
fire has quit [Ping timeout: 256 seconds]
Ridders24 has joined #ruby-lang
<Ridders24>
anyone used axlsx ?
vlad_starkov has joined #ruby-lang
bin7me has joined #ruby-lang
runeb has quit [Ping timeout: 256 seconds]
vlad_starkov has quit [Ping timeout: 260 seconds]
Technodrome has quit [Quit: Technodrome]
fire has joined #ruby-lang
bzalasky has joined #ruby-lang
dc5ala has quit [Quit: Ex-Chat]
bzalasky has quit [Remote host closed the connection]
MehLaptop has joined #ruby-lang
bzalasky has joined #ruby-lang
bzalasky has quit [Remote host closed the connection]
Gaelan has quit [Remote host closed the connection]
Gaelan has joined #ruby-lang
mbj has joined #ruby-lang
ledestin has quit [Quit: ledestin]
media_slave has joined #ruby-lang
tylersmith has joined #ruby-lang
Ridders24 has quit [Quit: Leaving]
Squee-D has joined #ruby-lang
Gaelan has quit [Remote host closed the connection]
Gaelan has joined #ruby-lang
media_slave has quit [Client Quit]
thufir_ has quit [Quit: Leaving.]
tylersmith has quit [Client Quit]
media_slave has joined #ruby-lang
media_slave has quit [Client Quit]
media_slave has joined #ruby-lang
drumond19 has quit [Remote host closed the connection]
media_slave has quit [Client Quit]
rippa has quit [Ping timeout: 240 seconds]
Technodrome has joined #ruby-lang
media-slave24 has joined #ruby-lang
hakunin has quit [Remote host closed the connection]
hakunin has joined #ruby-lang
james has joined #ruby-lang
james is now known as Guest2859
Guest2859 has left #ruby-lang [#ruby-lang]
Squee-D has quit [Quit: The computer fell asleep]
beawesomeinstead has quit [Remote host closed the connection]
akahn has quit [Write error: Broken pipe]
grandy has quit [Write error: Broken pipe]
wycats__ has quit [Write error: Broken pipe]
madb055 has quit [Quit: Konversation terminated!]
media-slave24 has left #ruby-lang [#ruby-lang]
srbaker has joined #ruby-lang
akahn has joined #ruby-lang
grandy has joined #ruby-lang
wycats__ has joined #ruby-lang
beawesomeinstead has joined #ruby-lang
sepp2k has quit [Quit: Leaving.]
ykk` has quit [Remote host closed the connection]
srbaker has quit [Quit: Computer has gone to sleep.]
srbaker has joined #ruby-lang
<whitequark>
oooh crap
glebm has quit [Ping timeout: 272 seconds]
<whitequark>
I need to proof-read 33 pages of 10pt text
<whitequark>
GHCc11 translation has arrived.
glebm has joined #ruby-lang
<whitequark>
this is going to be a lot of work.
<mbj>
whitequark: Why SourceFile is mutable?
<mbj>
whitequark: I think two classes such as Source::String, Source::File would allow immutable implementations.
<mbj>
whitequark: An interface such as Source::File.read('foo.rb') would remove the need for current SourceFile#read mutator.
<whitequark>
mbj: because SourceFile will be referenced by the entire Sexp tree
<mbj>
whitequark: A reason more to make it immutable!
<whitequark>
... and if you need to parse a lot of files, this is going to translate to significant amount of memory
<whitequark>
even if you don't need to keep the source in memory.
<mbj>
whitequark: The lexer needs to read the source so as long as Source#string returns a string we do not have to cache it in the instance?
symm- has quit [Ping timeout: 240 seconds]
<mbj>
whitequark: This will not solve the cases where an explicit source is string is given.
<mbj>
whitequark: I'll just accept it for now as is. Lets see where it goes.
<whitequark>
mbj: this issue is more complex than that.
<whitequark>
see, the SourceFile class will be used by Diagnostic and DiagnosticsEngine to output snippets of the source with highlighted locations of errors
<whitequark>
for this, you need the entire source
<whitequark>
(also, SourceFile will have on-demand caching of newline positions, so we can't just freeze it)
<whitequark>
but on the other hand, in a lot of use cases you don't need to emit any Diagnostic-s after you've got the sexps
<mbj>
whitequark: But why need the ability to exchange #source ?
<whitequark>
mbj: I don't really need the ability to exchange it. I do need the ability to clear it.
<mbj>
whitequark: To free memory
<whitequark>
yeah.
<whitequark>
since sexps are immutable, this would be the only way
<mbj>
whitequark: Why cant we assign a new SourceFile instance, because it was referenced so many times...
<mbj>
whitequark: Understood.
<mbj>
whitequark: Thx.
<mbj>
whitequark: I'm thinking about a solution, there is always one. But it takes time.
<mbj>
whitequark: I'll accept it for now.
<whitequark>
sure
zachlatta has quit [Read error: Connection reset by peer]
crynix has joined #ruby-lang
lcdhoffman has joined #ruby-lang
ruby-lang670 has quit [Ping timeout: 245 seconds]
sepp2k has joined #ruby-lang
ykk` has joined #ruby-lang
scottschecter has quit [Quit: WeeChat 0.4.0]
Ridders24 has joined #ruby-lang
<Ridders24>
can xlsx be appended?
<Ridders24>
sorry, can xlsx files be appended?
<Aria>
Not without editing. They're zipped XML.
<crynix>
Is the standard amount of spaces for a tab 2? Or is it user-defined.
<crynix>
*user-preference
<r0bglees0n>
2 spaces.
<r0bglees0n>
also known a "soft tabs".
<havenwood>
+1 2-space soft-tabs
<ggreer>
2 or 4 depending on how indentation-heavy your code is :)
<ggreer>
but never 3. only heretics use 3 spaces
<havenwood>
ggreer: Absolutely heretical to 4-space Ruby!
<ggreer>
I usually end up in callback hell in javascript, so I use 2 spaces there
<ggreer>
but in python and ruby I use 4
<havenwood>
ggreer: At least 3-space is avant guard!
<havenwood>
s/guard/guarde
<ggreer>
heh
<r0bglees0n>
ggreer: common practice is 2 spaces, though.
<havenwood>
garde**
<ggreer>
yeah I don't mind 2 spaces
<ggreer>
or 3 really, although I rarely see 3
<havenwood>
ggreer: Seems to me that in Python there is a real choice of 2 or 4 spaces, but Ruby is solely 2. I jest about 3. :P
<havenwood>
Actually, now that I think about it... how odd that Python has a choice and Ruby is set in its ways. Opposite of Ruby's normal TIMTOWTDI ethos.
<ggreer>
weird. I could have sworn I used 4 spaces
<havenwood>
4 is gross.
<ggreer>
I think it depends on how wide your screen is and how many indentations you go to
<zenspider>
whitequark: how the hell do you come up with these?
<rue>
zenspider: He grows them in a lab, I’ve seen the jars.
<zenspider>
they must smell bad
mytrile has quit [Remote host closed the connection]
Ridders24 has quit [Ping timeout: 240 seconds]
<whitequark>
zenspider: I have an FSM engine in my head.
<whitequark>
zenspider: also if you're interested I have a preliminary translation of RHG chapter 11
Ridders24 has joined #ruby-lang
<whitequark>
about the finite-state-machine MRI lexer
<Ridders24>
crynix: i have a loop that outputs twitter info into what was a tsv file, however i wanted to out the info into an xlsx file, how can i get it to put each tweet on a new line rather than over writing the last
<crynix>
I'm really not the person to ask, as I'm not very familiar with Ruby. You could try building a string and writing the entire thing to a file (this might be wrong).
MehLaptop has quit [Remote host closed the connection]
<zenspider>
whitequark: wrt the tern stack state thing... I'm gonna have to go diffing against history, but I don't think it can be removed.
<zenspider>
I think I'm prolly missing a test mixing ternaries and ?x lits
<zenspider>
which... blows.... but there ya go
<whitequark>
fuck. fuck. fuck. fuck. fuck. do you know what I've just paid $500 to look at?!
<whitequark>
Finally, the definition of `COND_LEXPOP()` looks a bit strange – that seems to be a way of dealing with lookahead. However, the rules now do not allow for lookahead to occur, so there’s no purpose to make the distinction between `POP` and `LEXPOP`. Basically, at this time it would be correct to say that `COND_LEXPOP()` has no meaning.
<whitequark>
HAS. NO. MEANING.
* whitequark
proceeds to bang his head on the nearest wall.
<zenspider>
I recommend a desk
<zenspider>
you get more torque bending that way
<whitequark>
zenspider: the tern stack state is missing in 1.9 and 2.0 MRI lexers
<zenspider>
you should come to my cafe... marble tabletops at navel height. you can really bash your brains in that way
<whitequark>
don't you think I've just removed it mindlessly :S
<whitequark>
hrm, also in 1.8 lexer
<zenspider>
whitequark: that doesn't mean I can't remove it. not until I stop sharing my lexer code across impls
scottschecter has joined #ruby-lang
<whitequark>
zenspider: I've grepped ruby_parser and it was not used anywhere else.
<zenspider>
I know. that's why I said I needed to look at history
<whitequark>
'k
<zenspider>
I had a couple pull requests that hit that code and it may have removed something it shouldn't have
<zenspider>
basically, I need to figure out if I _am_ missing a test
<whitequark>
zenspider: btw I finally decided to split my code into my own test and simply make an RP compatibility layer
<zenspider>
if I am, then I need to decide if ressurecting the old tern code is the right way to go
<whitequark>
err, my own gem
<zenspider>
did you ever address your speed issues?
<whitequark>
I'll still prepare a PR with the new lexer for you, though
drumond19 has joined #ruby-lang
m4t_ has joined #ruby-lang
<whitequark>
zenspider: yes, kind of. in fact there were no speed issues
<zenspider>
I can't take it if it is 3x slower ... I think that's what you said back in the day
<whitequark>
I should've only measured the time taken by successful tests; exception raising is really slow
anildigital_work has quit [Remote host closed the connection]
herpless___ has quit [Remote host closed the connection]
Spaceghost|cloud has quit [Remote host closed the connection]
Guest85414 has quit [Remote host closed the connection]
beawesomeinstead has quit [Remote host closed the connection]
grandy has quit [Write error: Broken pipe]
randym has quit [Write error: Broken pipe]
<whitequark>
so I think it should be faster now. plus I solved the Unicode problem without losing any speed (I thought that would be a big perf hit).
<whitequark>
(faster than RP lexer)
<zenspider>
if in benchmarks at least as fast as my stuff, then I'm more than happy to fold it in. I have NO love for my lexer.
<zenspider>
it is a fucking PITA
akahn has quit [Remote host closed the connection]
wycats__ has quit [Remote host closed the connection]
<zenspider>
that won't die
thejspr_ has quit [Remote host closed the connection]
UziMonkey__ has quit [Remote host closed the connection]
norplr has quit [Remote host closed the connection]
ruby-lang772 has joined #ruby-lang
<zenspider>
anyhow... I need to practice my talk and I'm procrastinating
<zenspider>
bbi30
<whitequark>
k sure
mwjcomputing has joined #ruby-lang
ruby-lang772 has quit [Client Quit]
JEG2 has joined #ruby-lang
arturo has joined #ruby-lang
arturo has left #ruby-lang [#ruby-lang]
mytrile has joined #ruby-lang
o7yhjvgdty has joined #ruby-lang
lcdhoffman has quit [Quit: lcdhoffman]
o7yhjvgdty has quit [Client Quit]
symm- has joined #ruby-lang
Ridders24 has quit [Ping timeout: 245 seconds]
agarie has joined #ruby-lang
ledestin has joined #ruby-lang
mytrile has quit [Remote host closed the connection]
mytrile has joined #ruby-lang
<crynix>
How would I write for(int i = 0; i < 10; i++) in Ruby?
media-slave24 has joined #ruby-lang
<whitequark>
crynix: 10.times { |i|
media-slave24 has left #ruby-lang [#ruby-lang]
MaddinXx has quit [Remote host closed the connection]
<crynix>
woah
<crynix>
elegant
<whitequark>
yep.
KU0N has joined #ruby-lang
<KU0N>
Hello
JEG2 has left #ruby-lang ["Leaving..."]
<crynix>
Is there a do while in ruby?
media-slave24 has joined #ruby-lang
media-slave24 has left #ruby-lang [#ruby-lang]
lele has quit [Quit: Coyote finally caught me]
<KU0N>
Is it possible to have the memory usage of an object and all it's reference?
wycats__ has joined #ruby-lang
mytrile has quit [Remote host closed the connection]
lcdhoffman has joined #ruby-lang
ykk` has quit [Remote host closed the connection]
mytrile has joined #ruby-lang
UziMonkey__ has joined #ruby-lang
TheNotary has joined #ruby-lang
mytrile has quit [Remote host closed the connection]
mytrile has joined #ruby-lang
s0ber_ has joined #ruby-lang
<r0bglees0n>
crynix: begin; expr; end while expr.
lele has joined #ruby-lang
s0ber has quit [Ping timeout: 260 seconds]
s0ber_ is now known as s0ber
TheNotary has quit [Client Quit]
anildigital_work has joined #ruby-lang
bin7me has quit [Quit: Verlassend]
Ridders24 has joined #ruby-lang
<whitequark>
ROFL
<whitequark>
`EXPR_CMDARG` stands for “Before the first parameter of `command_call`” and is excluded. But wait, this meaning is also included in `CMDARG_P()`. Thus, the final conclusion of this section:
<whitequark>
EXPR_CMDARG is completely useless
Ridders24 has quit [Client Quit]
<whitequark>
Truth be told, when I realized this, I almost broke down crying. I was sure it had to mean SOMETHING and spent enormous effort analyzing the source, but couldn’t understand anything. Finally, I ran all kind of tests on the code using `rubylex-analyser` and arrived at the conclusion that it has no meaning whatsoever.
tsion has quit [Disconnected by services]
Guest85414 has joined #ruby-lang
semajs has joined #ruby-lang
blacktulip has quit [Remote host closed the connection]