<shevy>
not sure, you have to ask those who are good at tests. I found it very boring to write tests
<shevy>
I guess it may be easier to integrate them from the get go
<Nawn>
talking about TDD?
KnownSyntax_ has quit [Ping timeout: 272 seconds]
<Mirubiri>
testing is fun
banisterfiend has joined #ruby
<elomatreb>
I was sold on writing solid tests for my applications after a "bundle update" broke one and I had to debug for hours
<shevy>
one obvious benefit, aside from the disadvantage that it may be boring, is that you can ensure a certain sense of realiability of your code, that, at the least during the conditions that you tested for and evaluate, it would work in a reproducible manner
l4v2 has quit [Quit: l4v2]
<Nawn>
I liked that I could change any code, and with one line in the command line, I can make sure that Everything I have already checked for still is
<Nawn>
still works*
<shevy>
also have a look at the graphics at https://wiki.debian.org/ReproducibleBuilds - while this has not much to do with testing in ruby, it has a little bit to do with managing packages in general in a reproducible manner; it's also why I think the NixOS philosophy is cool and how fpm vaguely taps into it; nixos should promise that you can re-build any target-set of packages that go along together and work
<Mirubiri>
BDD is the way to go in enterprise ruby development
skade has quit [Quit: Computer has gone to sleep.]
cyphase has quit [Ping timeout: 258 seconds]
SuperLag has joined #ruby
DeltaHeavy has quit [Ping timeout: 260 seconds]
SuperLag_ has quit [Ping timeout: 276 seconds]
macsteps has quit [Remote host closed the connection]
speakingcode has quit [Ping timeout: 272 seconds]
blackmesa has joined #ruby
cyphase has joined #ruby
Mirubiri has quit [Quit: -]
Guest60828 has quit [Ping timeout: 276 seconds]
jackjackdripper has quit [Quit: Leaving.]
<leea>
is it possible to stub ARGV?
Guest60828 has joined #ruby
LoneHerm_ has quit [Remote host closed the connection]
blackmesa has quit [Ping timeout: 250 seconds]
<shevy>
not sure, you can handle it as regular input to methods
Nawn has quit [Remote host closed the connection]
<shevy>
either like in a class: def initialize(commandline = ARGV); Foobar.new(ARGV)
<shevy>
hmm
<shevy>
it is tainted input by default though
djbkd has quit [Quit: My people need me...]
RegulationD has quit [Remote host closed the connection]
em0ral has quit []
devbug has quit [Quit: ZZZzzz…]
ledestin has joined #ruby
l4v2 has joined #ruby
mjuszczak has joined #ruby
mjuszczak has quit [Client Quit]
nettoweb has quit [Ping timeout: 272 seconds]
Mirubiri has joined #ruby
<drbrain>
leea: yes, it's just a constant: $ ruby -e 'p ARGV; ARGV.replace ["bye"]; p ARGV' -- hello
roshanavand has quit [Quit: This computer has gone to sleep]
ramfjord has quit [Ping timeout: 240 seconds]
mattwashere has joined #ruby
karapetyan has quit [Remote host closed the connection]
karapetyan has joined #ruby
madgen has quit [Ping timeout: 244 seconds]
flashpoint9 has joined #ruby
Dimik has joined #ruby
freeman1337 has joined #ruby
macsteps has joined #ruby
minimalism has joined #ruby
leea has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
flashpoint9 has quit [Ping timeout: 250 seconds]
<dunpeal>
I have an array of Hahses. In an RSpec test, how do I make sure they are all (recursively) equal?
mattwashere has quit [Remote host closed the connection]
<dunpeal>
(They only contain simple core Ruby objects: either Strings, or Arrays/Hashes of Arrays, Hashes, or Strings.
mattwashere has joined #ruby
zeroDi has quit [Quit: WeeChat 1.5]
flashpoint9 has joined #ruby
matp has quit [Ping timeout: 252 seconds]
drewo has joined #ruby
drewo has quit [Client Quit]
mattwashere has quit [Ping timeout: 272 seconds]
isberg has quit [Remote host closed the connection]
jackjackdripper has joined #ruby
SilverKey has joined #ruby
xall has joined #ruby
<freeman1337>
Hey dunpeal, I'm curious about this as well. Does the array structure change atall?
dminuoso has joined #ruby
kab has quit [Read error: Connection reset by peer]
<drbrain>
array.reduce(:==).reduce(:&) ?
dfockler has quit [Ping timeout: 272 seconds]
<drbrain>
as in [{a: 1}, {a: 1}, {b: 1}] ?
<dunpeal>
freeman1337: what do you mean?
<dunpeal>
drbrain: yes
<dunpeal>
what does .reduce(:&) do?
<dunpeal>
oh, logical end.
<dunpeal>
nice.
<drbrain>
yes, since && is syntax
<drbrain>
if you want to see which one is non-equal use: array.each_cons(2).with_index { |(a, b), i| puts "pair #{i} is not equal" unless a == b }
<drbrain>
↑ more user-friendly
jackjackdripper has quit [Ping timeout: 276 seconds]
dvinciguerra_ has joined #ruby
dminuoso has quit [Ping timeout: 240 seconds]
marr has quit [Ping timeout: 276 seconds]
<Mirubiri>
expect([{a:1},{a:1}, {a:1}}).to all include({a:1}) something like that dunpeal ?
araujo_ has joined #ruby
araujo has quit [Ping timeout: 240 seconds]
freeman1337 has quit [Remote host closed the connection]
isberg has joined #ruby
araujo_ has quit [Max SendQ exceeded]
araujo_ has joined #ruby
<drbrain>
this is why I'm not a big fan of rspec, instead of just writing some ruby and being done I have to wrap my problem in an API that is less expressive than ruby
flashpoint9 has quit [Remote host closed the connection]
flashpoint9 has joined #ruby
<Mirubiri>
drbrain: why less expressive?
lunaelli has joined #ruby
flashpoint9 has quit [Ping timeout: 250 seconds]
karapetyan has quit [Remote host closed the connection]
blackmesa has joined #ruby
whathappens has quit [Remote host closed the connection]
roamingdog has joined #ruby
macsteps has quit [Remote host closed the connection]
JesseH has quit [Remote host closed the connection]
blackmesa has quit [Ping timeout: 260 seconds]
RegulationD has joined #ruby
elifoster has quit [Quit: adios]
hutch34_ has joined #ruby
Ropeney has joined #ruby
RegulationD has quit [Ping timeout: 260 seconds]
jaguarmagenta has joined #ruby
ur5us has quit [Remote host closed the connection]
speakingcode has joined #ruby
ur5us has joined #ruby
CloCkWeRX has joined #ruby
cdg has quit [Remote host closed the connection]
replay has quit []
cdg has joined #ruby
GodFather has quit [Ping timeout: 276 seconds]
Sucks has joined #ruby
DoubleMalt has quit [Ping timeout: 244 seconds]
cdg has quit [Ping timeout: 252 seconds]
Hobogrammer has joined #ruby
nando293921 has joined #ruby
Dimik has quit [Ping timeout: 260 seconds]
cd-rum_ has joined #ruby
cd-rum has quit [Ping timeout: 260 seconds]
davedev24 has quit []
DoubleMalt has joined #ruby
leea has joined #ruby
cd-rum has joined #ruby
giz|work has joined #ruby
ng-repeat has joined #ruby
<ng-repeat>
im trying to run a cucumber step from within the at_exit function
<ng-repeat>
its working from the Before block
<ng-repeat>
steps %Q{Given this is my step}
<ng-repeat>
but i get undefined method 'steps' when i include that same line inside at_exit
<ng-repeat>
any ideas how i can call a cucumber step definition at the end of a test run?
mitt3ns has joined #ruby
cd-rum_ has quit [Ping timeout: 276 seconds]
brianpWins has quit [Quit: brianpWins]
kus has joined #ruby
kus has quit [Max SendQ exceeded]
Vingador has quit [Remote host closed the connection]
<mitt3ns>
Evenin' folks.
agent_white has quit [Disconnected by services]
mitt3ns is now known as agent_white
GNUYawk has quit [Quit: GNUYawk]
flashpoint9 has joined #ruby
leea has quit [Ping timeout: 276 seconds]
DeltaHeavy has joined #ruby
skweek has joined #ruby
flashpoint9 has quit [Remote host closed the connection]
flashpoint9 has joined #ruby
moeabdol has joined #ruby
A_Drone has joined #ruby
moeabdol has quit [Ping timeout: 240 seconds]
flashpoint9 has quit [Ping timeout: 258 seconds]
LvcasX1 has joined #ruby
LvcasX1 has quit [Remote host closed the connection]
nadir has joined #ruby
dminuoso has joined #ruby
sent-hil has joined #ruby
hutch34_ has quit [Quit: WeeChat 1.5]
leea has joined #ruby
griffindy has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
devbug has joined #ruby
dminuoso has quit [Ping timeout: 276 seconds]
blackmesa has joined #ruby
macsteps has joined #ruby
speakingcode has quit [Ping timeout: 276 seconds]
dvinciguerra_ has quit [Ping timeout: 264 seconds]
speakingcode has joined #ruby
blackmesa has quit [Ping timeout: 240 seconds]
macsteps has quit [Ping timeout: 252 seconds]
enterprisey has joined #ruby
A_Drone has quit [Remote host closed the connection]
A_Drone has joined #ruby
griffindy has joined #ruby
SilverKey has quit [Quit: Halted.]
LoneHerm_ has joined #ruby
mattwashere has joined #ruby
<dunpeal>
drbrain: thanks, nice code.
DanKnox_ is now known as DanKNox
DanKNox is now known as DanKNnox
DanKNnox is now known as DanKnox
DanKnox has quit [Max SendQ exceeded]
DanKnox has joined #ruby
shevy has quit [Ping timeout: 264 seconds]
shevy has joined #ruby
dunpeal has quit [Ping timeout: 260 seconds]
DeltaHeavy has quit [Ping timeout: 272 seconds]
saneax is now known as saneax_AFK
bmn has quit [Quit: obai]
eljimbo has quit [Quit: This computer has gone to sleep]
DeltaHeavy has joined #ruby
JesseH has joined #ruby
bmn has joined #ruby
rpad has joined #ruby
A_Drone has quit [Remote host closed the connection]
A_Drone has joined #ruby
A_Drone has quit [Remote host closed the connection]
A_Drone has joined #ruby
JesseH has quit [Read error: Connection reset by peer]
roamingdog has quit [Remote host closed the connection]
LoneHerm_ has quit [Remote host closed the connection]
Bish has quit [Ping timeout: 240 seconds]
griffindy has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Bish has joined #ruby
matp has joined #ruby
jenrzzz_ has quit [Ping timeout: 264 seconds]
rikai has quit [Ping timeout: 276 seconds]
rpad has quit [Remote host closed the connection]
Cohedrin_ has joined #ruby
Cohedrin has quit [Ping timeout: 264 seconds]
araujo__ has joined #ruby
mattwashere has quit [Remote host closed the connection]
ekem has quit [Excess Flood]
mattwashere has joined #ruby
ekem has joined #ruby
braincrash has quit [Quit: bye bye]
araujo_ has quit [Ping timeout: 258 seconds]
smathy has joined #ruby
dminuoso has joined #ruby
perry has quit [Ping timeout: 244 seconds]
unforgiven512 has quit [Ping timeout: 250 seconds]
fullstack has quit [Ping timeout: 240 seconds]
Lightsword has quit [Ping timeout: 264 seconds]
voxxit has quit [Ping timeout: 240 seconds]
justinmcp has quit [Quit: No Ping reply in 180 seconds.]
Nilium has quit [Ping timeout: 244 seconds]
unforgiven512 has joined #ruby
thai_ has quit [Ping timeout: 244 seconds]
pipework has quit [Ping timeout: 264 seconds]
justinmcp has joined #ruby
mattwashere has quit [Ping timeout: 264 seconds]
Nilium has joined #ruby
pipework has joined #ruby
crystal77 has joined #ruby
cdg has joined #ruby
thai_ has joined #ruby
Dimik-- has joined #ruby
dminuoso has quit [Ping timeout: 252 seconds]
perry has joined #ruby
perry has quit [Changing host]
perry has joined #ruby
Lightsword has joined #ruby
fullstack has joined #ruby
guacamole has quit [Ping timeout: 244 seconds]
fullstack has quit [Max SendQ exceeded]
smathy has quit [Ping timeout: 260 seconds]
blackmesa has joined #ruby
guacamole has joined #ruby
fullstack has joined #ruby
RegulationD has joined #ruby
aibot has quit [Ping timeout: 260 seconds]
gbailey has quit [Ping timeout: 244 seconds]
mclee has quit [Ping timeout: 244 seconds]
ericlee has joined #ruby
A_Drone has quit [Remote host closed the connection]
blackmesa has quit [Ping timeout: 264 seconds]
hahuang65 has quit [Quit: WeeChat 1.5]
k3rn31 has joined #ruby
giz|work has quit [Ping timeout: 240 seconds]
Bish has quit [Ping timeout: 250 seconds]
isberg has quit [Remote host closed the connection]
voxxit has joined #ruby
braincras has joined #ruby
RegulationD has quit [Ping timeout: 240 seconds]
gbailey has joined #ruby
ericlee has quit [Ping timeout: 250 seconds]
leea has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
KnownSyntax has quit [Quit: Once you know what it is you want to be true, instinct is a very useful device for enabling you to know that it is]
A_Drone has joined #ruby
Bish has joined #ruby
fredolinhares has quit [Quit: WeeChat 1.5]
mclee has joined #ruby
k3rn31 has quit [Quit: Computer has gone to sleep.]
yfeldblum has quit [Remote host closed the connection]
Guest60828 has quit [Ping timeout: 258 seconds]
ericlee has joined #ruby
lxsameer has joined #ruby
Bish has quit [Ping timeout: 252 seconds]
craigp has quit [Ping timeout: 258 seconds]
Guest60828 has joined #ruby
matp has quit [Remote host closed the connection]
Bish has joined #ruby
LoneHerm_ has joined #ruby
hk238 has joined #ruby
Guest60828 has quit [Ping timeout: 252 seconds]
LoneHerm_ has quit [Ping timeout: 240 seconds]
theery has joined #ruby
jishankai has joined #ruby
Bish has quit [Ping timeout: 252 seconds]
Guest60828 has joined #ruby
Bish has joined #ruby
gix has quit [Ping timeout: 272 seconds]
Dimik-- has quit [Ping timeout: 252 seconds]
steve has joined #ruby
gix has joined #ruby
jenrzzz has joined #ruby
SilverKey has joined #ruby
mattwashere has joined #ruby
flashpoint9 has joined #ruby
leea has joined #ruby
enterprisey has quit [Remote host closed the connection]
mattwashere has quit [Ping timeout: 258 seconds]
whathappens has joined #ruby
craigp has joined #ruby
agent_white has quit [Quit: brb]
flashpoint9 has quit [Ping timeout: 250 seconds]
crystal77 has quit [Read error: Connection reset by peer]
dminuoso has joined #ruby
Mia has quit [Read error: Connection reset by peer]
<harrisi>
I did also try it with different indentation, but that seemed to not do anything.
<Zarthus>
I cna't say I precisely know what you're going for
aswen has joined #ruby
elaptics`away is now known as elaptics
mikecmpbll has joined #ruby
MrBusiness2 has quit [Ping timeout: 272 seconds]
<harrisi>
there are better ways to do it, I just got into this weird situation and I was wondering if there was a way to have a case statement inside of a string interpolated heredoc.
<harrisi>
I suppose specifically, is it possible to have a multiline expression be the expression used in the interpolated piece of a heredoc
<harrisi>
not that I think that's a good idea, I just didn't know what exactly was stopping me from doing what that code is doing
atom_ has joined #ruby
<ljarvis_>
harrisi: yes it's possible
Cohedrin has joined #ruby
<harrisi>
ljarvis_: could you tell me what's wrong with the code I linked to?
<ljarvis_>
nothing, what's your error(s)?
<lizard2010>
harrisi, why not prepare variable outside heredoc and insert it as usual?
<harrisi>
lizard2010: that's what I will do, this is just a random curiosity
<Volis>
I looked up the file that's responsible for setting this, it has one line `{% capture base_path %}{{ site.url }}{{ site.baseurl }}{% endcapture %}`
<Volis>
I changed the baseurl value to "" but the problem persists
<Volis>
What should I set the baseurl to avoid this problem?
CybrGhost has quit [Quit: Leaving]
flashpoint9 has joined #ruby
tmtwd has quit [Ping timeout: 276 seconds]
conta1 has joined #ruby
andikr has quit [Ping timeout: 244 seconds]
conta has quit [Ping timeout: 252 seconds]
conta1 is now known as conta
andikr has joined #ruby
flashpoint9 has quit [Ping timeout: 250 seconds]
Jet4Fire has quit []
McSoFake has quit [Quit: leaving]
alfiemax has quit [Ping timeout: 260 seconds]
skweek has joined #ruby
anisha_ has joined #ruby
anisha has quit [Read error: Connection reset by peer]
alfiemax has joined #ruby
madgen has joined #ruby
lightheaded has joined #ruby
douglascorrea has quit [Read error: Connection reset by peer]
astrobun_ has quit [Remote host closed the connection]
douglascorrea has joined #ruby
hipertracker has joined #ruby
lightheaded has quit [Ping timeout: 276 seconds]
tmtwd has joined #ruby
cd-rum has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
lacce has joined #ruby
giz|work has joined #ruby
rodfersou has joined #ruby
Nahra has joined #ruby
ledestin has joined #ruby
karapetyan has joined #ruby
M-mistake has joined #ruby
lightheaded has joined #ruby
blackmesa has quit [Ping timeout: 264 seconds]
ryez has left #ruby [#ruby]
Macaveli has joined #ruby
Wildfyr has joined #ruby
bweston92 has quit [Read error: Connection reset by peer]
RegulationD has joined #ruby
tmtwd has quit [Ping timeout: 240 seconds]
Eiam has quit [Ping timeout: 260 seconds]
seth has quit [Ping timeout: 252 seconds]
Madplatypus has quit [Quit: Connection closed for inactivity]
RegulationD has quit [Ping timeout: 276 seconds]
douglascorrea has quit [Ping timeout: 244 seconds]
mdw has joined #ruby
LoneHerm_ has quit [Read error: Connection reset by peer]
tvw has quit []
raeoks has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Macaveli has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
mdw has quit [Max SendQ exceeded]
conta has quit [Ping timeout: 240 seconds]
mdw has joined #ruby
douglascorrea has joined #ruby
LoneHerm_ has joined #ruby
conta has joined #ruby
blackmesa has joined #ruby
johnmilton has quit [Remote host closed the connection]
dumdedum has quit [Ping timeout: 276 seconds]
ICantCook has quit [Ping timeout: 264 seconds]
pawnbox has quit [Remote host closed the connection]
douglascorrea has quit [Read error: Connection reset by peer]
douglascorrea has joined #ruby
seth has joined #ruby
AlexJakeGreen has quit [Quit: Leaving]
w0lf has joined #ruby
<w0lf>
hi there
bhaak has quit [Ping timeout: 260 seconds]
<w0lf>
when i try to run bundle install it says no such command
alfiemax has quit [Ping timeout: 250 seconds]
roamingdog has joined #ruby
<Wildfyr>
try `which bundle`
lightheaded has quit []
roamingdog has quit [Remote host closed the connection]
roamingdog has joined #ruby
haxrbyte_ has quit [Remote host closed the connection]
haxrbyte has joined #ruby
<Mon_Ouie>
Did you install the bundler gem?
skade has joined #ruby
harfangk has joined #ruby
Guest60828 has quit [Ping timeout: 240 seconds]
conta1 has joined #ruby
sdothum has joined #ruby
eprasad has joined #ruby
hipertracker has quit [Quit: hipertracker]
conta has quit [Ping timeout: 276 seconds]
conta1 is now known as conta
hipertracker has joined #ruby
moeabdol has quit [Ping timeout: 252 seconds]
chipotle has joined #ruby
<shevy>
:)
Guest60828 has joined #ruby
moeabdol has joined #ruby
the_drow has quit [Quit: This computer has gone to sleep]
bhaak has joined #ruby
harfangk has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
GodFather has joined #ruby
pawnbox has joined #ruby
<w0lf>
Mon_Ouie, yes i did
<w0lf>
gem install bundler
blackmesa has quit [Ping timeout: 252 seconds]
Pupp3tm4st3r has quit [Remote host closed the connection]
Pupp3tm4st3r has joined #ruby
<Mon_Ouie>
Then your PATH environment variable is probably not set up correctly. `gem' warns you when you about this when you install a gem that has executables.
<jhass>
w0lf: how did you install Ruby?
<w0lf>
Successfully installed bundler-1.12.5
<w0lf>
Parsing documentation for bundler-1.12.5
<w0lf>
Done installing documentation for bundler after 7 seconds
skade has quit [Quit: Computer has gone to sleep.]
Guest60828 has quit [Ping timeout: 276 seconds]
<w0lf>
jhass, using rvm
douglasc_ has joined #ruby
<jhass>
make a gist with your rvm info and gem env output please
<jhass>
?gist
<ruby[bot]>
https://gist.github.com - Multiple files, syntax highlighting, even automatically with matching filenames, can be edited
douglascorrea has quit [Read error: Connection reset by peer]
Nahra has quit [Ping timeout: 244 seconds]
dumdedum has joined #ruby
nadir has joined #ruby
Guest60828 has joined #ruby
marr has quit [Read error: Connection reset by peer]
DeltaHeavy has joined #ruby
Pupp3tm4st3r has quit [Ping timeout: 240 seconds]
tfitts has quit [Quit: Connection closed for inactivity]
alfiemax has joined #ruby
Diabolik has joined #ruby
Diabolik has quit [Max SendQ exceeded]
Diabolik has joined #ruby
Diabolik has quit [Excess Flood]
LoneHerm_ has quit [Remote host closed the connection]
LoneHerm_ has joined #ruby
Diabolik has joined #ruby
skweek has quit [Ping timeout: 260 seconds]
craigp has quit [Ping timeout: 272 seconds]
yoongkang has joined #ruby
astrobun_ has joined #ruby
JeanCarloMachado has joined #ruby
Volis has quit [Quit: Leaving]
astrobu__ has joined #ruby
kavanagh has quit [Quit: That's all folks!]
chipotle has quit [Quit: cheerio]
platzhirsch has joined #ruby
johnmilton has joined #ruby
astrobun_ has quit [Ping timeout: 276 seconds]
<w0lf>
no its not rvm i installed it using yum
matp has joined #ruby
chipotle has joined #ruby
blackmesa has joined #ruby
blackgoat has joined #ruby
LoneHerm_ has quit [Read error: Connection reset by peer]
<jhass>
w0lf: still show gem env then please
zotherstupidguy has joined #ruby
zotherstupidguy has quit [Changing host]
zotherstupidguy has joined #ruby
<w0lf>
jhass, ok
ur5us has quit [Remote host closed the connection]
dionysus69 has quit [Ping timeout: 240 seconds]
JeanCarloMachado has quit [Ping timeout: 272 seconds]
<no_gravity>
lizard2010: undefined method `name' for {:name=>"some"}:Hash
<shevy>
haha
<no_gravity>
I'm giving up :)
lolex has quit [Ping timeout: 264 seconds]
<shevy>
well your example used $user->name
<no_gravity>
I created the user array like this:
<no_gravity>
users=[{name:"joe"},{name:"hans"}]
<no_gravity>
Should I user => instead of : ?
<shevy>
so we can conclude that it was an object that had this method or slot? If it is a hash though, you can use .fetch()
<no_gravity>
well, users is an array
<no_gravity>
And I thought that by using {} the users are objects..
<hirvi>
no_gravity: try user['name'] instead of user.name
<lizard2010>
array of hashes
<shevy>
I see
<no_gravity>
":" makes a hash?
<no_gravity>
Or {}?
<lizard2010>
read the docs? (=
<shevy>
you have put [{}] there
<lizard2010>
{}
<shevy>
so a hash put into an array
<shevy>
if you don't need the array, it may be simpler to just work with the hash
<giz|work>
Hash.new definately makes a hash
<giz|work>
as well :)
<shevy>
indeed!
A124 has joined #ruby
anisha_ has quit [Quit: This computer has gone to sleep]
<no_gravity>
Well, in JS this creates an array of objects: users=[{name:"joe"},{name:"hans"}]
moei has joined #ruby
<no_gravity>
Would you not use an array of objects in ruby?
<lizard2010>
In ruby - all are objects
<no_gravity>
Hmm...
<Papierkorb>
no_gravity: Ruby is not broken like JS in that regard.
<Papierkorb>
no_gravity: Create a proper class if you want something like that
jaguarmagenta has quit [Ping timeout: 240 seconds]
<no_gravity>
Proper classes are so 90s.
<lizard2010>
(=
ledestin has quit [Ping timeout: 276 seconds]
<no_gravity>
Can't I use this? users=[{name:"joe"},{name:"hans"}]
daivyk has joined #ruby
blackgoat has quit [Ping timeout: 240 seconds]
<lizard2010>
you can use this
<no_gravity>
So what do I have then?
blackmesa has joined #ruby
* lizard2010
shrug
<no_gravity>
In JS I have an array with two objects.
<lizard2010>
array of hashes.
<lizard2010>
every hashes and array at total are objects
<no_gravity>
so ok, i have an array of hashes.
<lizard2010>
so you can call @users.count
pdoherty has joined #ruby
<no_gravity>
Would that be a good choice to store a bunch of users?
<jhass>
no_gravity: users is an array of hashes, {name: "joe"} is a shortcut to {:name => "joe"}. You iterate the array with .each, you access the hash value by its key with [], so users.each do |user| puts user[:name]; end
<lizard2010>
or same other objects method
<no_gravity>
jhass: damn, that worked!
<jhass>
no_gravity: probably fine for now, turn it into a an array of instances of your own class User once you feel the desire to call methods on it
<no_gravity>
I have to say this does not look too elegant to me: users.each do |user| puts user[:name]; end
<no_gravity>
It feels a bit like bash.
<lizard2010>
if you declare User's class metod's (=
<lizard2010>
hah, continue use php (=
<no_gravity>
What does the |user| part do?
moei has quit [Quit: Leaving...]
<lizard2010>
declare cycle variable
<lizard2010>
*block
<dminuoso>
no_gravity: I recommend you start with a Ruby book or guide.
ledestin has joined #ruby
<lizard2010>
analog of your «as $user)»
<dminuoso>
It beats asking us about all the basic syntax things.
<lizard2010>
from foreach
<lizard2010>
+1 for dminuoso
<no_gravity>
What if I create my users like this? users=[["name"=>"joe"],["name"=>"doe"]]
<no_gravity>
Is it then easier to iterate over them?
moei has joined #ruby
<lizard2010>
and after metaprogramming for full love ruby
andikr has quit [Remote host closed the connection]
<lizard2010>
no_gravity, same level
<no_gravity>
I see
<jhass>
no_gravity: that's the same as [[{"name" => "joe"}], [{"name" => "doe"}]]
<hirvi>
why do you consider users.each {|user| puts user[:name]} inelegant?
pawnbox has joined #ruby
<no_gravity>
jhass: And I still have to |jump| through; all those [:hoops] to iterate?
<jhass>
even more then
<no_gravity>
omg
mikecmpb_ has joined #ruby
<jhass>
>> ["foreach($users as $user)", "users.each do |user|"].map {|s| [s, s.size] }.to_h # btw
<ruby[bot]>
jhass: # => {"foreach($users as $user)"=>24, "users.each do |user|"=>20} (https://eval.in/608759)
kavanagh has quit [Ping timeout: 240 seconds]
<jhass>
it's shorter
mdw has joined #ruby
mdw has quit [Max SendQ exceeded]
<lizard2010>
he likes foreach more (=
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #ruby
<no_gravity>
Yeah, foreach is how I like it.
<no_gravity>
:)
mdw has joined #ruby
mikecmpbll has quit [Ping timeout: 240 seconds]
blackmesa has quit [Ping timeout: 276 seconds]
<jhass>
you'll get over it, for starters try to write the above snippet in PHP
<no_gravity>
Which one?
<jhass>
my last one?
mbreedlove has quit [Ping timeout: 252 seconds]
<no_gravity>
What does it do?
Akuma has joined #ruby
AngryBuzzy has quit [Quit: This computer has gone to sleep]
<jhass>
I don't think you even spend 5 seconds on trying to understand
mbreedlove has joined #ruby
<no_gravity>
You think wrong.
<jhass>
well, look at its output, reproduce it
araujo has joined #ruby
<no_gravity>
It outputs some weird stuff.
araujo has quit [Max SendQ exceeded]
kavanagh has joined #ruby
iMadper` has joined #ruby
ledestin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
davedev24 has joined #ruby
edwinvdgraaf has quit [Remote host closed the connection]
edwinvdgraaf has joined #ruby
mattwashere has joined #ruby
<shevy>
it outputs what you tell it to output
no_gravity has left #ruby [#ruby]
iMadper has quit [Ping timeout: 240 seconds]
et09 has joined #ruby
<lizard2010>
php have eat hin
<lizard2010>
*him
macsteps has joined #ruby
mikecmpbll has joined #ruby
mattwashere has quit [Remote host closed the connection]
exchgr has joined #ruby
mattwashere has joined #ruby
synthroid has quit [Remote host closed the connection]
flashpoint9 has quit [Remote host closed the connection]
Snowy has joined #ruby
DaniG2k has quit [Quit: leaving]
georgedrummond has joined #ruby
mattwashere has quit [Read error: Connection reset by peer]
mattwashere has joined #ruby
mikecmpb_ has quit [Ping timeout: 240 seconds]
l4v2 has quit [Quit: l4v2]
synthroid has joined #ruby
nmollerup has quit [Ping timeout: 250 seconds]
SilverKey has joined #ruby
pxqxvk has joined #ruby
macsteps has quit [Remote host closed the connection]
zotherstupidguy has quit [Quit: WeeChat 1.5]
et09 has quit [Quit: leaving]
conta1 has joined #ruby
l4v2 has joined #ruby
freeman1337 has joined #ruby
ddffg has joined #ruby
conta has quit [Ping timeout: 260 seconds]
conta1 has quit [Read error: Connection reset by peer]
Okuu has joined #ruby
conta has joined #ruby
<shevy>
good :)
Ropeney has joined #ruby
cdg has quit [Remote host closed the connection]
nhhc has quit [Quit: Leaving]
Ropeney has quit [Client Quit]
cdg has joined #ruby
georgedrummond has quit [Quit: Lost terminal]
armyriad has quit [Ping timeout: 250 seconds]
SilverKey has quit [Quit: Halted.]
l4v2 has quit [Quit: l4v2]
saneax is now known as saneax_AFK
mbreedlove has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
yardenbar has joined #ruby
armyriad has joined #ruby
RegulationD has joined #ruby
ChiefAlexander has quit [Remote host closed the connection]
mbreedlove has joined #ruby
mbreedlove has quit [Max SendQ exceeded]
lxsameer has quit [Quit: WeeChat 1.5]
mattwashere has quit [Remote host closed the connection]
mbreedlove has joined #ruby
mattwashere has joined #ruby
mattwashere has quit [Read error: Connection reset by peer]
jhack has joined #ruby
mattwashere has joined #ruby
RegulationD has quit [Ping timeout: 250 seconds]
solars has quit [Ping timeout: 240 seconds]
dikaio has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
ChiefAlexander has joined #ruby
devster31 has joined #ruby
yoongkang has quit [Remote host closed the connection]
rodfersou is now known as rodfersou|afk
dminuoso has quit [Ping timeout: 276 seconds]
Es0teric has quit [Remote host closed the connection]
alexherbo2 has joined #ruby
lolex_ has quit [Remote host closed the connection]
tvw has joined #ruby
eljimbo has joined #ruby
flashpoint9 has joined #ruby
flashpoint9 has quit [Remote host closed the connection]
underplank has joined #ruby
dminuoso has joined #ruby
mattwashere has quit [Remote host closed the connection]
bmn has quit [Quit: obai]
mattwashere has joined #ruby
ifsp has quit [Quit: WeeChat 1.4]
blackmesa has joined #ruby
craigp has quit [Ping timeout: 244 seconds]
<raldu>
what is the best way to package a small script that can be installed to, say, /usr/local/bin/, and that is *not* a gem?
klaas has quit [Read error: Connection reset by peer]
CharlesN has joined #ruby
JeanCarloMachado has quit [Ping timeout: 276 seconds]
<shevy>
have it a single .rb file, let the user copy it to that path; you can provide an internal way to copy it to that path too, on first run, unless it is not already there
blackmesa has quit [Ping timeout: 264 seconds]
rippa has joined #ruby
<raldu>
shevy: thanks for the idea. what about setup.rb? the script may also have a configuration file and tests. but it is still a single file script.
dionysus69 has quit [Ping timeout: 258 seconds]
aupadhye has quit [Quit: Leaving]
DeltaHeavy has joined #ruby
<shevy>
your requirement was /usr/local/bin
speakingcode has quit [Ping timeout: 276 seconds]
<shevy>
setup.rb will use the local path at where site dir is, e. g. if someone has ruby at /Programs/Ruby/2.3.1, it will... I think... go to /Programs/Ruby/2.3.1/lib/ruby/site_ruby/2.3.0/ - something like that
dionysus69 has joined #ruby
<shevy>
unsure whether you can use setup.rb to install into some other target area
<jhass>
raldu: just make it a gem
ChiefAlexander has quit [Remote host closed the connection]
<shevy>
hmm setup.rb supports --installdirs= and --rubypath=path
davedev24 has quit [Read error: Network is unreachable]
davedev24 has joined #ruby
pawnbox has quit [Ping timeout: 272 seconds]
dennisvennink has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rcvalle has joined #ruby
SilverKey has joined #ruby
RegulationD has joined #ruby
elaptics is now known as elaptics`away
pawnbox has joined #ruby
govg has joined #ruby
Madplatypus has quit [Quit: Connection closed for inactivity]
platzhirsch has quit [Quit: WeeChat 1.4]
Pupp3tm4st3r has quit [Remote host closed the connection]
Guest60828 has quit [Ping timeout: 240 seconds]
nanoz has joined #ruby
RegulationD has quit [Ping timeout: 250 seconds]
Guest60828 has joined #ruby
zacts has joined #ruby
mistermocha has quit [Remote host closed the connection]
dylankarr has joined #ruby
pawnbox has quit [Ping timeout: 250 seconds]
whathappens has quit [Remote host closed the connection]
whathappens has joined #ruby
mistermocha has joined #ruby
dylankarr has quit [Client Quit]
hahuang65 has joined #ruby
hipertracker has joined #ruby
Madplatypus has joined #ruby
pawnbox has joined #ruby
RegulationD has joined #ruby
karapetyan has joined #ruby
mistermocha has quit [Client Quit]
postmodern has joined #ruby
whathapp_ has joined #ruby
whathappens has quit [Read error: Connection reset by peer]
karapetyan has quit [Ping timeout: 276 seconds]
whathapp_ has quit [Remote host closed the connection]
whathappens has joined #ruby
mdw has joined #ruby
lolex_ has quit []
hipertracker has quit [Quit: hipertracker]
tango has joined #ruby
madgen has joined #ruby
douglasc_ has joined #ruby
douglascorrea has quit [Read error: Connection reset by peer]
xall has joined #ruby
whathappens has quit [Ping timeout: 244 seconds]
mdw_ has quit [Ping timeout: 264 seconds]
mdw has quit [Client Quit]
CodeAleks has joined #ruby
hipertracker has joined #ruby
darkxploit has joined #ruby
dionysus69 has quit [Remote host closed the connection]
araujo has quit [Read error: Connection timed out]
araujo has joined #ruby
mikecmpbll has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
araujo has quit [Max SendQ exceeded]
araujo has joined #ruby
roshanavand has quit [Quit: This computer has gone to sleep]
Sucks has joined #ruby
blackmesa has quit [Ping timeout: 264 seconds]
jaguarmagenta has quit [Remote host closed the connection]
jaguarmagenta has joined #ruby
sergey_makagon has joined #ruby
iwaffles has quit [Quit: iwaffles]
karapetyan has joined #ruby
antgel has quit [Ping timeout: 244 seconds]
JeanCarloMachado has quit [Read error: Connection reset by peer]
JeanCarloMachado has joined #ruby
ddffg has quit [Ping timeout: 240 seconds]
jaguarmagenta has quit [Ping timeout: 276 seconds]
duoi has quit [Ping timeout: 250 seconds]
CybrGhost has quit [Quit: Leaving]
memorasus has quit [Ping timeout: 272 seconds]
duoi has joined #ruby
pawnbox has quit [Ping timeout: 276 seconds]
Technodrome has joined #ruby
elifoster has joined #ruby
Pupp3tm4st3r has joined #ruby
spider-mario has joined #ruby
kirun has joined #ruby
<dminuoso>
chrisseaton: One thing that confuses me, is where most of the performance is lost in CRuby in comparison to graalvm/truffle
<dminuoso>
After the initial warm up, I did not expect graalvm/truffle to perform 40x faster than CRuby - at all.
<headius>
why not?
<headius>
CRuby doesn't even have a JIT
<dminuoso>
headius: Perhaps it's my ignorance of why JIT actually works that well.
<headius>
well apart from getting the overhead of an interpreter out of the way, you can inline methods and get better optimization of the whole
<dminuoso>
Well CRuby isn't really interpreted either since the VM.
<headius>
it's definitely interpreted
<dminuoso>
headius: You could technically precompile a file and load the InstructionSequence from file and execute it.
<headius>
yes, and it runs in the interpreter
<dminuoso>
Ah.
<Papierkorb>
dminuoso: From my understanding, Graal understands the intention when you do "[ 4, 5 ].max" to not create an array, but actually just do the operation you had in mind. Stuff like this really adds up
<headius>
it's a bytecode interpreter, similar to JVM
<headius>
unlike JVM or JRuby or Truffle, they don't proceed on to a JIT ever
pawnbox has joined #ruby
LoneHerm_ has joined #ruby
<Papierkorb>
headius: on this topic, how's Graal coming along? Is there any easy to use JAR I could try without installing extra/special software?
<headius>
Papierkorb: chrisseaton knows the current status but I believe there's still hoops to jump through
<headius>
last time I saw someone try to play with it they had to build Graal themselves
<headius>
things are moving rather fast but it's still a good ways out from general use
<Papierkorb>
headius: Will be really interesting to see how it compares performance-wise against Elixir and Crystal
<headius>
I wouldn't expect Elixir to compare at all
<jhass>
I think [4, 5].max is not the best example, it needs to be special cased either way (and will be in CRuby 2.4)
karapetyan has quit [Remote host closed the connection]
<headius>
jhass: it's more than that specific pattern
chipotle has quit [Read error: Connection reset by peer]
<jhass>
yes
<Papierkorb>
People were like "Wow, Elixir is 6x faster than ruby!". Wasn't as impressed *hides*
<headius>
it could be [a, b, c, d, e].max and it still optimizes through it
<dminuoso>
headius: Do such JIT compilers actually reorder bytecode, or are the optimizations locally on the machine code generated?
karapetyan has joined #ruby
<lupine>
only 6x as fast?
<headius>
Papierkorb: heh, JRuby's 5-10x faster than CRuby already
<lupine>
that's pretty disappointing
<headius>
for compute-heavy loads
<Papierkorb>
lupine: I /heard/, never tried as I'm not interested really in that language eitherway
weaksauce has quit [Ping timeout: 240 seconds]
<lupine>
least it's not crystal ^^
douglasc_ has quit [Read error: Connection reset by peer]
chipotle has joined #ruby
finisherr has joined #ruby
araujo_ has joined #ruby
memorasus has joined #ruby
mattwashere has quit [Read error: Connection reset by peer]
LoneHerm_ has quit [Ping timeout: 240 seconds]
douglascorrea has joined #ruby
<Papierkorb>
headius: I think I wrote a micro benchmark lately where JRuby performed pretty badly compared to MRI. Should I still forward such to you over there? (Wasn't I/O bound)
karapetyan has quit [Remote host closed the connection]
<headius>
you absolutely should
<headius>
that's almost always a bug
zacts has quit [Ping timeout: 276 seconds]
Mimorial has joined #ruby
<headius>
Papierkorb: there are a few specific areas where we have trouble matching perf, but most stuff should be much faster in JRuby
zacts has joined #ruby
kab has joined #ruby
<headius>
dminuoso: they may, yes
symm- has joined #ruby
<Papierkorb>
I was surprised too. Expected it to be even. But can't even think of what I really did, have to look at work next week if I still have the .rb lying around
iwaffles has joined #ruby
iwaffles has quit [Client Quit]
swills has joined #ruby
<headius>
the most popular JVM JIT, Hotspot, has its own internal representation that it optimizes before proceeding to machine code
blackmesa has joined #ruby
<headius>
and then the machine code gets some different sorts of optimization passes
mattwashere has joined #ruby
<dminuoso>
headius: Ah, so when some area of code is repeatedly executed, it can optimize more and more on each pass?
<headius>
Papierkorb: well please do ping me here or in #jruby
araujo has quit [Ping timeout: 276 seconds]
<headius>
dminuoso: most JITs gather profile information while the code is interpreting, and then use that to optimize the code well
<lupine>
headius: I was wondering if jruby made any efforts to persist that profile information between runs, actually
<headius>
so if you have a loop calling obj.to_s all the time and it turns out "obj" is an Array, we can just check that and inline Array#to_s right there
<lupine>
might not be worth it
<headius>
lupine: we do not yet but have talked about doing it in the future
jhack has joined #ruby
roshanavand has joined #ruby
<headius>
it's difficult to know if that profile is still valid between runs, though
skweek has joined #ruby
<Papierkorb>
Would be great, I think .Net does something similar to speed up starting performance
yfeldblum has joined #ruby
<Papierkorb>
Or they tried or something. Not a .Net dev.
tango has quit [Read error: Connection reset by peer]
chosen1 has joined #ruby
<lupine>
mm, can't imagine ruby makes it easy
<dminuoso>
headius: It sounds like an interesting topic, perhaps I should dig a little deeper by reading a book or two on the subject.
banisterfiend has joined #ruby
jhack has quit [Client Quit]
johnmilton has quit [Remote host closed the connection]
SilverKey has quit [Quit: Halted.]
hipertracker has quit [Quit: hipertracker]
SilverKey has joined #ruby
douglasc_ has joined #ruby
douglascorrea has quit [Read error: Connection reset by peer]
<headius>
Papierkorb: .NET does a one-time compile from IL to native, and never optimizes again
zacts has quit [Ping timeout: 276 seconds]
<headius>
at least, last I read about it they didn't ever optimize again, and had no profiling happening in that generated binary
<headius>
CLR generally starts faster but runs slower than JVM
Rickmasta has quit [Remote host closed the connection]
hipertracker has joined #ruby
[Butch] has quit [Quit: I'm out . . .]
dminuoso has quit [Quit: Lost terminal]
douglascorrea has joined #ruby
dminuoso has joined #ruby
moeabdol2 has quit [Ping timeout: 250 seconds]
douglasc_ has quit [Read error: Connection reset by peer]
troulouliou_div2 has quit [Quit: Leaving]
<chrisseaton>
dminuoso: hello
<chrisseaton>
dminuoso: you understand that a C program and a Ruby program could have the same output but the C program be much simpler and so much faster? Well that's because the Ruby interpreter does things in a more complicated way than necessary. Our JIT tries to figure out what work isn't needed and avoids doing it.
<chrisseaton>
dminuoso: the output of this benchmark is 22, but you can see how much Ruby code runs to work that out
solars has joined #ruby
<chrisseaton>
dminuoso: a JIT can think about all that Ruby code, and simplify it to the single value 22, and output a single machine instruction to return that result, instead of executing any code (I'm simplifying, it's not quite like that in reality)
zacts has joined #ruby
zapata has joined #ruby
<chrisseaton>
dminuoso: if you are still interested in knowing more I can talk you through some more examples in DM
postapocallyptic has joined #ruby
c355e3b has quit [Quit: Connection closed for inactivity]
<postapocallyptic>
http://pastebin.com/4HExeUDr <--- this code doesn't output the desired results. How can I fix this?
<postapocallyptic>
I want to create an array of the class Print_number and then I want to run the printme command in a thread, but for some reason it doesn't execute properly. only a few instances of the elements in the array gets their method called.
cdg has joined #ruby
rubyist429 has joined #ruby
roshanavand has quit [Quit: This computer has gone to sleep]
angrycat has joined #ruby
CodeAleks has quit [Remote host closed the connection]
whathappens has quit [Ping timeout: 252 seconds]
<angrycat>
Hi, are all exceptional events considered exceptions?
macsteps has joined #ruby
Ishido has joined #ruby
<jhass>
ymmv, for most people probably yes
<jhass>
there usually has to be a "can't handle it here" character to them too
alfiemax has joined #ruby
ffgghhj has joined #ruby
<angrycat>
Ok, thanks
RegulationD has quit [Remote host closed the connection]
<dminuoso>
chrisseaton: Thank you for your response. I just finished reading through that blog post, and there quite a few interesting bits in there.
Technodrome has quit [Remote host closed the connection]
<dminuoso>
chrisseaton: Perhaps we could talk about this further on another day, as I'm about to leave.
yoongkang has joined #ruby
dennisvennink has joined #ruby
angrycat has quit [Ping timeout: 260 seconds]
Guest60828 has quit [Ping timeout: 276 seconds]
roshanavand has joined #ruby
macsteps has quit [Remote host closed the connection]
aswen has quit [Quit: WeeChat 1.5]
SilverKey has quit [Quit: Halted.]
mdw has joined #ruby
blackmesa has quit [Ping timeout: 252 seconds]
jaguarmagenta has joined #ruby
yoongkang has quit [Ping timeout: 258 seconds]
shinnya has quit [Ping timeout: 252 seconds]
drahosj_ is now known as drahosj
SilverKey has joined #ruby
nanoz has quit [Read error: Connection reset by peer]
blackmesa has joined #ruby
jaguarmagenta has quit [Remote host closed the connection]
EvilJStoker has quit [Remote host closed the connection]
JStoker has quit [Remote host closed the connection]
papercode has quit [Quit: WeeChat 0.4.3]
skade has joined #ruby
chipotle has quit [Ping timeout: 276 seconds]
weaksauce has quit [Ping timeout: 240 seconds]
chipotle has joined #ruby
Dimik has joined #ruby
chipotle has quit [Max SendQ exceeded]
chipotle has joined #ruby
craigp has quit [Ping timeout: 264 seconds]
bgmarx has joined #ruby
johnmilton has joined #ruby
JStoker has joined #ruby
EvilJStoker has joined #ruby
bgmarx has left #ruby [#ruby]
skade has quit [Read error: Connection reset by peer]
<rubyist429>
Hi, I'm having a really weird issue with extending Nokogiri::XML::Document. I'd like to call the superconstructor with no arguments, but that only works if the child constructor doesn't take any arguments either. Here's a minimal example: https://gist.github.com/anonymous/2478c472c1866a8c0b4f2c00705443cf (I haven't been able to reproduce it when defining the classes myself, without Nokogiri)
skade has joined #ruby
kitikonti has joined #ruby
<rubyist429>
It almost seems like the superconstructor is eating all arguments, regardless of what the child constructor is doing. I tried calling "super" and "super()", too, which doesn't make any difference. I'm running ruby 2.3.1p112. Any help is much appreciated!
<apeiros>
rubyist429: Nokogiri::XML::Document implements its own ::new as it seems
<jhass>
why do you want to subclass?
<jhass>
why can't you wrap?
johnmilton has quit [Ping timeout: 252 seconds]
johnmilton has joined #ruby
rubyist429_ has joined #ruby
papercode has joined #ruby
craigp has joined #ruby
ChiefAlexander has quit [Remote host closed the connection]
SilverKey has quit [Quit: Halted.]
SilverKey has joined #ruby
pdoherty has joined #ruby
<rubyist429_>
Sorry about that, I got disconnected for some reason. apeiros, I searched the source code but couldn't find anything; I didn't even know you could do that.
eizua has quit [Remote host closed the connection]
pior has joined #ruby
blackmesa has quit [Ping timeout: 250 seconds]
singalaut has joined #ruby
<havenwood>
zacts: yorickpeterse has tried it ;)
<havenwood>
zacts: it compiles reliably! that's a real win. :-)
pawnbox has quit [Read error: Connection reset by peer]
killerkamel has quit [Ping timeout: 276 seconds]
<yorickpeterse>
it's just OK
troulouliou_div2 has joined #ruby
wald0 has quit [Ping timeout: 264 seconds]
solars has joined #ruby
wald0 has joined #ruby
JeanCarloMachado has quit [Read error: No route to host]
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
jenrzzz has joined #ruby
tercenya has quit [Ping timeout: 244 seconds]
JeanCarloMachado has joined #ruby
nerium has joined #ruby
<zacts>
oga++
<zacts>
:-)
RegulationD has joined #ruby
<yorickpeterse>
the author is a bit of a dick though, he's very picky when reviewing changes
<yorickpeterse>
2/10 would not submit PR again
tercenya has joined #ruby
<jhass>
<3
yoongkang has joined #ruby
<jhass>
just fork it to crystal already instead!
<lupine>
yorickpeterse: oh hi :)
* lupine
files that quote away for future reference
<yorickpeterse>
jhass: lol
kavanagh has joined #ruby
moeabdol3 has quit [Ping timeout: 258 seconds]
chipotle has quit [Quit: cheerio]
<imperator>
yorickpeterse, you still maintaining oga?
RegulationD has quit [Ping timeout: 276 seconds]
<jhass>
btw is it o.g.a. or oger?
oleksandr has joined #ruby
<imperator>
Undefined prefix Oga::XML: found (REXML::UndefinedNamespaceException) - that doesn't look right
blackmesa has joined #ruby
oleksandr has quit [Client Quit]
zotherst1 has joined #ruby
blackgoat has joined #ruby
zotherstupidguy has quit [Ping timeout: 276 seconds]
futilegames has joined #ruby
yoongkang has quit [Ping timeout: 276 seconds]
<yorickpeterse>
imperator: yes?
<yorickpeterse>
jhass: OgA
<jhass>
not sure that answers the question for me :o
twinklerock has joined #ruby
<yorickpeterse>
It's just "Oga"
<jhass>
so oger :P
<yorickpeterse>
"Oga: A large two-person saw used for ripping large boards in the days before power saws. One person stood on a raised platform, with the board below him, and the other person stood underneath them."
vuoto has joined #ruby
<yorickpeterse>
"
<yorickpeterse>
The name is a pun on Nokogiri."
<yorickpeterse>
From the README :P
<jhass>
ok
<havenwood>
\ō-gə\
<yorickpeterse>
or did you mean how to pronounce it?
<jhass>
yes and no, all good
<yorickpeterse>
imperator: if you were wondering why there aren't many commits, that's because there isn't really any need for it
Amnez777 has quit [Ping timeout: 240 seconds]
<yorickpeterse>
Users aren't really reporting bugs, and I'm satisfied with the API as-is
<imperator>
not sure i understand some of the .to_s vs .to_xml implementations
<imperator>
but i'm working with it
DoubleMalt has joined #ruby
<yorickpeterse>
imperator: what exactly do you not understand? How they're implemented, or why there's to_s and to_xml?
djbkd has quit [Remote host closed the connection]
<imperator>
why they return what they return
jtd has quit [Read error: Connection reset by peer]
<yorickpeterse>
to_xml is generally recursive, so that may make things a bit confusing
chipotle has joined #ruby
djbkd has joined #ruby
<yorickpeterse>
to_s is only used in very few places, mostly for getting the text of text nodes
<yorickpeterse>
So Oga never defines #to_s and has it return XML
<yorickpeterse>
if you want XML you have to explicitly use to_xml
strass has joined #ruby
_djbkd has joined #ruby
<yorickpeterse>
.xpath returns a NodeSet, which doesn't have a custom #to_s
jaguarmagenta has joined #ruby
<imperator>
but, neither does it have .to_xml
<yorickpeterse>
correct
<imperator>
ok, so what's the oga way here?
<strass>
I am trying to get serve working to compile haml and sass. I used html2haml to convert .erbs to .haml files, but now when I try to load localhost it says it cant find index.html
djbkd has quit [Ping timeout: 240 seconds]
<strass>
I have haml in my gemfile, so I thought it'd be able to find it
<yorickpeterse>
Since a NodeSet can contain nodes from all over a document I'm not sure if serializing them back to XML in-order would be the right way to go
Amnez777 has joined #ruby
<yorickpeterse>
hence I decided not to add #to_xml
<yorickpeterse>
if you want the nodes as XML in-order the easiest way at the moment is to use .each(&:to_xml).join('')
<yorickpeterse>
errr
<yorickpeterse>
.map
<strass>
I even copied over the views folder wholesale from a bootstrap project that uses haml
Mirubiri has joined #ruby
<yorickpeterse>
also there's the interesting case that if a NodeSet contains an Element and a Text, you'd get something like "<foo />bar" which isn't valid XML
<yorickpeterse>
It's a bit of a double edged sword. Oga requires you to make certain decisions (instead of doing that for you) which can be both a blessing and a curse depending on what you're used to
seventy has joined #ruby
<rubyist429_>
I just switched my project over to Oga, by the way. I love how it's more strict than Nokogiri and the classes are less polluted. And I really don't need the performance (and potential for dangerous bugs) of native C :-)
<ruby[bot]>
strass: we in #ruby do not like pastebin.com, it loads slowly for most, has ads which are distracting and has terrible formatting. Please use https://gist.github.com
SilverKey has joined #ruby
<yorickpeterse>
rubyist429_: I think for most it should be fast enough
<imperator>
doing .each(&:to_xml).join('') gives me an Oga::XML::Element
<yorickpeterse>
and chances are if you need it to be faster you're probably not using Nokogiri's DOM API anyway
<imperator>
yorickpeterse, i'm in the "I just wanna get shit done" camp
<yorickpeterse>
imperator: sorry I meant .map(&:to_xml).join('')
Sucks has joined #ruby
roshanavand has quit [Quit: This computer has gone to sleep]
_djbkd has quit [Remote host closed the connection]
<imperator>
ah, thanks
djbkd has joined #ruby
<imperator>
i thought collect_concat would do that, but i guess not
weaksauce has joined #ruby
<rubyist429_>
It does seem pretty fast (at least I couldn't notice a difference even though I'm parsing ~ 500 relatively large files)
<rubyist429_>
thank you for this awesome project <3
<yorickpeterse>
imperator: collect_concat?
<yorickpeterse>
rubyist429_: np
<imperator>
yorickpeterse, seems to be a node method - but it's objects, not text
<yorickpeterse>
collect_concat isn't an Oga method
<yorickpeterse>
maybe something else snuck it in?
<jhass>
imperator: collect_concat is just flat_map, no?
LoneHerm_ has joined #ruby
<imperator>
oh, is it just an alias?
<jhass>
yeah
chosen1 has quit [Quit: Leaving]
<jhass>
map is aliased as collect so they had to alias flat_map to collect_concat because....
djbkd has quit [Ping timeout: 260 seconds]
sergey_makagon has quit []
umdstu has quit [Quit: umdstu]
<yorickpeterse>
lol
<jhass>
I like how the doc example for collect_concat just uses flat_map
djbkd has joined #ruby
mrgrieves has quit [Ping timeout: 258 seconds]
mdw has quit [Quit: Sleeping Zzzzz]
Pupp3tm4st3r has quit [Remote host closed the connection]
LoneHerm_ has quit [Ping timeout: 240 seconds]
jaguarmagenta has quit [Remote host closed the connection]
whathappens has joined #ruby
nankyokusei has joined #ruby
hipertracker has joined #ruby
jaguarmagenta has joined #ruby
JeanCarloMachado has quit [Ping timeout: 260 seconds]
Mon_Ouie has quit [Ping timeout: 264 seconds]
<shevy>
hah
ruby-lang253 has quit [Quit: Page closed]
mostlybadfly has quit [Quit: Connection closed for inactivity]
killerkamel has joined #ruby
futilegames has quit [Quit: futilegames]
jaguarmagenta has quit [Ping timeout: 258 seconds]
JakFrist has joined #ruby
nankyokusei has quit [Ping timeout: 276 seconds]
e4xit has quit [Quit: Right I'm out!]
eljimbo has quit [Quit: This computer has gone to sleep]
<postapocallyptic>
http://pastebin.com/4HExeUDr <--- this code doesn't output the desired results. How can I fix this?
mbreedlove has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
SCHAAP137 has quit [Ping timeout: 276 seconds]
davedev24 has joined #ruby
Nahra has joined #ruby
gchucky has joined #ruby
<gchucky>
when using UnixSocket.pair, how do you associate the two sockets to a domain socket?
<gchucky>
like, something with Dir.pwd + "/server.sock"
<postapocallyptic>
on line 38 ruby should create 10 different intances of the class, which will be accessed by each instance of the t.join call later on.
<postapocallyptic>
it it looks like ruby doesn't create anything until t.join is called, which is too late.
Nawn has joined #ruby
Nawn has quit [Remote host closed the connection]
RegulationD has joined #ruby
c355e3b has joined #ruby
Madplatypus has quit [Quit: Connection closed for inactivity]
bgmarx has joined #ruby
nerium has quit [Quit: nerium]
<jhass>
gchucky: you mean create a file for them? Are you sure that's possible at all, I mean is there a syscall to do that?
blackmesa has quit [Ping timeout: 240 seconds]
<jhass>
and why would you do that over a standard UnixServer and UnixSocket?
<gchucky>
jhass: i... im not entirely sure if it's possible, tbh
<gchucky>
basically i need two different processes to talk to each other.
dminuoso has quit [Ping timeout: 244 seconds]
<gchucky>
figured i could do that using unix sockets.
<jhass>
use DRb? :P
<gchucky>
DRb?
mbreedlove has joined #ruby
vuoto has quit [Remote host closed the connection]
<rubyist429_>
yonatankoren: one thing I noticed though -- I'm using some_node_set.to_a.select { |e| e.respond_to? :name && e.name.eql? 'something' } all over the place, wouldn't it make sense to have something like that as a method in NodeSet? Or am I doing something wrong?
<rubyist429_>
I guess I {c,sh}ould use xpath
jaguarmagenta has joined #ruby
<jhass>
gchucky: it's for when you fork one process of the other
<jhass>
you close one end in the fork and the other in the parent process and then use the respectively other one in the fork and parent
ur5us has joined #ruby
<gchucky>
ah, okay.
synthroi_ has quit []
<rubyist429_>
Yeah, this is stupid, I'll use xpath instead
JeanCarloMachado has joined #ruby
<jhass>
so in theory you could fork off your PHP process from the Ruby and pass it the FD, given PHP allows to pass an FD into their unix socket wrapper API
pawnbox has joined #ruby
imperator has quit [Quit: Leaving]
<gchucky>
sorry, FD?
<Papierkorb>
filedescriptor
<gchucky>
thought so
<gchucky>
sockets can't be bidirectional, right?
<Papierkorb>
sure they can
<jhass>
they usually are
<jhass>
pipes can't
<gchucky>
ahh.
<gchucky>
yeah.
<havenwood>
gchucky: what are you sending back and forth?
<gchucky>
json for now.
<gchucky>
right now i have ruby writing to a tmp file and having php read it, but that's wonky.
<jhass>
an alternative to IPC is a shared database, either a full RDBMS or something more specialized, say Redis
Mon_Ouie has joined #ruby
<gchucky>
true. i was hoping to avoid having a new bunch of infrastructure to spin up and maintain..
kavanagh has quit [Read error: Connection reset by peer]
yoongkang has joined #ruby
kavanagh has joined #ruby
<gchucky>
arguably i could do this with a rabbitmq install.
<jhass>
Redis is pretty good at a simple queue too
<gchucky>
true.
<jhass>
The clear advantage is that you're less likely to loose messages when the message consumer dies
<havenwood>
gchucky: or a plain ole REST API
<gchucky>
maybe i need to go back to the drawing board on this.
<jhass>
well, not saying your idea can't be appropriate
lxsameer has quit [Quit: WeeChat 1.5]
<jhass>
it's all always cost/benefit evaluation
maloik has quit [Remote host closed the connection]
<gchucky>
right.
maloik has joined #ruby
<gchucky>
maybe TCPSocket to ensure ack..
<havenwood>
gchucky: would POSTing JSON back and forth suffice?
<gchucky>
well, it's a bit heavy for what i'm trying to do.
<gchucky>
basically i need a way for a ruby script to pass data to a long-running php process, and then return the response back to ruby.
yoongkang has quit [Ping timeout: 264 seconds]
<gchucky>
super gross and ugly, but that's a whole other story.
mbreedlo_ has joined #ruby
AngryBuzzy has joined #ruby
<jhass>
UNIXSocket is basically TCP, you have the same guarantees
<gchucky>
oh, okay
<jhass>
it just skips the whole wrapping into IP and what not
mbreedlove has quit [Ping timeout: 252 seconds]
mbreedlo_ has quit [Max SendQ exceeded]
<jhass>
so your PHP script should be the server role
mbreedlove has joined #ruby
jaguarmagenta has quit [Remote host closed the connection]
<gchucky>
yeah..
<gchucky>
yeah, that's true.
<gchucky>
alright, i gotta run.
<gchucky>
thanks much for the help~
<jhass>
yw, hf
gchucky has left #ruby [#ruby]
SilverKey has quit [Quit: Halted.]
AngryBuzzy has quit [Client Quit]
smathy is now known as smathy_afk
djbkd has quit [Remote host closed the connection]
lacce has quit [Quit: Ragequit]
dionysus69 has quit [Ping timeout: 240 seconds]
blackmesa has joined #ruby
SilverKey has joined #ruby
dvinciguerra_ has quit [Ping timeout: 264 seconds]
Salve has joined #ruby
freeman1337 has quit [Quit: Leaving...]
ldnunes has quit [Quit: Leaving]
djbkd has joined #ruby
djbkd has quit [Read error: Connection reset by peer]
macsteps has joined #ruby
marr has joined #ruby
karapetyan has joined #ruby
ule has quit [Changing host]
ule has joined #ruby
djbkd has joined #ruby
spider-mario has quit [Remote host closed the connection]
karapetyan has quit [Ping timeout: 272 seconds]
eljimbo has joined #ruby
cdg has quit [Remote host closed the connection]
SilverKey has quit [Quit: Halted.]
spudowiar has joined #ruby
seventy has quit [Quit: ZNC 1.6.3+deb1+xenial0 - http://znc.in]
seventy has joined #ruby
Dreamer3 has quit [Quit: Computer has gone to sleep.]
mikecmpbll has joined #ruby
seventy has quit [Remote host closed the connection]
<dunpeal>
jhass: yeah, drbrain suggested this as a way to check if all elements in an array are unique: arr.reduce(:==).reduce(:&)
<jhass>
eh, yeah, that doesn't work
futilegames has joined #ruby
yfeldblum has quit [Remote host closed the connection]
smathy_afk is now known as smathy
yfeldblum has joined #ruby
<jhass>
.uniq.size == 1 or .each_cons(2).all? {|a, b| a == b }
fredolinhares has quit [Quit: WeeChat 1.5]
chipotle has quit [Quit: cheerio]
babblebre has joined #ruby
neanderslob has joined #ruby
kareeoleez has joined #ruby
yoongkang has joined #ruby
futilegames has quit [Ping timeout: 240 seconds]
<drbrain>
dunpeal: oops, my followup seems better, though
<drbrain>
each_cons(2).with_index …
<dunpeal>
thanks :)
arup_r has joined #ruby
ddffg has joined #ruby
arup_r has left #ruby [#ruby]
whathappens has quit [Remote host closed the connection]
hadyen has joined #ruby
whathappens has joined #ruby
<hadyen>
Hello - I'm writing a simple script to go through a directory (and all subfolders) and modifying files. If I want a progress bar for this, what's the best method for doing so? Not sure how to quickly get a count of all files without traversing everything first
Devalo has quit [Remote host closed the connection]
<jhass>
you can't
isberg has quit [Ping timeout: 276 seconds]
<jhass>
you need to list and descend into all directories to get a count
<drbrain>
↑ yep
hipertracker has joined #ruby
<twinklerock>
`find . -type f | wc -l`
<jhass>
doubt that'll be significantly faster than doing it in Ruby
<drbrain>
even rsync does it that way
kareeoleez has quit [Remote host closed the connection]
<hadyen>
hm, ok.
isberg has joined #ruby
whathappens has quit [Ping timeout: 240 seconds]
<hadyen>
I'm not really a CS guy and don't know anything about algorithms, is there any special way I should traverse directories for maximum speed? Or is glob as fast as it gets?
<drbrain>
require 'find'; Find.find
<jhass>
glob does have some overhead, since it fnmatch'es each entry
<drbrain>
CS people use libraries first
macsteps has quit [Remote host closed the connection]
<drbrain>
(source: I'm a CS person)
<hadyen>
drbrain: what library would you recommend?
<drbrain>
hadyen: Find from stdlib ↑
cd-rum has joined #ruby
Ishido has quit [Quit: Roads? Where We're Going We Don't Need Roads.]
<hadyen>
oh okay, thanks, didn't realize that was a library. Pretty new to Ruby
biberu has quit []
whathappens has joined #ruby
jgrevich has joined #ruby
cd-rum has quit [Max SendQ exceeded]
cd-rum has joined #ruby
yfeldblum has quit [Remote host closed the connection]
spudowiar has quit [Quit: zzzz?]
yoongkang has quit [Remote host closed the connection]