baweaver changed the topic of #ruby to: Rules & more: https://ruby-community.com | Ruby 2.5.1, 2.4.4, 2.3.7, 2.6.0-preview2: https://www.ruby-lang.org | Paste 4+ lines of text to https://dpaste.de/ and select ruby as the language | Rails questions? Ask in #RubyOnRails | Books: https://goo.gl/wpGhoQ | Logs: https://irclog.whitequark.org/ruby | Can't talk? Register/identify with Nickserv first!
LiftLeft has quit [Ping timeout: 240 seconds]
LiftLeft has joined #ruby
akem has joined #ruby
akem_ has quit [Ping timeout: 252 seconds]
scott4000 has joined #ruby
matcouto has joined #ruby
eckhardt has quit [Quit: Textual IRC Client: www.textualapp.com]
darkhanb has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
chouhoulis has quit [Remote host closed the connection]
jasmith has joined #ruby
matcouto has quit [Ping timeout: 240 seconds]
eddof13 has quit [Ping timeout: 240 seconds]
KeyJoo has quit [Ping timeout: 245 seconds]
m27frogy has quit [Quit: ZNC - https://znc.in]
darkhanb has joined #ruby
m27frogy has joined #ruby
arescorpio has quit [Read error: No route to host]
cthulchu has quit [Ping timeout: 252 seconds]
mydog2 has quit [Ping timeout: 276 seconds]
samort7 has quit [Read error: Connection reset by peer]
DTZUZO has quit [Read error: Connection reset by peer]
psmolen has joined #ruby
mroutis has joined #ruby
DTZUZO has joined #ruby
nowhere_man has quit [Read error: Connection reset by peer]
nowhere_man has joined #ruby
matcouto has joined #ruby
nowhere_man has quit [Remote host closed the connection]
nowhere_man has joined #ruby
cagomez has joined #ruby
<cagomez> why does the first method consume 50 MB more memory than using a latter? https://gist.github.com/cagmz/a9c3e752d14fc558e477fdd9525b700f . I think I was memoizing incorrectly but I don't see where I was allocating
sylario has quit [Quit: Connection closed for inactivity]
darkhanb has quit [Ping timeout: 252 seconds]
clorisu has joined #ruby
mroutis has quit [Ping timeout: 245 seconds]
m27frogy has quit [Quit: ZNC - https://znc.in]
m27frogy has joined #ruby
clorisu has quit [Quit: Leaving]
sspreitz has quit [Ping timeout: 240 seconds]
catch22 has joined #ruby
sspreitz has joined #ruby
braincras has quit [Quit: bye bye]
herbmillerjr has quit [Ping timeout: 240 seconds]
herbmillerjr has joined #ruby
brent__ has quit [Quit: Connection closed for inactivity]
braincrash has joined #ruby
jasmith has quit [Quit: Leaving]
<bougyman> there has to be a better way to do this.
<bougyman> without #inject-ing a hash to store the path iterator
<bougyman> [24] pry(main)> path
<bougyman> [25] pry(main)> path.to_s.split('/').inject({files: [], path: []}) { |a, e| defa = Pathname.new(a[:path].join('/')).join("#{e}/default"); (a[:files] << defa) if defa.exist? ; a[:path] << e; a }[:files]
<bougyman> => #<Pathname:foo/bar/baz>
<bougyman> => [#<Pathname:foo/default>, #<Pathname:foo/bar/default>, #<Pathname:foo/bar/baz/default>]
<bougyman> works, but I hate it.
<bougyman> thoughts?
Mutsuhito has joined #ruby
<bougyman> path.descend.map { |e| d = e.join('default'); d.exist? ? d : nil }.compact
<bougyman> much better
r29v has quit [Quit: r29v]
graphene has quit [Read error: Connection reset by peer]
graphene has joined #ruby
tristanp has joined #ruby
tristanp has quit [Remote host closed the connection]
eckhardt has joined #ruby
cagomez has quit [Remote host closed the connection]
_whitelogger has joined #ruby
gnufied has quit [Ping timeout: 250 seconds]
<Radar> bougyman: path.descend.map { |e| e.join('default') }.select(&:exist?)
<bougyman> Radar: thanks, got to that.
<bougyman> I knew inject was just all wrong
<Radar> it's almost always wrong :P
<Radar> seems Pathname#descend goes _up_ the directory tree, is that what you wanted?
<bougyman> no it doesn't
<bougyman> does it?
<bougyman> need to .reverse, then
herbmillerjr has quit [Quit: Konversation terminated!]
<havenwood> bougyman: #ascend
<bougyman> no, it's right
<bougyman> I want descend
* baweaver stares at Radar
<Radar> Hi.
<baweaver> you're correct. Inject is always wrong. Reduce, however, is true power.
<baweaver> buuuuuut using a chainsaw on a bonsai tree is kinda overkill
<Radar> my love affair with each_with_object continues
<Radar> UNABATED
<baweaver> depends on whether or not I'm going to imply that return
marz_d`ghostman has joined #ruby
<marz_d`ghostman> Any reason why shelljoin doesn't seem to work when I test it on irb. https://dpaste.de/QOL9#L1
Inline has quit [Quit: Leaving]
<marz_d`ghostman> silly me, I have to require 'shellwords' sorry about that
postmodern has joined #ruby
orbyt_ has joined #ruby
SeepingN has quit [Quit: The system is going down for reboot NOW!]
gregf_ has quit [Ping timeout: 252 seconds]
Guest18202 has quit [Quit: Gateway shutdown]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
matcouto has quit [Ping timeout: 252 seconds]
sauvin has joined #ruby
mrush has joined #ruby
apeiros has joined #ruby
LiftLeft has quit [Ping timeout: 240 seconds]
KeyJoo has joined #ruby
reber has joined #ruby
graphene has quit [Remote host closed the connection]
graphene has joined #ruby
<Radar> marz_d`ghostman: yeah it's not loaded by default
<baweaver> Yeah, you really have to shell out for it :D
<Radar> baweaver: was that required? :P
<Fenhl> hello! I'm trying to figure out what the unary minus operator does to a string, but can't find it in the docs. What does it do, and where can I find the docs for it?
<baweaver> unfreeze
<baweaver> -@
<baweaver> Ah, it was freeze it
<Radar> >> a = -"hello"; a.frozen?
<ruby[bot]> Radar: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
<Radar> ruby[bot]: u r ded 2 me
<Fenhl> thanks!
<havenwood> #=> true
<Radar> Fenhl: are you seeing code that uses it?
<baweaver> havenwood-bot is still working
<Radar> I've never seen it
<Radar> havenwood: !botsnack
* havenwood nom
<Fenhl> also in line 30
<Radar> Fenhl: a few times. It's not common to do that in Ruby from what I've seen.
<baweaver> That's some nasty code
<Radar> Normally you'd call .freeze.
<Radar> and this: data["display_toughness"] ? data["display_toughness"] : @toughness
<Radar> could be data["display_toughness"] || @toughness
<Radar> Well duh.
<baweaver> Don't do it Radar
<baweaver> Look away, before we refactor D:
<Fenhl> well I'm not going to touch it for now
<Radar> baweaver: I've been Elbow deep in React curriculum planning today. It's nice to look at some Ruby instead.
<Fenhl> but I just noticed this while fixing a bug in my fork of this project, and was wondering why my code was working without the - operators
<Fenhl> but I guess it would make sense since it seems to be “just” an optimization
<Radar> iirc, it will not assign memory to a string that has already been frozen
<Radar> "a".freeze is the same object as "a".freeze, but "a" and "a" are two distinct objects.
graphene has quit [Remote host closed the connection]
LiftLeft has joined #ruby
apeiros has quit [Remote host closed the connection]
LiftLeft has quit [Ping timeout: 240 seconds]
apeiros has joined #ruby
LiftLeft has joined #ruby
mike11 has joined #ruby
apeiros has quit [Ping timeout: 245 seconds]
solocshaw has joined #ruby
Nicmavr has quit [Read error: Connection reset by peer]
apeiros has joined #ruby
Nicmavr has joined #ruby
s2013 has joined #ruby
doubledup has joined #ruby
solocshaw has quit [Quit: solocshaw]
snickers has joined #ruby
apeiros has quit [Remote host closed the connection]
arup_r has joined #ruby
troys has quit [Quit: Bye]
aupadhye has joined #ruby
arup_r has quit [Remote host closed the connection]
Rootsudo has joined #ruby
arup_r has joined #ruby
aufi has joined #ruby
za1b1tsu_ has joined #ruby
doubledup has quit [Quit: Leaving]
arup_r has quit []
t0xik is now known as t0x
despai has joined #ruby
Puffball has joined #ruby
dellavg_ has joined #ruby
yohji has joined #ruby
sysvalve has joined #ruby
blackmesa has joined #ruby
doubledup has joined #ruby
doubledup has quit [Max SendQ exceeded]
doubledup has joined #ruby
Dbugger has joined #ruby
cabotto has joined #ruby
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Puffball has quit [Read error: Connection reset by peer]
cabotto has quit [Remote host closed the connection]
cabotto has joined #ruby
blackmesa has quit [Quit: WeeChat 2.2]
DTZUZO has quit [Ping timeout: 240 seconds]
doubledup has quit [Quit: Leaving]
bak1an has joined #ruby
Beams has joined #ruby
pyrmont has joined #ruby
xt233 has joined #ruby
xt233 has left #ruby [#ruby]
kevinsjoberg has joined #ruby
bijan_ has joined #ruby
mikecmpbll has joined #ruby
sylario has joined #ruby
bak1an has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bijan_ has quit [Remote host closed the connection]
nrk has joined #ruby
redlegion has quit [Remote host closed the connection]
sylario has joined #ruby
sylario has quit [Changing host]
redlegion has joined #ruby
ArahaelPi has quit [Ping timeout: 245 seconds]
bijan__ has joined #ruby
cabotto has quit [Remote host closed the connection]
cabotto has joined #ruby
ArahaelPi has joined #ruby
lxsameer has joined #ruby
bijan__ has quit [Ping timeout: 240 seconds]
cabotto has quit [Ping timeout: 245 seconds]
ArahaelPi has quit [Ping timeout: 246 seconds]
cabotto has joined #ruby
bijan_ has joined #ruby
bijan_ has quit [Ping timeout: 250 seconds]
ArahaelPi has joined #ruby
bijan_ has joined #ruby
cesario has joined #ruby
bijan_ has quit [Ping timeout: 252 seconds]
Puffball has joined #ruby
vqrs has quit [Ping timeout: 252 seconds]
ArahaelPi has quit [Read error: Connection reset by peer]
bijan_ has joined #ruby
tristanp has joined #ruby
vqrs has joined #ruby
ptx0 has quit [Read error: Connection reset by peer]
arahael1 has joined #ruby
Rootsudo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Rootsudo has joined #ruby
tristanp has quit [Ping timeout: 246 seconds]
wildermind has joined #ruby
dionysus69 has joined #ruby
arahael1 is now known as ArahaelPi
postmodern has quit [Quit: Leaving]
bijan_ has quit [Ping timeout: 252 seconds]
Freshnuts has quit [Quit: Leaving]
bijan_ has joined #ruby
clorisu has joined #ruby
clorisu has quit [Client Quit]
bijan_ has quit [Ping timeout: 252 seconds]
akem has quit [Quit: Leaving]
akem has joined #ruby
bijan_ has joined #ruby
Rootsudo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
aupadhye has quit [Ping timeout: 240 seconds]
bijan_ has quit [Ping timeout: 252 seconds]
tty has quit [Quit: tty]
cabotto has quit [Remote host closed the connection]
cabotto has joined #ruby
bijan_ has joined #ruby
<marz_d`ghostman> Is there anything I need to require to make `match` work in irb?
BaroMeter has joined #ruby
bak1an has joined #ruby
BaroMeter has quit [Remote host closed the connection]
aupadhye has joined #ruby
bijan_ has quit [Ping timeout: 252 seconds]
<dionysus69> marz_d`ghostman: nope, it's included by default I think
bijan_ has joined #ruby
cabotto has quit [Remote host closed the connection]
cabotto has joined #ruby
bijan_ has quit [Ping timeout: 250 seconds]
kapil___ has joined #ruby
cabotto has quit [Remote host closed the connection]
bijan_ has joined #ruby
dextrey has joined #ruby
bijan_ has quit [Ping timeout: 252 seconds]
bijan_ has joined #ruby
bijan_ has quit [Ping timeout: 252 seconds]
bijan_ has joined #ruby
cabotto has joined #ruby
bijan_ has quit [Ping timeout: 252 seconds]
bijan_ has joined #ruby
RougeR has joined #ruby
sarna has joined #ruby
<sarna> hey, I see somebody putting "gem: --no-document" in .gemrc before installing bundler. what does that option do?
<RougeR> so...im at a new company and we are using mintest for testing
<RougeR> from what i can see, out of the box minitest does not have "contexts"
bijan_ has quit [Read error: Connection reset by peer]
<RougeR> but all of their test is using contexts....
<RougeR> so my only assumption is that a gem is adding contexts to minitest (seen this exists)
<RougeR> does anyone know which gem might be doing this, here is the spec file and gemfile
bijan_ has joined #ruby
bijan_ has quit [Read error: Connection reset by peer]
bijan__ has joined #ruby
dextrey has quit [Ping timeout: 260 seconds]
bijan__ has quit [Ping timeout: 252 seconds]
bijan_ has joined #ruby
cabotto has quit [Remote host closed the connection]
bijan_ has quit [Ping timeout: 250 seconds]
cabotto has joined #ruby
jamesaxl has quit [Ping timeout: 264 seconds]
jamesaxl has joined #ruby
bijan_ has joined #ruby
dextrey has joined #ruby
akem has quit [Ping timeout: 252 seconds]
<ineb> RougeR: probably just an alias for :describe
desperek has joined #ruby
dextrey has quit [Quit: WeeChat 2.2]
DTZUZO has joined #ruby
clorisu has joined #ruby
bijan_ has quit [Ping timeout: 260 seconds]
Rootsudo has joined #ruby
gnufied has joined #ruby
bijan_ has joined #ruby
<sonOfRa> Huh. Formatting dates. Can anyone explain the rationale behind %p being AM/PM uppercase and %P being am/pm lowercase?
arup_r has joined #ruby
gnufied has quit [Ping timeout: 245 seconds]
bijan_ has quit [Ping timeout: 260 seconds]
bijan_ has joined #ruby
fmcgeough has joined #ruby
fmcgeough has quit [Client Quit]
bijan_ has quit [Ping timeout: 252 seconds]
sarna has quit [Ping timeout: 245 seconds]
savolla has joined #ruby
cabotto has quit [Remote host closed the connection]
cabotto has joined #ruby
apeiros has joined #ruby
bijan_ has joined #ruby
bijan_ has quit [Ping timeout: 252 seconds]
Rootsudo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
aupadhye has quit [Ping timeout: 246 seconds]
Rootsudo has joined #ruby
Rootsudo has quit [Client Quit]
bijan_ has joined #ruby
Rootsudo has joined #ruby
Rootsudo has quit [Client Quit]
Rootsudo has joined #ruby
Rootsudo has quit [Client Quit]
Rootsudo has joined #ruby
Rootsudo has quit [Client Quit]
bijan__ has joined #ruby
Rootsudo has joined #ruby
Rootsudo has quit [Client Quit]
bijan_ has quit [Ping timeout: 260 seconds]
<RougeR> ineb: yeah quite possibly
<RougeR> maybe ill throw binding.pry in and find the method
savolla has quit [Ping timeout: 246 seconds]
<havenwood> sonOfRa: Folk often use lower case for the more common variant of a thing, like option flags. It saves having to press shift. MySQL just has the caps, no %P even.
<havenwood> sonOfRa: I think the lower case am/pm version not being initially contemplated is probably the reason.
<havenwood> sonOfRa: Apparently A.M. and a.m. with dots aren't popular enough to get a directive.
<sonOfRa> interesting. I don't see am/pm stuff often, but subjectively it feels like am is more common than AM
<sonOfRa> Maybe because most times I see it is in casual conversation where nobody bothers using the shift key
clorisu has quit [Read error: No route to host]
bmurt has joined #ruby
psychicist__ has joined #ruby
aupadhye has joined #ruby
al2o3-cr has quit [Ping timeout: 252 seconds]
gnufied has joined #ruby
a-yogi has joined #ruby
<a-yogi> hi guys, could anyone tell how can I define array of hash in ruby?
<a-yogi> or if there is an online doc for this?
<apeiros> a-yogi: [{}]
<apeiros> or what do you mean by "define"?
arup_r has quit []
sticaz has quit [Ping timeout: 252 seconds]
<apeiros> >> hoa = [{"i am" => "an"}, {"array of" => "hashes"}]; [hoa.class, hoa.first.class]
<ruby[bot]> apeiros: # => [Array, Hash] (https://eval.in/1052356)
sticaz has joined #ruby
savolla has joined #ruby
snickers has quit [Ping timeout: 240 seconds]
bijan__ has quit [Remote host closed the connection]
mike11 has quit [Quit: Leaving.]
fmcgeough has joined #ruby
sticaz has quit [Ping timeout: 272 seconds]
bijan_ has joined #ruby
<dionysus69> is there a particular reason why parallel gem is not part of core ruby? or rails at least?
fmcgeough_ has joined #ruby
fmcgeough has quit [Ping timeout: 240 seconds]
fmcgeough_ is now known as fmcgeough
KeyJoo has quit [Ping timeout: 240 seconds]
<apeiros> dionysus69: no
<dionysus69> and so why isn't ? what does parallel gem do with GIL btw?
<apeiros> it isn't for the same reason a thousand other gems aren't. and as far as I'm aware, it does nothing with the GIL.
bijan_ has quit [Read error: Connection reset by peer]
dendazen has joined #ruby
<dionysus69> so that's what's confusing, if it has parallel threads then it has to do something with GIL :)
<RougeR> anyone done AWS stubbing before?
<havenwood> dionysus69: if forks
<havenwood> dionysus69: its threads aren't parallel
<havenwood> dionysus69: it* forks
<dionysus69> aah I see
<dionysus69> so basically it forks threads into other processes?
<dionysus69> process per thread?
<apeiros> also MRIs threads are not parallel, other ruby implementations (jruby f.ex.) can be.
<havenwood> dionysus69: it forks processes
<apeiros> not "process per thread", "process *instead* of thread"
<havenwood> dionysus69: i'd have to double check the implementation, but i recall it's threads *OR* process forking
<apeiros> and it tells you that in the readme
<apeiros> "Run any code in parallel Processes(> use all CPUs) or Threads(> speedup blocking operations). "
<dionysus69> yea just investigating what's the best way to achieve parallelism in ruby out of curiosity
<havenwood> what apeiros said
<dionysus69> this was unclear so speedup blocking operations
<apeiros> if a thread blocks, another thread is scheduled
<apeiros> IO being the common reason for blocks.
<dionysus69> similar to db deadlock?
<apeiros> no. a deadlock is more than just blocking.
<elomatreb> A deadlock is an error condition, blocking is perfectly normal
gnufied has quit [Ping timeout: 272 seconds]
<apeiros> as in: perform an http get request, it'll take, say a second. during that second your CPU is idle.
<dionysus69> ok got it
<havenwood> dionysus69: check out this three-part article on the GIL: https://www.jstorimer.com/blogs/workingwithcode/8085491-nobody-understands-the-gil
<apeiros> use threads and fill that second with computing other stuff.
<elomatreb> And not necessarily your computing, threading was a thing long before multiprocessors were available for 99% of systems
bijan_ has joined #ruby
<havenwood> dionysus69: the author of that ^ actually has one great short book on threading, and another on proceses
<apeiros> yeah, before multiple cores (or multiple CPUs), concurrency was the only thing there was.
<dionysus69> cool, that's the only clear example I've heard about what the so called green threads can be used for
<apeiros> true parallelism isn't possible without those.
thejs has joined #ruby
bijan_ has quit [Read error: Connection reset by peer]
bijan_ has joined #ruby
bijan_ has quit [Read error: Connection reset by peer]
bijan_ has joined #ruby
alex`` has quit [Quit: WeeChat 2.2]
nowhere_man has quit [Ping timeout: 252 seconds]
Rapture has joined #ruby
mostlybadfly has quit [Quit: Connection closed for inactivity]
knight33 has joined #ruby
micutzu has joined #ruby
a-yogi has quit [Quit: This computer has gone to sleep]
sauvin has quit [Ping timeout: 252 seconds]
TomyWork has joined #ruby
mostlybadfly has joined #ruby
<TomyWork> hi
bmurt has quit [Read error: Connection reset by peer]
TheBloke has quit [Ping timeout: 252 seconds]
bmurt has joined #ruby
za1b1tsu_ has quit [Read error: Connection reset by peer]
<apeiros> hi TomyWork
gnufied has joined #ruby
Puffball has quit [Remote host closed the connection]
za1b1tsu_ has joined #ruby
cesario has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
TheBloke has joined #ruby
exchgr has joined #ruby
jmcgnh_ is now known as jmcgnh
cabotto has quit []
aufi has quit [Remote host closed the connection]
TheBrayn has quit [Quit: poof]
aufi has joined #ruby
TheBrayn has joined #ruby
<RougeR> can anyone help with aws stubbing
<RougeR> need to stub a get request
<salasrod> What's the question RougeR?
roshanavand has joined #ruby
apeiros has quit []
c0ncealed2 has quit [Read error: Connection reset by peer]
<RougeR> i want to write a test to simulate (stubbing)downloading an AWS file in an S3 bucket
bmurt has quit [Read error: Connection reset by peer]
c0mrad3 has joined #ruby
<RougeR> im following this sort of stuff
roshanavand has quit [Ping timeout: 272 seconds]
<RougeR> but having to do it with resource stubs
c0ncealed2 has joined #ruby
bmurt has joined #ruby
yohji has quit [Remote host closed the connection]
[Butch] has joined #ruby
apeiros_ has joined #ruby
bijan_ has quit []
sarna has joined #ruby
Caius has joined #ruby
RougeR has quit [Ping timeout: 252 seconds]
Azure has quit [Ping timeout: 252 seconds]
ineb has quit [Quit: WeeChat 2.2]
snickers has joined #ruby
<TomyWork> i'm writing an ldap cache right now. I'm using some of the back-end classes of net-ldap to parse LDAP PDUs from the wire
<TomyWork> surprisingly, i got that part to work
<TomyWork> now i need to re-encode them and send them on their way on the other connection
tjbp has quit [Remote host closed the connection]
<TomyWork> my cache is gonna be pretty dumb, it's just going to store response packets by request SHA1 or something and then replay those if the backend connection drops
tjbp has joined #ruby
aupadhye has quit [Quit: Leaving]
<TomyWork> is anyone here familiar enough with the internals for Net::LDAP to tell me how PDUs are serialized back into BER format?
troys has joined #ruby
aufi has quit [Ping timeout: 245 seconds]
Yxhuvud has joined #ruby
Azure has joined #ruby
lomex has joined #ruby
<sarna> hey, could anyone please help me with setting up a ruby project? I've been reading through the docs, but it's really complicated :(
bmurt has quit [Read error: Connection reset by peer]
bmurt has joined #ruby
<havenwood> sarna: What trouble are you running into?
<havenwood> sarna: The --no-document flag disables documentation on gem installation.
<sarna> havenwood: I want to make an app that I'll primarily use myself but I'd like it to be easy for my friends to use it too
<sarna> havenwood: oh, I see.
Beams has quit [Quit: .]
<havenwood> sarna: Is the app web, gui, command line or what?
<sarna> havenwood: so far I've made a new project with bundler, but it's a lot of files..
<sarna> havenwood: CLI
<havenwood> sarna: So you're making a gem?
<havenwood> sarna: You ran `bundle gem GEM_NAME`?
<sarna> havenwood: well, it seems like it. I excluded Gemfile.lock, as some blog post advised me to
<sarna> havenwood: yes
Inline has joined #ruby
<sarna> havenwood: where does my code go? lib/my_app.rb ?
<sarna> I excluded Gemfile.lock from version control*
<havenwood> sarna: Yes, we exclude the Gemfile.lock from the repo by adding it to the .gitignore for gems.
despai has quit [Quit: ...]
<sarna> havenwood: ok, done
<havenwood> sarna: Yes, your code goes in the lib/ dir
<havenwood> sarna: Pay close attention to naming conventions too: https://guides.rubygems.org/name-your-gem/
<sarna> havenwood: I see, thanks for the links
<havenwood> If you're curious about any of the files Bundler generated, just ask!
<sarna> havenwood: and by the way, do I have to generate bin/my_app myself somehow, or will bundler do it for me?
<havenwood> I typically just create the files from scratch or cherry pick them from one of my old gems. I should probably write a little generator.
<havenwood> sarna: Bundler might have a flag to create an executable. I don't use it to create gems.
<havenwood> sarna: It's easy enough for you to create. Bundler doesn't follow RubyGems convention there, in that they name the directory exe/ instead.
<sarna> havenwood: I see. so, the file in bin/ should be a ruby script with a #! in it?
<havenwood> sarna: Yes, and it should be executable.
lxsameer has quit [Ping timeout: 252 seconds]
<havenwood> sarna: chmod +x
<sarna> havenwood: bundler made a lib/ directory for me
<sarna> yes, yes, thanks
<sarna> there's already 'console' and 'setup' in lib/, should I do anything with them?
<havenwood> sarna: Here's a gem of mine with a simple command line interface: https://github.com/havenwood/digest-sip_hash
<havenwood> sarna: In bin/ you mean?
<sarna> havenwood: yeah, bin, I'm sorry :)
<havenwood> sarna: So bundler uses bin/ for those. The RubyGems convention is to use bin/ how Bundler wants to use exe/ dir.
<havenwood> sarna: See your gemspec for where that's set.
micutzu has quit [Quit: Leaving]
<havenwood> sarna: bin/ is the default
<sarna> havenwood: I don't have a exe/ dir, should I create it?
<havenwood> sarna: So in this gem, I have bin/siphash, so I don't need to do anything special with bin/, just say I have the executable: https://github.com/havenwood/digest-sip_hash/blob/master/digest-sip_hash.gemspec#L18
<havenwood> sarna: And this is that executable: https://github.com/havenwood/digest-sip_hash/blob/master/bin/siphash
lxsameer has joined #ruby
<sarna> havenwood: oh yeah, in my_app.gemspec there's 'spec.bindir = "exe"'
<havenwood> sarna: That's Bundler fooling with the default.
<sarna> :(
<havenwood> sarna: You can choose.
<havenwood> sarna: It's fine to follow either the RubyGems or Bundler convention.
<havenwood> sarna: I prefer the former.
<sarna> havenwood: I see. what's the trade-off there? why did they break the convention?
<sarna> (if it's too broad of a question just tell me, I'll google for it)
za1b1tsu_ has quit [Ping timeout: 250 seconds]
lxsameer has quit [Ping timeout: 252 seconds]
savolla has quit [Ping timeout: 246 seconds]
<havenwood> sarna: So it's a bit of a long story.
bak1an has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
* sarna takes a sit near the campfire
orbyt_ has joined #ruby
orbyt_ has quit [Client Quit]
<havenwood> sarna: There's a debate in the community about the practice of putting `bin` in your PATH. Some people feel it is a convenience, and others feel it is ill-advised.
lxsameer has joined #ruby
<havenwood> Folk will, for example do: PATH="bin:$PATH"
<havenwood> Or: PATH="$PATH:bin"
<havenwood> The latter is less terrible, but both are saying "run whatever is in a `bin` directory relative to the current working directory.
<sarna> yes, that's what I do :^)
<sarna> roughly.
<havenwood> With the former, if someone has a `bin/ls` or other command it'll hijack what you're expecting.
<havenwood> The latter is better if you must have `bin` in PATH.
<havenwood> Some of the Bundler folk have `bin` in PATH and like the idea of being able to type `setup` from a gem directory to run `bin/setup`. They don't necessarily want `bin/this_gem_executable` to be ahead in PATH though, so they put gem binaries in `exe`.
<havenwood> I don't have `bin` in my PATH, and it has long been the RubyGems default to have your executables in `bin`, so that's what I do.
lxsameer has quit [Ping timeout: 246 seconds]
mroutis has joined #ruby
<sarna> havenwood: thank you for the in-depth explanation! :D
<havenwood> sarna: No prob!
cthulchu has joined #ruby
eddof13 has joined #ruby
lxsameer has joined #ruby
<sarna> seems like bundler breaks semantic versioning as well :^(
<sarna> (freshly created project is 0.1.0 instead of 0.0.1)
xuyuheng has joined #ruby
xuyuheng has quit [Client Quit]
apeiros_ has quit [Remote host closed the connection]
mroutis has quit [Remote host closed the connection]
<sarna> ((actually no, major version zero (0.y.z) is for initial development. my bad))
dextrey has joined #ruby
mikecmpbll has quit [Quit: inabit. zz.]
lxsameer has quit [Ping timeout: 250 seconds]
jcarl43 has joined #ruby
Emmanuel_Chanel has quit [Read error: Connection reset by peer]
sarna has quit [Remote host closed the connection]
mfunkmann has joined #ruby
mroutis has joined #ruby
<TomyWork> putting relative directories in your PATH, for whatever reason, makes PATH resolution behaviour unpredictable unless you always know the cwd, which you usually don't.
bmurt has quit [Read error: Connection reset by peer]
bmurt has joined #ruby
<TomyWork> if your system is in any way accessible to the public (or to untrusted actors in general), you also need to consider security. Having an unpredictable PATH means your security is unpredictable, unless you always specify absolute paths for every single command, which you usually don't.
orbyt_ has joined #ruby
orbyt_ has quit [Client Quit]
orbyt_ has joined #ruby
gbristol has joined #ruby
bak1an has joined #ruby
mroutis has quit [Remote host closed the connection]
ptx0 has joined #ruby
apeiros_ has joined #ruby
eckhardt_ has joined #ruby
mroutis has joined #ruby
Azure has quit [Ping timeout: 240 seconds]
sysvalve has quit [Quit: Leaving]
sauvin has joined #ruby
Azure|dc has joined #ruby
bak1an has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cr1xu5 has joined #ruby
dextrey has quit [Ping timeout: 240 seconds]
mroutis has quit [Ping timeout: 240 seconds]
lxsameer has joined #ruby
cr1xu5 has quit [Read error: Connection reset by peer]
apeiros_ has quit [Remote host closed the connection]
lomex has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
lxsameer has quit [Ping timeout: 252 seconds]
akem has joined #ruby
d^sh has joined #ruby
lxsameer has joined #ruby
apeiros_ has joined #ruby
lxsameer has quit [Ping timeout: 246 seconds]
akaiiro has quit [Ping timeout: 246 seconds]
knight33 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
jamesaxl has quit [Ping timeout: 245 seconds]
lxsameer has joined #ruby
akaiiro has joined #ruby
AJA4350 has quit [Remote host closed the connection]
lxsameer has quit [Ping timeout: 252 seconds]
AJA4350 has joined #ruby
duckpupp- is now known as duckpuppy
sameerynho has joined #ruby
jamesaxl has joined #ruby
lxsameer has joined #ruby
<TomyWork> if a method yields to a block, can i somehow prevent the remainder of the method from being run after the block ends?
<TomyWork> i guess i could raise and catch, but is there a better way?
despai has joined #ruby
<baweaver> return if block_given?
<TomyWork> I cannot modify the method
lxsameer has quit [Ping timeout: 240 seconds]
<TomyWork> this is someone else's method, i want to mess with their intended execution flow
<baweaver> Why?
<baweaver> What are you trying to do, and why do you need it?
bmurt has quit [Read error: Connection reset by peer]
<TomyWork> https://github.com/ruby-ldap/ruby-net-ldap/blob/master/lib/net/ber/ber_parser.rb#L172 basically I want to put everything that this function reads from the stream into a buffer/string/whatever
<TomyWork> so i can replay it later
bmurt has joined #ruby
<TomyWork> in case you're wondering, that method is defined in a module, that module is included (via monkey-patching) in several streams and stream-like objects
knight33 has joined #ruby
bak1an has joined #ruby
<TomyWork> this reads a BER object from the network, but i dont know how much it will read beforehand. BER encoding for the length is a bit complicated
mfunkmann has left #ruby ["Textual IRC Client: www.textualapp.com"]
<TomyWork> I could just copy that "read_ber_length" function or invoke it via Object#send, but i thought using the actual function may be cleaner
lxsameer has joined #ruby
<TomyWork> (read_ber_length is private)
lxsameer has quit [Ping timeout: 246 seconds]
jamesaxl has quit [Ping timeout: 252 seconds]
lxsameer has joined #ruby
<TomyWork> baweaver any comments? :)
lxsameer has quit [Ping timeout: 250 seconds]
alex`` has joined #ruby
<baweaver> TomyWork: stupid quick hack idea is alias_method to mask it
dellavg_ has quit [Ping timeout: 252 seconds]
<baweaver> Net::LDAP is a hot mess
* baweaver is in a meeting, so will respond slowly.
tubbo has joined #ruby
<baweaver> ohai tubbo
<apeiros_> TomyWork: break will return from the block, not giving back control to the yielding method
DTZUZO has quit [Ping timeout: 252 seconds]
mroutis has joined #ruby
lxsameer has joined #ruby
<apeiros_> >> def foo; yield; puts "never printed"; end; foo do puts "before"; break; end; puts "after" # check the link
<ruby[bot]> apeiros_: # => before ...check link for more (https://eval.in/1052454)
chouhoulis has joined #ruby
jamesaxl has joined #ruby
<tubbo> baweaver: hey there
<tubbo> been a whil
<tubbo> while*
SeepingN has joined #ruby
chouhoulis has quit [Remote host closed the connection]
chouhoulis has joined #ruby
chouhoulis has quit [Remote host closed the connection]
chouhoulis has joined #ruby
lxsameer has quit [Ping timeout: 246 seconds]
<TomyWork> apeiros_ cool, wasn't aware of that, but that's exactly what i need :)
chouhoulis has quit [Remote host closed the connection]
<baweaver> tubbo: been busy?
<TomyWork> can i declare variables without assigning them?
<TomyWork> i want to make sure they're assigned on the outer scope not the block scope
<tubbo> baweaver: yeah, been pretty busy with work and music. how about you?
<baweaver> var = nil
<apeiros_> TomyWork: there's no declaration in ruby, so no. you must assign.
<apeiros_> but as baweaver showed, just assign nil.
apeiros_ is now known as apeiros
<TomyWork> alright
<baweaver> Same. Spoke at Southeast Ruby, got the same talk accepted to RubyConf. Made Staff Engineer over here and likely taking over Language Support for Ruby.
<mroutis> tubbo: are you a musician/composer?
<apeiros> and `a,b,c = nil` works fine to assign nil to multiple vars
<baweaver> Shall we wander over to offtopic?
bak1an_ has joined #ruby
lxsameer has joined #ruby
Mikasi has joined #ruby
bak1an has quit [Ping timeout: 252 seconds]
Mikasi has quit [Remote host closed the connection]
<TomyWork> i went extraclever and made it so the check for indeterminate content length (content_length == -1) doubles as the check for the end of the stream (which shouldn't happen)
<TomyWork> i probably should go extra clever
<apeiros> read_beer
<TomyWork> shouldn't
<TomyWork> don't read too much into it
<TomyWork> it's very basic
<TomyWork> and full of encoding rules
<apeiros> TomyWork: content_length = source.read_ber { |_, v| break v } || nil
lxsameer has quit [Ping timeout: 260 seconds]
<TomyWork> ooooh
<apeiros> err, the || nil is pointless :D
<TomyWork> break a,b?
<apeiros> can be done, yes
<apeiros> but you didn't seem to use id
<TomyWork> not yet
<apeiros> so: id, content_length = source.read_ber { |*v| break v }
tdy has joined #ruby
<apeiros> will break horribly if read_ber has a code-path which doesn't yield
<TomyWork> even shorter
<TomyWork> it does have such a code path
quiliro has joined #ruby
thejs has quit [Ping timeout: 240 seconds]
<apeiros> fail = true; id, content_length = source.read_ber { |*v| fail = false; break v }; raise if fail
mroutis has quit [Remote host closed the connection]
<TomyWork> well it's just nil, so i dont care :)
<TomyWork> return nil if id == nil
lxsameer has joined #ruby
<TomyWork> btw, about Net::LDAP being a hot mess
<TomyWork> first of all, thanks, so it's not just me :D
<apeiros> Net::LDAP?
<TomyWork> got a better idea? all i need is BER parsing
* apeiros remembers using 0.0.4 for ~7 years?
<TomyWork> baweaver said that
<apeiros> oh, I wasn't saying it wasn't a hot mess :D
<apeiros> re "better idea" - you're asking the wrong person. if you ask me, all the wheels need to be reinvented.
<apeiros> there might be a separate BER library
<apeiros> after all, that stuff is in a couple of protocols
<TomyWork> apeiros you havent looked at the BER encoding rules yet :D
<apeiros> you have no idea which wheels I've reinvented.
<TomyWork> :D
quiliro has quit [Ping timeout: 252 seconds]
lxsameer has quit [Ping timeout: 252 seconds]
<apeiros> why? looks simple
<apeiros> it actually looks like an incomplete implementation
<apeiros> (doesn't handle 0x80 as length indicator)
<TomyWork> 0x80 is indeterminate length
<TomyWork> indeed unsupported
<TomyWork> as indicated by exceptions elsewhere
<apeiros> IMO it should raise right there
<apeiros> instead of returning -1
<apeiros> but that's where we're probably talking about "hot mess"
<TomyWork> well -1 is a valid way of indicating that the length is indeterminate
akaiiro has quit [Ping timeout: 246 seconds]
<TomyWork> the read_ber_length function has no issue determining that
<TomyWork> it's just that read_ber doesn't support indeterminate length
<apeiros> ah, I misunderstood. I thought this was a variable sized integer.
<apeiros> but while it is a variably sized integer, it's one supposed to indicate the length of an actual object
<apeiros> so yes, -1 is viable.
<TomyWork> anyway, i'm gonna leave or i'll stay forever ^^
thy0 has joined #ruby
<TomyWork> good night
<apeiros> n8
tdy has quit [Ping timeout: 246 seconds]
agent_white has quit [Remote host closed the connection]
lxsameer has joined #ruby
mroutis has joined #ruby
code_zombie has joined #ruby
kapil___ has quit [Quit: Connection closed for inactivity]
bak1an_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
lxsameer has quit [Ping timeout: 245 seconds]
TomyWork has quit [Ping timeout: 246 seconds]
bmurt has quit [Read error: No route to host]
bmurt has joined #ruby
lxsameer has joined #ruby
tty has joined #ruby
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
nowhere_man has joined #ruby
cliluw has joined #ruby
lxsameer has quit [Ping timeout: 245 seconds]
mikecmpbll has joined #ruby
headius has joined #ruby
code_zombie_ has joined #ruby
code_zombie has quit [Ping timeout: 250 seconds]
code_zombie__ has joined #ruby
code_zombie_ has quit [Ping timeout: 250 seconds]
thejs has joined #ruby
jtperreault has joined #ruby
postmodern has joined #ruby
planigan_ has quit [Ping timeout: 240 seconds]
nowhere_man has quit [Ping timeout: 240 seconds]
k0mpa has joined #ruby
planigan has joined #ruby
planigan has quit [Ping timeout: 246 seconds]
Rootsudo has joined #ruby
bmurt has joined #ruby
akaiiro has joined #ruby
bak1an has joined #ruby
dminuoso has left #ruby ["WeeChat 2.0.1"]
bak1an_ has joined #ruby
bak1an has quit [Ping timeout: 240 seconds]
reber has quit [Remote host closed the connection]
planigan has joined #ruby
bmurt has quit [Read error: Connection reset by peer]
bmurt has joined #ruby
seym0ur has joined #ruby
seym0ur has left #ruby ["+++++++++++++++++++++++++++"]
sticaz has joined #ruby
DarthGandalf has quit [Quit: Bye]
dextrey has joined #ruby
BTRE has quit [Remote host closed the connection]
fmcgeough has quit [Quit: fmcgeough]
BTRE has joined #ruby
Rootsudo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tubbo` has joined #ruby
<baweaver> Yeah, Net::LDAP was the bane of my existence for a few years.
tubbo has quit [Ping timeout: 252 seconds]
max22 has joined #ruby
tubbo` has quit [Client Quit]
max22 has quit [Remote host closed the connection]
DarthGandalf has joined #ruby
mendelssohn has joined #ruby
mendelssohn has quit [Client Quit]
planigan has quit [Ping timeout: 252 seconds]
planigan has joined #ruby
dendazen has quit [Remote host closed the connection]
mroutis has quit [Remote host closed the connection]
Rootsudo has joined #ruby
lenqbit has joined #ruby
za1b1tsu_ has joined #ruby
za1b1tsu_ has quit [Ping timeout: 240 seconds]
scrptktty has joined #ruby
ec has joined #ruby
bak1an_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
lxsameer has joined #ruby
bmurt has quit [Read error: Connection reset by peer]
snickers has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jcalla has quit [Quit: Leaving]
dionysus69 has quit [Ping timeout: 250 seconds]
bmurt has joined #ruby
lxsameer has quit [Ping timeout: 252 seconds]
jp has joined #ruby
chouhoulis has joined #ruby
snickers has joined #ruby
bak1an has joined #ruby
snickers has quit [Client Quit]
chouhoulis has quit [Ping timeout: 240 seconds]
chouhoulis has joined #ruby
lenqbit has quit [Ping timeout: 245 seconds]
chouhoulis has quit [Ping timeout: 245 seconds]
chouhoulis has joined #ruby
chouhoulis has quit [Ping timeout: 246 seconds]
dextrey has quit [Ping timeout: 260 seconds]
psychicist__ has quit [Ping timeout: 246 seconds]
Rootsudo has quit [Ping timeout: 245 seconds]
nowhere_man has joined #ruby
marz_d`ghostman has quit [Ping timeout: 252 seconds]
bak1an has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
nowhere_man has quit [Ping timeout: 240 seconds]
ur5us has joined #ruby
c0mrad3 has quit [Quit: Connection closed for inactivity]
Puffball has joined #ruby
<darix> baweaver: there are worse ldap libraries
Rapture has quit [Quit: Textual IRC Client: www.textualapp.com]
DTZUZO has joined #ruby
bmurt has quit [Read error: Connection reset by peer]
cats has quit [Ping timeout: 268 seconds]
Azure|dc has quit [Read error: Connection reset by peer]
cats has joined #ruby
Azure has joined #ruby
jane_booty_doe has joined #ruby
[Butch] has quit [Quit: Textual IRC Client: www.textualapp.com]
JJonah has joined #ruby
<JJonah> Say I require a gem in many files, and the gem exposes a module named `X` after I include it. I would prefer to use `Y` everywhere in my code instead of `X`. Of course I could just write `Y = X` after ever require -- but what is a better way to accomplish this?
<elomatreb> If you have a file that is guaranteed to be required first you can just require it once in there and set Y = X, it should carry over to other files
<JJonah> elomatreb, yes, i should have specified i want to know if there are any solutions besides that.
<elomatreb> Not really, since ruby doesn't have a proper module system, sadly
<JJonah> elomatreb: thanks, that's what i thought
knight33 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
akaiiro has quit [Ping timeout: 244 seconds]
code_zombie__ has quit [Quit: Leaving]
knight33 has joined #ruby
dviola has joined #ruby
tdy has joined #ruby
jasmith has joined #ruby
bmurt has joined #ruby
mikecmpbll has quit [Quit: inabit. zz.]
lxsameer has joined #ruby
bmurt has quit [Ping timeout: 240 seconds]
bmurt has joined #ruby
knight33 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
lxsameer has quit [Ping timeout: 240 seconds]
dendazen has joined #ruby
bmurt has quit [Client Quit]
bmurt has joined #ruby
Rootsudo has joined #ruby
bmurt has quit [Client Quit]
al2o3-cr has joined #ruby
teej has joined #ruby
eddof13 has quit [Ping timeout: 240 seconds]
sameerynho has quit [Ping timeout: 245 seconds]
wyoung has left #ruby ["BBL, it's python time :D"]
akem has quit [Read error: Connection reset by peer]
akem has joined #ruby