<matthewd>
(yes, you reallllly want to change that to cache the file contents... but still.)
f4 has quit [Remote host closed the connection]
swills has quit [Read error: Connection reset by peer]
swills has joined #ruby
gloscombe has quit [Quit: gloscombe]
h1fuelcell has quit [Remote host closed the connection]
<apeiros>
matthewd: could make that into a gem
mountpoint has joined #ruby
<BlaDe^>
what does that actually do / how do I use it?
kuSuSE has quit [Quit: Konversation terminated!]
<matthewd>
BlaDe^: What you asked for / run it at the top of your script
dviola has quit [Quit: WeeChat 1.6]
h1fuelcell has joined #ruby
<BlaDe^>
oh hey this looks awesome. understandbly slower, turns out this script does quite a lot :D
<matthewd>
apeiros: Dunno... it seems you'd want to apply a bunch of filtering to distinguish "code I care about" from "implementation detail". By the time you do that, you've written more code than the thing that does the thing.
<BlaDe^>
yeah, for example in my case it spends most of its tine in rexml which I don't really care about
<BlaDe^>
one day maybe I'll learn to ruby and do things myself :p
drorp24[m] has joined #ruby
<matthewd>
BlaDe^: Right.. so you can add an `if` around the puts, to ignore it if the path is in rexml
kuSuSE has joined #ruby
mountpoint has quit [Client Quit]
<matthewd>
BlaDe^: It's just running the block of code inside the braces, for each line executed -- so the block can be as complex as you need
<BlaDe^>
so I could do maybe |tp| unless tp.path.include?"rexml" puts ... ?
<matthewd>
Yup
<tau>
hi
<tau>
i'm drunk.
h1fuelcell has quit [Ping timeout: 248 seconds]
<tau>
does someone want to talk
<tau>
about something
<tau>
?
<matthewd>
BlaDe^: Alternatively, just exclude the path to your ruby stdlib; you likely don't care about anything happening in there
x77686d has quit [Quit: x77686d]
<matthewd>
(i.e., the part of the rexml path before 'rexml')
<tau>
i have been thinknig about some projects in ruby. is there something like event in ruby?(something similar to that that there is in javascript)?
xlegoman has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mountpoint has joined #ruby
<BlaDe^>
matthewd: that worked awesome!
<matthewd>
tau: There's the concurrent-ruby library... it probably has the most similar concepts
<matthewd>
tau: (it also has an Event class, but that's something different)
<tau>
matthewd i'm wondering whether there is something similar in ruby.
ByronJohnson has joined #ruby
herbmillerjr has quit [Quit: Konversation terminated!]
<matthewd>
BlaDe^: @doc.elements["project/parent"] is nil
enterprisey has joined #ruby
<BlaDe^>
matthewd: yeah, but on the second iteration it says that.. i'm not sure why it does two iterations, the xml file I printed has <project xmls=...."> <version>4</version> </project>
<BlaDe^>
this recursively iterates through dozens of xml files so it's a little hard to debug, and it just randomly breaks every few months, this is the most confusing breakage i've had tho
SpiffTR has quit [Read error: Connection reset by peer]
SpiffTR has joined #ruby
SpiffTR has quit [Client Quit]
nettoweb has joined #ruby
sdothum has joined #ruby
konsolebox has quit [Ping timeout: 265 seconds]
muelleme has joined #ruby
c355e3b has joined #ruby
konsolebox has joined #ruby
bturker has joined #ruby
raul782 has joined #ruby
hutch34 has joined #ruby
raul782 has quit [Ping timeout: 265 seconds]
warrshrike has joined #ruby
<warrshrike>
what is the cleanest way to access instance variables from a class instance
montanonic has quit [Ping timeout: 250 seconds]
<hanmac>
warrshrike: instance_variable_get ?
millerti has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<warrshrike>
works thnk
lxsameer has quit [Quit: WeeChat 1.6]
harfangk has joined #ruby
kuSuSE has joined #ruby
rodfersou has quit [Quit: leaving]
muelleme has quit [Ping timeout: 246 seconds]
<yorickpeterse>
warrshrike: expose them via a method
pandaant has joined #ruby
<warrshrike>
yorickpeterse: too much work
Jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
pandaant has quit [Remote host closed the connection]
<yorickpeterse>
what?
<yorickpeterse>
`def foo; @foo; end` isn't that much work
shinnya has joined #ruby
<yorickpeterse>
certainly not more than adding `some_thing.instance_variable_get(:@foo)`
<yorickpeterse>
unless you're trying to get an instance variable from some object exposed by code you don't control (e.g. a Gem)
conta has joined #ruby
lenwood has joined #ruby
<warrshrike>
Well no but
<warrshrike>
im comparing ten fields of two objects
xrlk has quit [Remote host closed the connection]
<warrshrike>
its like a recursive equality
xrlk has joined #ruby
<warrshrike>
so it seems awfully UnDRY to make 10 getter methods
d^sh has joined #ruby
<warrshrike>
its like this node1.fuzzyMatch(node2)
<warrshrike>
where all the fields are compared in fuzzeMatch
<yorickpeterse>
Aah
millerti has joined #ruby
<yorickpeterse>
Then you probably want something like `foo.instance_variables.each { |ivar| foo.instance_variable_get(ivar) == ... }`
<yorickpeterse>
or something along those lines
jcao219 has joined #ruby
<warrshrike>
well thats the issue. it isnt a simple == match rather some separate processing for each element of node is needed
d^sh has quit [Client Quit]
j416 has quit [Quit: o/]
byte512 has joined #ruby
GodFather has quit [Quit: Ex-Chat]
d^sh has joined #ruby
GodFather has joined #ruby
djellemah_ has quit [Ping timeout: 265 seconds]
GodFather has quit [Client Quit]
yaewa has quit [Quit: Leaving...]
GodFather has joined #ruby
moei has joined #ruby
bturker has quit [Ping timeout: 256 seconds]
lenwood has quit [Ping timeout: 246 seconds]
blackbom1 has joined #ruby
Jameser has joined #ruby
jetpack_joe has joined #ruby
blackbombay has quit [Ping timeout: 256 seconds]
lenwood has joined #ruby
conta has quit [Ping timeout: 250 seconds]
h1fuelce_ has joined #ruby
<warrshrike>
Whats the slickest and cleanest possible regexp solution to parse the following string "int i(java.lang.String,java.lang.String)" to give the java return type and parameter types and nil if they don't exits
<warrshrike>
exist*
<warrshrike>
I'm doing an int based solution but curious on what a good way to do it would look like
jetpack_joe has quit [Ping timeout: 250 seconds]
pior has quit [Quit: Connection closed for inactivity]
h1fuelcell has quit [Ping timeout: 246 seconds]
nettoweb has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<cinderhaze>
Hello everyone! Question for you.. I'm working on adventofcode.com day 7 problem, and I have a question about regular expressions and .match
<cinderhaze>
My initial implementation, I matched a regular expression like this, because I assumed it was in the form of pre[hyper]post... /^(?<pre>[^\[]*)\[(?<hyper>.*)\](?<post>.*)$/
<cinderhaze>
what it actually is is more like this nonhyper[hyper]nonhyper[hyper]nonhype etc...
<elomatreb>
What ?<stuff> does is give matching groups a name, I don't think that's what you wanted?
<cinderhaze>
I ALMOST have an expression that works at http://rubular.com/r/lCfXceN3bC but it shows 'match1, match2, match3' giving each of the named capture groups multiple times
<cinderhaze>
ok, now that I've put out my context, time for the actual question....
<cinderhaze>
is it possible to return a structure from .match where I can interate over it to pull out the values?
<cinderhaze>
like in the example link to rubular, it does Match 1 (outer, inner, hyper), match2(outer, inner, hyper) etc..
conta has quit [Ping timeout: 246 seconds]
<cinderhaze>
elomatreb: ?<stuff> was just for making the sections have names to make it a bit clearer what each part of the regex was for and to auto assign it to a variable name, not to actually match the parts
lenwood has quit [Ping timeout: 260 seconds]
rippa has joined #ruby
<elomatreb>
cinderhaze: Sorry, from your initial question I thought you misunderstood what that does
<cinderhaze>
what my initial regex does is match all non[ or ] chars in the first matchgroup, then match a [, then match all non [ or ] chars in the second matchgroup, then match ], then match all chars into a third matchgroup
<cinderhaze>
elomatreb: no problem... I just wasn't sure how to ask this question cleanly :)
<warrshrike>
yours is much better >> "int i(java.lang.String,java.lang.String)".match(/\A([\w\*\s]+)[\*\s]\w+\((.*?)\)?\z/).captures
<cinderhaze>
apeiros: Thanks! mystr.scan(regex) is what I was looking for!
<cinderhaze>
now what would be even nicer is if it had the named groups in it and you could pull them out like a hash, or if it was an array of MatchGroups or something, but that should be workable for my needs!
<cinderhaze>
oh... I see... in your above example, you CAN see the matchgroups in the block that you pass
<zotherstupidguy>
is it even possible to test aganist refinements in ruby??
jcao219 has quit [Ping timeout: 256 seconds]
x77686d has quit [Quit: x77686d]
<Zarthus>
why wouldn't it be
SteenJobs has quit [Quit: SteenJobs]
<Zarthus>
tests are regular ruby code, after all
<Zarthus>
just write a mock or dummy class that implements the refinement
<warrshrike>
al2o3-cr_: your regex doesnt work in this case
<rob_>
i thought you could do a multi-line ||= assignment but cant remember the syntax, can anyone refresh my memory?
ruby549 has joined #ruby
cdg has quit [Remote host closed the connection]
<ruby549>
puts "enter your name" name = gets.chomp name.each do |i| i.scan(/w/) puts i end
<ruby549>
why ruby is complaining undefine method .each for string class if example i enter name "john"
rodfersou has quit [Quit: leaving]
<warrshrike>
does ruby have a goto
raul782 has joined #ruby
<warrshrike>
or unconditional jump
<ruby549>
since i get a input from the user which is string
<elomatreb>
warrshrike: No, and it really doesn't need it
<elomatreb>
ruby549: #each is not defined for String. If you want to iterate over all the characters you could do .chars.each
_sfiguser has joined #ruby
bradleyprice has quit [Remote host closed the connection]
klaas has joined #ruby
bradleyprice has joined #ruby
raul782 has quit [Ping timeout: 250 seconds]
<ruby549>
@elomatreb ok it works
<ruby549>
but why do have to .char?
<apeiros>
or #each_char
<apeiros>
if you want to avoid the intermediary array
<elomatreb>
each iterates over every element in a collection (usually an Array). A String is not a collection nor an Array, so there is nothing to iterate over, thus each is not defined
djellemah_ has joined #ruby
bradleyprice has quit [Ping timeout: 256 seconds]
<ruby549>
but the thing is name = gets.chomp is considered array?
<apeiros>
no
<apeiros>
why do you think that ruby549?
<elomatreb>
Try putting `p name.class` in your code to see what class it is
<ruby549>
string
gloscombe has joined #ruby
<elomatreb>
So, not an Array ;)
<ruby549>
ok thx alot man
<ruby549>
i appreciate it
brendan- has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
d0nn1e has quit [Ping timeout: 250 seconds]
d0nn1e has joined #ruby
jcao219 has joined #ruby
kuSuSE has quit [Quit: Konversation terminated!]
Jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
_sfiguser has quit [Ping timeout: 264 seconds]
ruby549 has quit [Ping timeout: 260 seconds]
subscope has quit [Quit: Leaving]
warrshrike has quit [Ping timeout: 260 seconds]
nettoweb has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
_sfiguser has joined #ruby
brendan- has joined #ruby
nettoweb has joined #ruby
ryan_notabot has joined #ruby
TilakeTikka has joined #ruby
cdg has joined #ruby
ryan_notabot has quit [Remote host closed the connection]
cdg has quit [Read error: Connection reset by peer]
cdg has joined #ruby
brendan- has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
xlegoman has joined #ruby
grh has quit [Ping timeout: 250 seconds]
SteenJobs has quit [Quit: SteenJobs]
chopin_ has quit [Remote host closed the connection]
SteenJobs has joined #ruby
chopin has joined #ruby
brendan- has joined #ruby
aryaching has joined #ruby
jphase has quit [Ping timeout: 245 seconds]
giraffe has joined #ruby
tpendragon has joined #ruby
chopin has quit [Ping timeout: 248 seconds]
nickjj has quit [Read error: Connection reset by peer]
x77686d has joined #ruby
djellemah_ has quit [Quit: Leaving]
TilakeTikka has quit [Remote host closed the connection]
brendan- has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
nankyokusei has joined #ruby
FreshDumbledore has joined #ruby
<FreshDumbledore>
hi, when using array.sort_by on an array of hashes, it does work for single-digit numbers but the double-digit ones break it. like 1,2,21,3.. instead of 1,2,3..21 - how to fix it? :)
conta has joined #ruby
nankyokusei has quit [Ping timeout: 252 seconds]
<adam12>
How did a hash turn into a fixnum?
bradleyprice has joined #ruby
frozengeek has joined #ruby
synthroid has quit [Remote host closed the connection]
<adam12>
FreshDumbledore: Show some code.
synthroid has joined #ruby
<FreshDumbledore>
adam12, the hashes always have a label string and a value number. i want to sort by the number.
<FreshDumbledore>
i think i found a solution now, let me try
<apeiros>
FreshDumbledore: do you really have numbers or strings?
cdg_ has joined #ruby
<apeiros>
because "21" < "3", but 21 > 3
<FreshDumbledore>
apeiros, inside are numbers but im not sure if the interface i provide the data to requires strings or not.. but even if it does i could first sort and then convert each entry again i guess?
<FreshDumbledore>
currently its type is strings
<FreshDumbledore>
but it are numbers, actually (:
bradleyprice has quit [Ping timeout: 250 seconds]
cdg has quit [Ping timeout: 240 seconds]
synthroid has quit [Remote host closed the connection]
synthroid has joined #ruby
<apeiros>
well, that'd be why
<apeiros>
convert to numbers
<apeiros>
strings aren't numbers
<adam12>
O_o
<FreshDumbledore>
works when not doing the string convert.. thanks! checking if i really need to provide strings.. and if, ima sort and convert after
<adam12>
FreshDumbledore: Just call to_i in your sort_by method. No big deal.
<FreshDumbledore>
yep. i just dont call .to_s and it already works :D
Guest12932 has joined #ruby
<adam12>
apeiros: tell me more about these strings that aren't numbers ;)
<FreshDumbledore>
i thought i need to deliver strings.. im using this dashing website thing
<toretore>
also make sure before you convert them that they actually are numbers
<FreshDumbledore>
they are, i create that hash array from scratch based on a list of ip adresses and the geoip gem :)
gloscombe has quit [Quit: gloscombe]
<toretore>
sometimes you will get "numbers in strings" but they should not really be treated as numbers
<FreshDumbledore>
just counting where people come from xD
<FreshDumbledore>
why is the ruby syntax so.. 'special' ? :) never used it before
<FreshDumbledore>
havent seen similar in other languages.. like .sort_by! { |k| k[:value] }
mercerist has joined #ruby
<adam12>
Are you trying to sort IP addresses??
zacts has joined #ruby
<FreshDumbledore>
adam12, no im getting their country code, doing a sum of each country and sort by the amount of ips from each country
<adam12>
Oh OK.
<FreshDumbledore>
now i would like to sort descending, i tried with itemz.reverse but it doesnt work :|
<FreshDumbledore>
works in irb though
<adam12>
Ruby has syntax "borrowed" from many other languages. If you dont' recognize the syntax, you might have not worked with that particular language. Smalltalk, etc.
<FreshDumbledore>
gonna check
Vile` has joined #ruby
<adam12>
Are you still calling sort_by! ? pairing that with reverse might not work.
<FreshDumbledore>
adam12, yes i do. hmm did the same in irb thouhg and there it was fine
raul782 has quit [Read error: Connection reset by peer]
nankyokusei has quit [Ping timeout: 250 seconds]
antoniobeyah has joined #ruby
_djbkd has quit [Remote host closed the connection]
muelleme has quit [Ping timeout: 258 seconds]
djbkd has joined #ruby
TTilus has joined #ruby
nowz has quit [Quit: Leaving]
tildes has joined #ruby
djbkd has quit [Ping timeout: 258 seconds]
dopamean_ has quit [Ping timeout: 260 seconds]
nettoweb1 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
codfection has quit [Remote host closed the connection]
SpiffTR has joined #ruby
SpiffTR has quit [Client Quit]
tildes has quit [Ping timeout: 256 seconds]
antoniobeyah has quit [Quit: antoniobeyah]
zapata has quit [Quit: WeeChat 1.6]
bturker has joined #ruby
<borodin>
is there a bundler debug flag - I'm trying to run bundle inside a docker container, but I
<borodin>
I'm getting 'Network error while fetching'
<borodin>
wondering what network error it wa
claudiuinberlin has quit []
zapata has joined #ruby
<toretore>
there's a --verbose
bturker has quit [Ping timeout: 256 seconds]
dopamean_ has joined #ruby
Snickers has quit [Quit: Snickers]
z64 has quit [Ping timeout: 246 seconds]
skweek has quit [Ping timeout: 256 seconds]
Definity has joined #ruby
Channel6 has joined #ruby
naprimer_2 has quit [Ping timeout: 252 seconds]
blackbom1 has joined #ruby
s2013 has joined #ruby
modin has quit [Ping timeout: 246 seconds]
sami has quit [Ping timeout: 246 seconds]
sami has joined #ruby
matp has quit [Remote host closed the connection]
dimasg has joined #ruby
matp has joined #ruby
dimasg has quit [Client Quit]
modin has joined #ruby
johnzorn has joined #ruby
z64 has joined #ruby
_sfiguser has quit [Ping timeout: 250 seconds]
grh has joined #ruby
hutch34 has quit [Ping timeout: 246 seconds]
h1fuelce_ has quit [Ping timeout: 240 seconds]
Coldblackice has quit [Read error: Connection reset by peer]
charliesome has joined #ruby
workmad3 has quit [Ping timeout: 252 seconds]
_sfiguser has joined #ruby
harai has quit [Ping timeout: 258 seconds]
god is now known as nchambers
baweaver is now known as baweaver_away
Coldblackice has joined #ruby
Coldblackice has quit [Read error: Connection reset by peer]
erlend has quit [Ping timeout: 256 seconds]
Coldblackice has joined #ruby
sp4rrow has quit [Quit: The Internet needs a break and I need a cookie]
Puffball has quit [Remote host closed the connection]
enterprisey has quit [Ping timeout: 248 seconds]
erlend has joined #ruby
jenrzzz has joined #ruby
grh has quit [Ping timeout: 246 seconds]
Puffball has joined #ruby
SpiffTR has joined #ruby
Coldblackice has quit [Read error: Connection reset by peer]
<zacts>
ok, philosophical question.
<zacts>
well perhaps not philosophical, but
<zacts>
if I start a little web app in Sinatra, I wonder if it would be hell to reimplement it into Ruby on Rails later on
FastJack has quit [Ping timeout: 264 seconds]
<zacts>
like how well does Sinatra scale to large projects?
Coldblackice has joined #ruby
<zacts>
I wonder if I should just start from scratch with RoR from the beginning, if I think it will need to scale?
<zacts>
I just want to implement a little chat system for fun, but it may become semi-serious eventually
SpiffTR has quit [Ping timeout: 258 seconds]
erlend has quit [Ping timeout: 252 seconds]
<nofxx>
zacts, just go with ror and experiment with actioncable on the chat
erlend has joined #ruby
naprimer has joined #ruby
reverberations has quit [Read error: Connection reset by peer]
reverberations has joined #ruby
Puffball has quit [Remote host closed the connection]
koooge has joined #ruby
<zacts>
nofxx: ok, thanks
<zacts>
I'll do this
Puffball has joined #ruby
s2013 has quit [Read error: No route to host]
<adam12>
zacts: There's always Padrino
konsolebox has quit [Quit: Leaving]
<zacts>
oh, I've never heard of it
<zacts>
looks cool adam12
<zacts>
ooh Padrina sounds awesome actually
<zacts>
It sounds like it might suit my web app
<Papierkorb>
zacts: If you want to look at yet another web framework, see `Roda` by jeremy evans, the guy who also maintains `sequel` if you ever heard of that
reverberations has quit [Read error: Connection reset by peer]
reverberations has joined #ruby
<adam12>
zacts: No ActionCable obviously but I've been thinking about a messagebus plugin for Padrino...
<zacts>
Oh someone linked roda to me once, but I didn't really look at it much
<zacts>
adam12: how much of Padrino still needs to be / or is planned to be implemented