kurko_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
duderonomy has joined #ruby
involans has quit [Quit: involans]
Fernando-Basso has quit [Remote host closed the connection]
oetjenj has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
oetjenj has joined #ruby
oetjenj has quit [Client Quit]
oetjenj has joined #ruby
oetjenj has quit [Client Quit]
oetjenj has joined #ruby
oetjenj has quit [Client Quit]
oetjenj has joined #ruby
oetjenj has quit [Client Quit]
oetjenj has joined #ruby
oetjenj has quit [Client Quit]
oetjenj has joined #ruby
tdy has joined #ruby
oetjenj has quit [Client Quit]
henninb has quit [Quit: leaving]
oetjenj has joined #ruby
oetjenj has quit [Client Quit]
oetjenj has joined #ruby
oetjenj has quit [Client Quit]
oetjenj has joined #ruby
ElFerna has joined #ruby
oetjenj has quit [Client Quit]
jenrzzz has joined #ruby
admin123 has joined #ruby
<admin123>
so in ruby we prefer .each rather than for loops?
jenrzzz has quit [Ping timeout: 258 seconds]
stryek has quit [Quit: Connection closed for inactivity]
gix- has joined #ruby
gix has quit [Disconnected by services]
<Scriptonaut>
admin123: depends on what you're doing, for loops are rarely used though
<Scriptonaut>
there are many different methods to iterate over an array/string/hash/etc, just depends on what you wanna do
<admin123>
I use them alot in algorthmic challenges
<Scriptonaut>
.each, .map, .select, .reject, etc
<Scriptonaut>
so if you wanted to loop over an array, to collect/keep certain elements, you'd use select. If you wanted to remove certain elements, reject, if you wanted to map/convert the elements to something else, you'd use map
<Scriptonaut>
it's a million times nicer than using for/while for everything, though I sometimes use while loops, usually when I'm reading from a socket or something
ElFerna has quit [Quit: ElFerna]
Swyper has quit [Remote host closed the connection]
<admin123>
how do you iterate over a collection with a block and return the first match?
<Ring0`>
admin123: in sort you want to use spaceship operator <=>, because the function should return 1,0 or -1
FastJack has joined #ruby
quazimodo has quit [Ping timeout: 245 seconds]
<admin123>
I want to sort by descending by passing a block because <=> doesn't sort descending
nowhereman has quit [Read error: Connection reset by peer]
<Ring0`>
yes, then you need to reverse it
<admin123>
I end up reverse! the array, not sure if that is performant for this challange.
<Ring0`>
for some reason sort_by turns out the best in benchmarks
<Ring0`>
which also doesn't sort the way you want, forcing you to reverse
<Ring0`>
yet it's still the most performant out of inbuilt ruby sorting ways
s3nd1v0g1us has quit [Quit: WeeChat 2.4]
<Ring0`>
admin123: if you're going for the shortest, not the most performant way, you can still use normal .sort{} and spaceship operator. Just reorder the arguments (b <=> a instead of a <=> b)
<leftylink>
reversing a sort order is achieved by telling the sorting algorithm to always make the opposite decision. if the original sort order would have said A is smaller than B, instead the new sort order says B is smaller than A.
<admin123>
Ring0`: nice
DTZUZU has quit [Read error: Connection reset by peer]
DTZUZU has joined #ruby
<leftylink>
also note that for numbers, if a < b then certainly -b < -a
jenrzzz has joined #ruby
<leftylink>
this fact may be taken advantage of with Array#sort_by .
<leftylink>
since there is both a condition (implying Enumerable#select) and a transformation (implying Enumerable#map), then one would infer from that that two reasonable chocies are either to use select and map in either order, or to map to either a value or nil and then use Array#compact
tolerablyjake has quit [Remote host closed the connection]
x86sk has quit [Quit: Connection closed for inactivity]
bitwinery has quit [Quit: Leaving]
<leftylink>
oh huh
<leftylink>
trace is pretty wild
<baweaver>
It's also stupidly simple amusingly in implementation
<baweaver>
I may have to add a new type that remembers paths it found things at.
Swyper has quit [Ping timeout: 245 seconds]
<baweaver>
Ah right, it's 2am, sleepy time
jefffrails35 has joined #ruby
MindSpark has joined #ruby
nanoz has quit [Read error: Connection reset by peer]
jefffrails35 has quit [Quit: Leaving]
absolutejam2 has joined #ruby
absolutejam2 has quit [Ping timeout: 246 seconds]
Nicmavr has quit [Read error: Connection reset by peer]
Nicmavr has joined #ruby
za1b1tsu has quit [Ping timeout: 245 seconds]
za1b1tsu has joined #ruby
reber has joined #ruby
thebananaking has quit [Quit: Connection closed for inactivity]
Azure has joined #ruby
Swyper has joined #ruby
Rudd0 has joined #ruby
Swyper has quit [Ping timeout: 268 seconds]
za1b1tsu has quit [Remote host closed the connection]
nanoz has joined #ruby
funnel has quit [Ping timeout: 248 seconds]
funnel has joined #ruby
BH23 has joined #ruby
Freshnuts has quit [Quit: Leaving]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 245 seconds]
al2o3-cr has quit [Quit: If the universe is a machine where the future is uniquely determined by its present state, it would not be possible to calculate what the future will be.]
howdoi has quit [Quit: Connection closed for inactivity]
al2o3-cr has joined #ruby
Swyper has joined #ruby
Swyper has quit [Ping timeout: 248 seconds]
davor has quit [Ping timeout: 245 seconds]
davor has joined #ruby
nanoz has quit [Read error: Connection reset by peer]
tdy has quit [Remote host closed the connection]
tdy has joined #ruby
tdy has quit [Ping timeout: 244 seconds]
deepreds1 has quit [Ping timeout: 248 seconds]
ElFerna has joined #ruby
Tuor has joined #ruby
queip has quit [Ping timeout: 246 seconds]
absolutejam2 has joined #ruby
za1b1tsu has joined #ruby
GodFather has joined #ruby
absolutejam2 has quit [Ping timeout: 245 seconds]
queip has joined #ruby
_whitelogger has joined #ruby
absolutejam2 has joined #ruby
Swyper has joined #ruby
absolutejam2 has quit [Ping timeout: 246 seconds]
GodFather has quit [Ping timeout: 248 seconds]
za1b1tsu has quit [Read error: Connection reset by peer]
ElFerna has quit [Remote host closed the connection]
corellian has quit [Quit: leaving]
Fusl has quit [Max SendQ exceeded]
mikecmpbll has quit [Read error: Connection reset by peer]
Fusl has joined #ruby
deepreds1 has joined #ruby
BH23 has quit [Ping timeout: 246 seconds]
GodFather has joined #ruby
drnerdius has joined #ruby
drnerdius has quit [Client Quit]
drnerdius has joined #ruby
Cthulu201 has quit [Ping timeout: 248 seconds]
Cthulu201 has joined #ruby
drnerdius has quit [Client Quit]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 244 seconds]
absolutejam2 has joined #ruby
absolutejam2 has quit [Ping timeout: 244 seconds]
drnerdius has joined #ruby
drnerdius has quit [Client Quit]
tweaks has quit [Quit: tweaks]
drnerdius has joined #ruby
kapilp has quit [Quit: Connection closed for inactivity]
drnerdius has quit [Client Quit]
Tuor has quit [Quit: Konversation terminated!]
lucasb has joined #ruby
deepreds1 has quit [Ping timeout: 245 seconds]
za1b1tsu has joined #ruby
jcalla has joined #ruby
Swyper has quit [Remote host closed the connection]
Yxhuvud has quit [Read error: Connection reset by peer]
Yxhuvud has joined #ruby
absolutejam2 has quit [Ping timeout: 245 seconds]
greengriminal has joined #ruby
ErhardtMundt has quit [Remote host closed the connection]
ErhardtMundt has joined #ruby
deepreds1 has joined #ruby
gnufied has joined #ruby
cow[moo] has quit [Read error: Connection reset by peer]
Swyper has quit [Remote host closed the connection]
spiette has quit [Ping timeout: 248 seconds]
cow[moo] has joined #ruby
spiette has joined #ruby
tf2ftw has joined #ruby
<tf2ftw>
Hi.
<tf2ftw>
what's the difference between the bin and exe folders in a Gem?
<tf2ftw>
the runtime in bin works but the one in exe doesn't load all the required lib files.
Swyper has joined #ruby
kapilp has joined #ruby
GodFather has joined #ruby
quazimodo has quit [Ping timeout: 244 seconds]
andikr has quit [Ping timeout: 248 seconds]
quazimodo has joined #ruby
impermanence has quit [Ping timeout: 272 seconds]
andikr has joined #ruby
rubydoc has quit [Remote host closed the connection]
s2013 has joined #ruby
rubydoc has joined #ruby
_falsebay_ has joined #ruby
GodFather has quit [Ping timeout: 245 seconds]
<adam12>
tf2ftw: The old convention was to stick your gem binaries in bin/, but that's the default install location for bundler binstubs which would clobber your gem binaries.
<adam12>
tf2ftw: So it was decided that exe/ is the new path for your gem binaries, and bin/ remains for binstubs.
<adam12>
tf2ftw: Files in exe/ by default won't load reuqired lib files, because your lib/ isn't in $LOAD_PATH. That's managed by Rubygems for you automatically.
<adam12>
tf2ftw: If you're developing locally, you probably want `ruby -Ilib exe/some_file`
andikr has quit [Remote host closed the connection]
<tf2ftw>
thanks, adam12
<tf2ftw>
is the build process still the same? gem build ...gemspec; gem install ...gem ?
<adam12>
tf2ftw: Yep. Nothing really changed and if that ruby line I provided runs your exe fine, then everything should just work. Rubygems sets up a binstub when you install your command that manipulates $LOAD_PATH.
<tf2ftw>
got it. And yes, it did run it correctly. Thanks for the hel
<adam12>
baweaver: Your illustration skills are fantastic.
za1b1tsu has quit [Ping timeout: 245 seconds]
absolutejam2 has joined #ruby
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
jenrzzz has joined #ruby
<tf2ftw>
Still have an issue however. When I install the gem the executable still isn't loading relative requires. getting '`require` cannot load such file'
jenrzzz has quit [Ping timeout: 245 seconds]
absolutejam2 has quit [Ping timeout: 268 seconds]
<adam12>
tf2ftw: that's odd.
<adam12>
tf2ftw: Is it open source where I can look at it?
greengriminal has quit [Quit: This computer has gone to sleep]
<adam12>
tf2ftw: Interesting. The easiest fix is to use `require_relative` instead, but I am surprised the $LOAD_PATH wasn't updated...
<adam12>
tf2ftw: Oh I see why
<adam12>
tf2ftw: The only file from lib/ that makes it into the gem is version.rb.
<tf2ftw>
hmm
<tf2ftw>
I have other gems that have the same type of gemspec but they don't have executables. Guessing that I have to add some dynamic loading of that folder in the gemspec?
<adam12>
tf2ftw: You shouldn't. I think it has to do with spec.files in your gemspec
<adam12>
tf2ftw: But I tried it manually and it worked fine...
<adam12>
tf2ftw: But when I built your gem I did get an error. Maybe it built the gem but it was a bad build?
<tf2ftw>
Sorry, confused. Are you saying you built it and it worked, or are you saying you weren't able to build it?