« Back to channel list

#ruby - 30 August 2018

« Back 1 day Forward 1 day »
[00:06:07] LiftLeft: has joined #ruby
[00:12:09] akem: has joined #ruby
[00:17:52] scott4000: has joined #ruby
[00:30:37] matcouto: has joined #ruby
[00:41:28] jasmith: has joined #ruby
[01:20:23] darkhanb: has joined #ruby
[01:21:30] m27frogy: has joined #ruby
[02:05:47] psmolen: has joined #ruby
[02:07:30] mroutis: has joined #ruby
[02:08:55] DTZUZO: has joined #ruby
[02:10:18] nowhere_man: has joined #ruby
[02:12:01] matcouto: has joined #ruby
[02:16:43] nowhere_man: has joined #ruby
[02:33:57] cagomez: has joined #ruby
[02:34:57] 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
[02:42:52] clorisu: has joined #ruby
[02:51:17] m27frogy: has joined #ruby
[03:02:22] catch22: has joined #ruby
[03:03:00] sspreitz: has joined #ruby
[03:11:08] herbmillerjr: has joined #ruby
[03:14:26] braincrash: has joined #ruby
[03:25:48] bougyman: there has to be a better way to do this.
[03:26:06] bougyman: without #inject-ing a hash to store the path iterator
[03:26:09] bougyman: [24] pry(main)> path
[03:26:09] bougyman: => #<Pathname:foo/bar/baz>
[03:26:09] 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]
[03:26:20] bougyman: => [#<Pathname:foo/default>, #<Pathname:foo/bar/default>, #<Pathname:foo/bar/baz/default>]
[03:26:24] bougyman: works, but I hate it.
[03:26:46] Mutsuhito: has joined #ruby
[03:32:34] bougyman: path.descend.map { |e| d = e.join('default'); d.exist? ? d : nil }.compact
[03:32:36] bougyman: much better
[03:50:35] graphene: has joined #ruby
[04:04:06] tristanp: has joined #ruby
[04:13:25] eckhardt: has joined #ruby
[04:39:12] _whitelogger: has joined #ruby
[04:43:04] Radar: bougyman: path.descend.map { |e| e.join('default') }.select(&:exist?)
[04:43:28] bougyman: Radar: thanks, got to that.
[04:43:35] bougyman: I knew inject was just all wrong
[04:43:47] Radar: it's almost always wrong :P
[04:44:32] Radar: seems Pathname#descend goes _up_ the directory tree, is that what you wanted?
[04:47:19] bougyman: no it doesn't
[04:47:34] bougyman: need to .reverse, then
[04:55:29] havenwood: bougyman: #ascend
[04:57:22] bougyman: no, it's right
[04:57:24] bougyman: I want descend
[05:05:19] baweaver: ACTION stares at Radar 
[05:05:34] baweaver: you're correct. Inject is always wrong. Reduce, however, is true power.
[05:06:11] baweaver: buuuuuut using a chainsaw on a bonsai tree is kinda overkill
[05:06:35] Radar: my love affair with each_with_object continues
[05:07:01] baweaver: depends on whether or not I'm going to imply that return
[05:08:19] marz_d`ghostman: has joined #ruby
[05:10:03] marz_d`ghostman: Any reason why shelljoin doesn't seem to work when I test it on irb. https://dpaste.de/QOL9#L1
[05:12:26] marz_d`ghostman: silly me, I have to require 'shellwords' sorry about that
[05:16:16] postmodern: has joined #ruby
[05:17:03] orbyt_: has joined #ruby
[05:28:01] sauvin: has joined #ruby
[05:28:25] mrush: has joined #ruby
[05:28:44] apeiros: has joined #ruby
[05:35:15] KeyJoo: has joined #ruby
[05:36:07] reber: has joined #ruby
[05:37:45] graphene: has joined #ruby
[05:43:44] Radar: marz_d`ghostman: yeah it's not loaded by default
[05:44:06] baweaver: Yeah, you really have to shell out for it :D
[05:44:18] Radar: baweaver: was that required? :P
[05:44:32] 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?
[05:45:36] baweaver: https://ruby-doc.org/core-2.4.0/String.html#method-i-2D-40
[05:45:40] baweaver: Ah, it was freeze it
[05:46:09] Radar: >> a = -"hello"; a.frozen?
[05:46:15] ruby[bot]: Radar: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
[05:46:21] Radar: ruby[bot]: u r ded 2 me
[05:46:50] Radar: Fenhl: are you seeing code that uses it?
[05:46:56] baweaver: havenwood-bot is still working
[05:46:57] Radar: I've never seen it
[05:47:01] Radar: havenwood: !botsnack
[05:47:07] havenwood: ACTION nom
[05:47:11] Fenhl: Radar: yes, in this file https://github.com/taw/magic-search-engine/blob/8771e77f2706a6aa342aa468e433eaf8f6c0effc/search-engine/lib/card.rb#L37
[05:47:26] Fenhl: also in line 30
[05:47:55] Radar: Fenhl: a few times. It's not common to do that in Ruby from what I've seen.
[05:47:57] baweaver: That's some nasty code
[05:48:02] Radar: Normally you'd call .freeze.
[05:48:18] Radar: and this: data["display_toughness"] ? data["display_toughness"] : @toughness
[05:48:23] Radar: could be data["display_toughness"] || @toughness
[05:48:36] Radar: https://github.com/taw/magic-search-engine/blob/8771e77f2706a6aa342aa468e433eaf8f6c0effc/search-engine/lib/card.rb#L82-L88
[05:48:37] Radar: Well duh.
[05:48:40] baweaver: Don't do it Radar
[05:48:43] baweaver: Look away, before we refactor D:
[05:48:54] Fenhl: well I'm not going to touch it for now
[05:49:05] Radar: baweaver: I've been Elbow deep in React curriculum planning today. It's nice to look at some Ruby instead.
[05:50:12] 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
[05:50:38] Fenhl: but I guess it would make sense since it seems to be “just” an optimization
[05:51:04] Radar: iirc, it will not assign memory to a string that has already been frozen
[05:51:18] Radar: "a".freeze is the same object as "a".freeze, but "a" and "a" are two distinct objects.
[05:56:02] LiftLeft: has joined #ruby
[06:04:42] apeiros: has joined #ruby
[06:07:16] LiftLeft: has joined #ruby
[06:08:32] Mike11: has joined #ruby
[06:11:37] solocshaw: has joined #ruby
[06:12:40] apeiros: has joined #ruby
[06:14:21] Nicmavr: has joined #ruby
[06:17:28] s2013: has joined #ruby
[06:18:29] doubledup: has joined #ruby
[06:24:15] snickers: has joined #ruby
[06:26:28] arup_r: has joined #ruby
[06:36:01] aupadhye: has joined #ruby
[06:43:59] rootsudo: has joined #ruby
[06:44:23] arup_r: has joined #ruby
[06:47:18] aufi: has joined #ruby
[06:52:12] za1b1tsu_: has joined #ruby
[07:00:15] despai: has joined #ruby
[07:03:16] Puffball: has joined #ruby
[07:13:48] dellavg_: has joined #ruby
[07:18:02] yohji: has joined #ruby
[07:21:56] sysvalve: has joined #ruby
[07:28:55] blackmesa: has joined #ruby
[07:29:30] doubledup: has joined #ruby
[07:30:14] doubledup: has joined #ruby
[07:31:59] Dbugger: has joined #ruby
[07:34:38] cabotto: has joined #ruby
[07:39:21] cabotto: has joined #ruby
[07:47:28] bak1an: has joined #ruby
[07:49:50] Beams: has joined #ruby
[07:50:38] pyrmont: has joined #ruby
[07:54:13] xt233: has joined #ruby
[07:54:47] xt233: has left #ruby: ()
[07:56:24] KevinSjoberg: has joined #ruby
[07:58:29] bijan_: has joined #ruby
[08:04:12] mikecmpbll: has joined #ruby
[08:04:20] Sylario: has joined #ruby
[08:10:27] nrk: has joined #ruby
[08:10:34] Sylario: has joined #ruby
[08:12:39] redlegion: has joined #ruby
[08:24:18] bijan__: has joined #ruby
[08:25:45] cabotto: has joined #ruby
[08:26:51] ArahaelPi: has joined #ruby
[08:27:30] lxsameer: has joined #ruby
[08:34:35] cabotto: has joined #ruby
[08:35:09] bijan_: has joined #ruby
[08:42:55] ArahaelPi: has joined #ruby
[08:46:44] bijan_: has joined #ruby
[08:47:57] cesario: has joined #ruby
[08:52:36] Puffball: has joined #ruby
[08:57:44] bijan_: has joined #ruby
[08:58:32] tristanp: has joined #ruby
[08:58:42] vqrs: has joined #ruby
[09:01:42] arahael1: has joined #ruby
[09:03:08] rootsudo: has joined #ruby
[09:12:07] wildermind: has joined #ruby
[09:14:27] dionysus69: has joined #ruby
[09:38:01] bijan_: has joined #ruby
[09:41:26] clorisu: has joined #ruby
[09:46:44] akem: has joined #ruby
[09:48:56] bijan_: has joined #ruby
[09:59:16] cabotto: has joined #ruby
[10:00:21] bijan_: has joined #ruby
[10:00:22] marz_d`ghostman: Is there anything I need to require to make `match` work in irb?
[10:01:35] BaroMeter: has joined #ruby
[10:01:42] bak1an: has joined #ruby
[10:04:28] aupadhye: has joined #ruby
[10:07:59] dionysus69: marz_d`ghostman: nope, it's included by default I think
[10:11:54] bijan_: has joined #ruby
[10:14:55] cabotto: has joined #ruby
[10:16:48] kapil___: has joined #ruby
[10:22:58] bijan_: has joined #ruby
[10:24:47] dextrey: has joined #ruby
[10:34:31] bijan_: has joined #ruby
[10:46:49] bijan_: has joined #ruby
[10:49:01] cabotto: has joined #ruby
[10:51:25] bijan_: has joined #ruby
[10:51:55] RougeR: has joined #ruby
[10:53:11] sarna: has joined #ruby
[10:54:05] sarna: hey, I see somebody putting "gem: --no-document" in .gemrc before installing bundler. what does that option do?
[10:54:45] RougeR: so...im at a new company and we are using mintest for testing
[10:54:59] RougeR: from what i can see, out of the box minitest does not have "contexts"
[10:55:09] RougeR: but all of their test is using contexts....
[10:55:30] RougeR: so my only assumption is that a gem is adding contexts to minitest (seen this exists)
[10:55:45] RougeR: does anyone know which gem might be doing this, here is the spec file and gemfile
[10:55:47] RougeR: https://gist.github.com/CodePint/cdf937aa8019c4dd043325be8e328243
[10:59:28] bijan_: has joined #ruby
[11:02:28] bijan__: has joined #ruby
[11:13:08] bijan_: has joined #ruby
[11:18:19] cabotto: has joined #ruby
[11:20:02] jamesaxl: has joined #ruby
[11:22:33] bijan_: has joined #ruby
[11:26:46] dextrey: has joined #ruby
[11:40:03] ineb: RougeR: probably just an alias for :describe
[11:45:31] desperek: has joined #ruby
[11:50:42] DTZUZO: has joined #ruby
[11:52:24] clorisu: has joined #ruby
[11:55:45] rootsudo: has joined #ruby
[11:57:01] gnufied: has joined #ruby
[11:58:39] bijan_: has joined #ruby
[12:00:54] sonOfRa: Huh. Formatting dates. Can anyone explain the rationale behind %p being AM/PM uppercase and %P being am/pm lowercase?
[12:01:38] arup_r: has joined #ruby
[12:04:00] bijan_: has joined #ruby
[12:06:17] fmcgeough: has joined #ruby
[12:10:13] savolla: has joined #ruby
[12:24:00] cabotto: has joined #ruby
[12:25:42] apeiros: has joined #ruby
[12:29:03] bijan_: has joined #ruby
[12:35:45] rootsudo: has joined #ruby
[12:36:02] bijan_: has joined #ruby
[12:36:31] rootsudo: has joined #ruby
[12:37:20] rootsudo: has joined #ruby
[12:38:00] rootsudo: has joined #ruby
[12:39:34] bijan__: has joined #ruby
[12:39:38] rootsudo: has joined #ruby
[12:41:44] RougeR: ineb: yeah quite possibly
[12:41:59] RougeR: maybe ill throw binding.pry in and find the method
[12:43:46] 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.
[12:45:13] havenwood: sonOfRa: I think the lower case am/pm version not being initially contemplated is probably the reason.
[12:47:54] havenwood: sonOfRa: Apparently A.M. and a.m. with dots aren't popular enough to get a directive.
[12:48:12] sonOfRa: interesting. I don't see am/pm stuff often, but subjectively it feels like am is more common than AM
[12:48:30] sonOfRa: Maybe because most times I see it is in casual conversation where nobody bothers using the shift key
[12:49:50] bmurt: has joined #ruby
[12:50:51] psychicist__: has joined #ruby
[12:52:29] aupadhye: has joined #ruby
[12:56:54] gnufied: has joined #ruby
[12:59:47] a-yogi: has joined #ruby
[13:00:26] a-yogi: hi guys, could anyone tell how can I define array of hash in ruby?
[13:00:42] a-yogi: or if there is an online doc for this?
[13:00:43] apeiros: a-yogi: [{}]
[13:00:52] apeiros: or what do you mean by "define"?
[13:01:43] apeiros: >> hoa = [{"i am" => "an"}, {"array of" => "hashes"}]; [hoa.class, hoa.first.class]
[13:01:44] ruby[bot]: apeiros: # => [Array, Hash] (https://eval.in/1052356)
[13:02:00] sticaz: has joined #ruby
[13:03:35] savolla: has joined #ruby
[13:09:48] fmcgeough: has joined #ruby
[13:11:43] bijan_: has joined #ruby
[13:12:26] dionysus69: is there a particular reason why parallel gem is not part of core ruby? or rails at least?
[13:14:12] fmcgeough_: has joined #ruby
[13:14:56] apeiros: dionysus69: no
[13:15:31] dionysus69: and so why isn't ? what does parallel gem do with GIL btw?
[13:16:04] 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.
[13:16:23] dendazen: has joined #ruby
[13:16:32] dionysus69: so that's what's confusing, if it has parallel threads then it has to do something with GIL :)
[13:16:55] RougeR: anyone done AWS stubbing before?
[13:16:56] havenwood: dionysus69: if forks
[13:16:57] havenwood: dionysus69: its threads aren't parallel
[13:17:04] havenwood: dionysus69: it* forks
[13:17:23] dionysus69: so basically it forks threads into other processes?
[13:17:35] dionysus69: process per thread?
[13:17:37] apeiros: also MRIs threads are not parallel, other ruby implementations (jruby f.ex.) can be.
[13:17:40] havenwood: dionysus69: it forks processes
[13:17:58] apeiros: not "process per thread", "process *instead* of thread"
[13:18:09] havenwood: dionysus69: i'd have to double check the implementation, but i recall it's threads *OR* process forking
[13:18:13] apeiros: and it tells you that in the readme
[13:18:14] apeiros: "Run any code in parallel Processes(> use all CPUs) or Threads(> speedup blocking operations). "
[13:18:18] dionysus69: yea just investigating what's the best way to achieve parallelism in ruby out of curiosity
[13:18:19] havenwood: what apeiros said
[13:18:38] dionysus69: this was unclear so speedup blocking operations
[13:19:09] apeiros: if a thread blocks, another thread is scheduled
[13:19:27] apeiros: IO being the common reason for blocks.
[13:19:43] dionysus69: similar to db deadlock?
[13:20:00] apeiros: no. a deadlock is more than just blocking.
[13:20:09] elomatreb: A deadlock is an error condition, blocking is perfectly normal
[13:20:21] apeiros: as in: perform an http get request, it'll take, say a second. during that second your CPU is idle.
[13:20:27] havenwood: dionysus69: check out this three-part article on the GIL: https://www.jstorimer.com/blogs/workingwithcode/8085491-nobody-understands-the-gil
[13:20:29] apeiros: use threads and fill that second with computing other stuff.
[13:21:02] elomatreb: And not necessarily your computing, threading was a thing long before multiprocessors were available for 99% of systems
[13:21:05] bijan_: has joined #ruby
[13:21:08] havenwood: dionysus69: the author of that ^ actually has one great short book on threading, and another on proceses
[13:21:25] apeiros: yeah, before multiple cores (or multiple CPUs), concurrency was the only thing there was.
[13:21:30] dionysus69: cool, that's the only clear example I've heard about what the so called green threads can be used for
[13:21:33] havenwood: dionysus69: https://www.jstorimer.com/pages/books
[13:21:37] apeiros: true parallelism isn't possible without those.
[13:25:12] thejs: has joined #ruby
[13:25:56] bijan_: has joined #ruby
[13:29:23] bijan_: has joined #ruby
[13:32:27] Rapture: has joined #ruby
[13:37:47] knight33: has joined #ruby
[13:39:09] micutzu: has joined #ruby
[13:48:13] TomyWork: has joined #ruby
[13:48:41] mostlybadfly: has joined #ruby
[13:50:48] bmurt: has joined #ruby
[13:51:40] apeiros: hi TomyWork
[13:51:58] gnufied: has joined #ruby
[13:55:07] za1b1tsu_: has joined #ruby
[14:00:37] TheBloke: has joined #ruby
[14:14:17] EXCHGR: has joined #ruby
[14:29:41] aufi: has joined #ruby
[14:31:57] TheBrayn: has joined #ruby
[14:39:15] RougeR: can anyone help with aws stubbing
[14:39:21] RougeR: need to stub a get request
[14:43:24] salasrod: What's the question RougeR?
[14:44:08] roshanavand: has joined #ruby
[14:49:55] RougeR: i want to write a test to simulate (stubbing)downloading an AWS file in an S3 bucket
[14:50:05] c0mrad3: has joined #ruby
[14:50:08] RougeR: im following this sort of stuff
[14:50:09] RougeR: https://docs.aws.amazon.com/sdkforruby/api/Aws/ClientStubs.html
[14:50:18] RougeR: but having to do it with resource stubs
[14:50:37] c0ncealed2: has joined #ruby
[14:51:02] bmurt: has joined #ruby
[14:55:26] [Butch]: has joined #ruby
[14:59:42] apeiros_: has joined #ruby
[15:06:05] sarna: has joined #ruby
[15:09:15] Caius: has joined #ruby
[15:19:05] snickers: has joined #ruby
[15:19:58] 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
[15:20:08] TomyWork: surprisingly, i got that part to work
[15:20:32] TomyWork: now i need to re-encode them and send them on their way on the other connection
[15:22:02] 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
[15:25:51] tjbp: has joined #ruby
[15:29:20] TomyWork: is anyone here familiar enough with the internals for Net::LDAP to tell me how PDUs are serialized back into BER format?
[15:31:04] troys: has joined #ruby
[15:34:39] yxhuvud: has joined #ruby
[15:36:13] Azure: has joined #ruby
[15:36:20] lomex: has joined #ruby
[15:49:29] 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 :(
[15:51:30] bmurt: has joined #ruby
[15:52:23] havenwood: sarna: What trouble are you running into?
[15:53:41] havenwood: sarna: The --no-document flag disables documentation on gem installation.
[15:53:51] 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
[15:53:57] sarna: havenwood: oh, I see.
[15:54:19] havenwood: sarna: Is the app web, gui, command line or what?
[15:54:28] sarna: havenwood: so far I've made a new project with bundler, but it's a lot of files..
[15:54:32] sarna: havenwood: CLI
[15:54:39] havenwood: sarna: So you're making a gem?
[15:55:21] havenwood: sarna: You ran `bundle gem GEM_NAME`?
[15:55:26] sarna: havenwood: well, it seems like it. I excluded Gemfile.lock, as some blog post advised me to
[15:55:31] sarna: havenwood: yes
[15:55:34] Inline: has joined #ruby
[15:56:08] sarna: havenwood: where does my code go? lib/my_app.rb ?
[15:56:34] sarna: I excluded Gemfile.lock from version control*
[15:56:38] havenwood: sarna: Yes, we exclude the Gemfile.lock from the repo by adding it to the .gitignore for gems.
[15:57:19] sarna: havenwood: ok, done
[15:57:55] havenwood: sarna: Yes, your code goes in the lib/ dir
[15:58:23] havenwood: sarna: https://guides.rubygems.org/patterns/
[15:59:27] havenwood: sarna: Pay close attention to naming conventions too: https://guides.rubygems.org/name-your-gem/
[15:59:50] sarna: havenwood: I see, thanks for the links
[16:00:08] havenwood: If you're curious about any of the files Bundler generated, just ask!
[16:00:28] sarna: havenwood: and by the way, do I have to generate bin/my_app myself somehow, or will bundler do it for me?
[16:00:53] 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.
[16:01:14] havenwood: sarna: Bundler might have a flag to create an executable. I don't use it to create gems.
[16:01:38] 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.
[16:01:46] sarna: havenwood: I see. so, the file in bin/ should be a ruby script with a #! in it?
[16:02:04] havenwood: sarna: Yes, and it should be executable.
[16:02:09] havenwood: sarna: chmod +x
[16:02:12] sarna: havenwood: bundler made a lib/ directory for me
[16:02:16] sarna: yes, yes, thanks
[16:02:50] sarna: there's already 'console' and 'setup' in lib/, should I do anything with them?
[16:02:52] havenwood: sarna: Here's a gem of mine with a simple command line interface: https://github.com/havenwood/digest-sip_hash
[16:03:02] havenwood: sarna: In bin/ you mean?
[16:03:14] sarna: havenwood: yeah, bin, I'm sorry :)
[16:03:55] havenwood: sarna: So bundler uses bin/ for those. The RubyGems convention is to use bin/ how Bundler wants to use exe/ dir.
[16:04:07] havenwood: sarna: See your gemspec for where that's set.
[16:04:33] havenwood: sarna: bin/ is the default
[16:04:48] sarna: havenwood: I don't have a exe/ dir, should I create it?
[16:05:14] 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
[16:05:30] havenwood: sarna: And this is that executable: https://github.com/havenwood/digest-sip_hash/blob/master/bin/siphash
[16:05:39] lxsameer: has joined #ruby
[16:05:48] sarna: havenwood: oh yeah, in my_app.gemspec there's 'spec.bindir = "exe"'
[16:05:57] havenwood: sarna: That's Bundler fooling with the default.
[16:06:03] havenwood: sarna: You can choose.
[16:06:14] havenwood: sarna: It's fine to follow either the RubyGems or Bundler convention.
[16:06:33] havenwood: sarna: I prefer the former.
[16:08:28] sarna: havenwood: I see. what's the trade-off there? why did they break the convention?
[16:08:41] sarna: (if it's too broad of a question just tell me, I'll google for it)
[16:13:02] havenwood: sarna: So it's a bit of a long story.
[16:13:38] sarna: ACTION takes a sit near the campfire
[16:14:22] orbyt_: has joined #ruby
[16:14:33] 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.
[16:14:35] lxsameer: has joined #ruby
[16:14:43] havenwood: Folk will, for example do: PATH="bin:$PATH"
[16:14:54] havenwood: Or: PATH="$PATH:bin"
[16:15:39] havenwood: The latter is less terrible, but both are saying "run whatever is in a `bin` directory relative to the current working directory.
[16:15:48] sarna: yes, that's what I do :^)
[16:16:16] havenwood: With the former, if someone has a `bin/ls` or other command it'll hijack what you're expecting.
[16:16:33] havenwood: The latter is better if you must have `bin` in PATH.
[16:17:27] 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`.
[16:18:17] 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.
[16:19:00] mroutis: has joined #ruby
[16:19:08] sarna: havenwood: thank you for the in-depth explanation! :D
[16:19:13] havenwood: sarna: No prob!
[16:20:21] cthulchu: has joined #ruby
[16:21:59] eddof13: has joined #ruby
[16:24:51] lxsameer: has joined #ruby
[16:24:53] sarna: seems like bundler breaks semantic versioning as well :^(
[16:25:13] sarna: (freshly created project is 0.1.0 instead of 0.0.1)
[16:25:57] xuyuheng: has joined #ruby
[16:30:11] sarna: ((actually no, major version zero (0.y.z) is for initial development. my bad))
[16:31:20] dextrey: has joined #ruby
[16:32:14] jcarl43: has joined #ruby
[16:46:24] mfunkmann: has joined #ruby
[16:46:43] mroutis: has joined #ruby
[16:49:50] 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.
[16:51:29] bmurt: has joined #ruby
[16:52:37] 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.
[16:53:58] orbyt_: has joined #ruby
[16:56:26] orbyt_: has joined #ruby
[16:57:51] gbristol: has joined #ruby
[16:58:52] bak1an: has joined #ruby
[16:59:30] ptx0: has joined #ruby
[17:01:42] apeiros_: has joined #ruby
[17:03:08] eckhardt_: has joined #ruby
[17:06:57] mroutis: has joined #ruby
[17:10:35] sauvin: has joined #ruby
[17:11:23] Azure|dc: has joined #ruby
[17:12:36] cr1xu5: has joined #ruby
[17:14:50] lxsameer: has joined #ruby
[17:20:53] akem: has joined #ruby
[17:23:03] d^sh: has joined #ruby
[17:24:55] lxsameer: has joined #ruby
[17:29:00] apeiros_: has joined #ruby
[17:34:39] lxsameer: has joined #ruby
[17:35:52] akaiiro: has joined #ruby
[17:39:52] AJA4350: has joined #ruby
[17:43:21] sameerynho: has joined #ruby
[17:44:32] jamesaxl: has joined #ruby
[17:44:37] lxsameer: has joined #ruby
[17:45:29] TomyWork: if a method yields to a block, can i somehow prevent the remainder of the method from being run after the block ends?
[17:46:06] TomyWork: i guess i could raise and catch, but is there a better way?
[17:47:39] despai: has joined #ruby
[17:47:45] baweaver: return if block_given?
[17:48:39] TomyWork: I cannot modify the method
[17:49:18] TomyWork: this is someone else's method, i want to mess with their intended execution flow
[17:50:28] baweaver: What are you trying to do, and why do you need it?
[17:51:39] 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
[17:51:43] TomyWork: so i can replay it later
[17:52:04] bmurt: has joined #ruby
[17:52:30] 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
[17:52:39] knight33: has joined #ruby
[17:53:14] bak1an: has joined #ruby
[17:53:47] 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
[17:54:06] mfunkmann: has left #ruby: ("Textual IRC Client: www.textualapp.com")
[17:54:49] 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
[17:54:54] lxsameer: has joined #ruby
[17:55:18] TomyWork: (read_ber_length is private)
[18:04:43] lxsameer: has joined #ruby
[18:05:35] TomyWork: baweaver any comments? :)
[18:09:29] alex``: has joined #ruby
[18:10:13] baweaver: TomyWork: stupid quick hack idea is alias_method to mask it
[18:10:28] baweaver: Net::LDAP is a hot mess
[18:10:41] baweaver: ACTION is in a meeting, so will respond slowly.
[18:10:53] tubbo: has joined #ruby
[18:14:20] apeiros_: TomyWork: break will return from the block, not giving back control to the yielding method
[18:14:47] mroutis: has joined #ruby
[18:14:49] lxsameer: has joined #ruby
[18:14:51] apeiros_: >> def foo; yield; puts "never printed"; end; foo do puts "before"; break; end; puts "after" # check the link
[18:14:52] ruby[bot]: apeiros_: # => before ...check link for more (https://eval.in/1052454)
[18:15:31] chouhoulis: has joined #ruby
[18:15:42] jamesaxl: has joined #ruby
[18:15:45] tubbo: baweaver: hey there
[18:15:49] tubbo: been a whil
[18:17:04] SeepingN: has joined #ruby
[18:18:05] chouhoulis: has joined #ruby
[18:19:07] chouhoulis: has joined #ruby
[18:19:22] TomyWork: apeiros_ cool, wasn't aware of that, but that's exactly what i need :)
[18:20:01] baweaver: tubbo: been busy?
[18:21:30] TomyWork: can i declare variables without assigning them?
[18:21:56] TomyWork: i want to make sure they're assigned on the outer scope not the block scope
[18:23:03] tubbo: baweaver: yeah, been pretty busy with work and music. how about you?
[18:23:28] apeiros_: TomyWork: there's no declaration in ruby, so no. you must assign.
[18:23:42] apeiros_: but as baweaver showed, just assign nil.
[18:23:51] 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.
[18:23:52] mroutis: tubbo: are you a musician/composer?
[18:24:01] apeiros: and `a,b,c = nil` works fine to assign nil to multiple vars
[18:24:14] baweaver: Shall we wander over to offtopic?
[18:24:38] bak1an_: has joined #ruby
[18:24:46] lxsameer: has joined #ruby
[18:25:31] Mikasi: has joined #ruby
[18:26:28] TomyWork: http://paste.ubuntu.com/p/vWJRzBF73C/ tadaaa
[18:27:16] 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)
[18:27:43] TomyWork: i probably should go extra clever
[18:28:28] TomyWork: don't read too much into it
[18:28:36] TomyWork: it's very basic
[18:28:46] TomyWork: and full of encoding rules
[18:29:24] apeiros: TomyWork: content_length = source.read_ber { |_, v| break v } || nil
[18:29:40] apeiros: err, the || nil is pointless :D
[18:30:12] apeiros: can be done, yes
[18:30:19] apeiros: but you didn't seem to use id
[18:30:54] apeiros: so: id, content_length = source.read_ber { |*v| break v }
[18:31:30] tdy: has joined #ruby
[18:31:34] apeiros: will break horribly if read_ber has a code-path which doesn't yield
[18:31:40] TomyWork: even shorter
[18:31:54] TomyWork: it does have such a code path
[18:32:21] quiliro: has joined #ruby
[18:32:45] apeiros: fail = true; id, content_length = source.read_ber { |*v| fail = false; break v }; raise if fail
[18:33:51] TomyWork: well it's just nil, so i dont care :)
[18:34:10] TomyWork: return nil if id == nil
[18:34:46] lxsameer: has joined #ruby
[18:36:13] TomyWork: btw, about Net::LDAP being a hot mess
[18:36:29] TomyWork: first of all, thanks, so it's not just me :D
[18:36:46] apeiros: Net::LDAP?
[18:36:50] TomyWork: got a better idea? all i need is BER parsing
[18:36:56] apeiros: ACTION remembers using 0.0.4 for ~7 years?
[18:37:11] TomyWork: baweaver said that
[18:37:26] apeiros: oh, I wasn't saying it wasn't a hot mess :D
[18:37:41] apeiros: re "better idea" - you're asking the wrong person. if you ask me, all the wheels need to be reinvented.
[18:37:57] apeiros: there might be a separate BER library
[18:38:07] apeiros: after all, that stuff is in a couple of protocols
[18:38:14] TomyWork: apeiros you havent looked at the BER encoding rules yet :D
[18:38:28] apeiros: you have no idea which wheels I've reinvented.
[18:38:58] TomyWork: i noped after looking at https://github.com/ruby-ldap/ruby-net-ldap/blob/master/lib/net/ber/ber_parser.rb#L135-L152
[18:39:41] apeiros: why? looks simple
[18:40:08] apeiros: it actually looks like an incomplete implementation
[18:40:21] apeiros: (doesn't handle 0x80 as length indicator)
[18:40:40] TomyWork: 0x80 is indeterminate length
[18:40:45] TomyWork: indeed unsupported
[18:40:58] TomyWork: as indicated by exceptions elsewhere
[18:41:24] apeiros: IMO it should raise right there
[18:41:29] apeiros: instead of returning -1
[18:41:41] apeiros: but that's where we're probably talking about "hot mess"
[18:41:58] TomyWork: well -1 is a valid way of indicating that the length is indeterminate
[18:42:13] TomyWork: the read_ber_length function has no issue determining that
[18:42:31] TomyWork: it's just that read_ber doesn't support indeterminate length
[18:43:09] apeiros: ah, I misunderstood. I thought this was a variable sized integer.
[18:43:30] apeiros: but while it is a variably sized integer, it's one supposed to indicate the length of an actual object
[18:43:36] apeiros: so yes, -1 is viable.
[18:43:55] TomyWork: anyway, i'm gonna leave or i'll stay forever ^^
[18:43:58] thy0: has joined #ruby
[18:44:46] lxsameer: has joined #ruby
[18:45:43] mroutis: has joined #ruby
[18:45:56] code_zombie: has joined #ruby
[18:52:37] bmurt: has joined #ruby
[18:54:41] lxsameer: has joined #ruby
[18:55:37] tty: has joined #ruby
[19:01:18] nowhere_man: has joined #ruby
[19:02:58] cliluw: has joined #ruby
[19:03:14] mikecmpbll: has joined #ruby
[19:05:48] headius: has joined #ruby
[19:08:50] code_zombie_: has joined #ruby
[19:16:50] code_zombie__: has joined #ruby
[19:20:22] thejs: has joined #ruby
[19:22:57] jtperreault: has joined #ruby
[19:29:27] postmodern: has joined #ruby
[19:36:42] k0mpa: has joined #ruby
[19:37:42] planigan: has joined #ruby
[19:42:51] rootsudo: has joined #ruby
[19:43:14] bmurt: has joined #ruby
[19:46:04] akaiiro: has joined #ruby
[19:48:59] bak1an: has joined #ruby
[19:49:26] dminuoso: has left #ruby: ("WeeChat 2.0.1")
[19:52:26] bak1an_: has joined #ruby
[19:58:03] planigan: has joined #ruby
[20:02:18] bmurt: has joined #ruby
[20:04:00] seym0ur: has joined #ruby
[20:04:20] seym0ur: has left #ruby: ("+++++++++++++++++++++++++++")
[20:07:21] sticaz: has joined #ruby
[20:10:19] dextrey: has joined #ruby
[20:14:49] BTRE: has joined #ruby
[20:22:51] tubbo`: has joined #ruby
[20:24:25] baweaver: Yeah, Net::LDAP was the bane of my existence for a few years.
[20:24:37] max22: has joined #ruby
[20:30:15] DarthGandalf: has joined #ruby
[20:31:37] mendelssohn: has joined #ruby
[20:33:54] planigan: has joined #ruby
[20:34:29] rootsudo: has joined #ruby
[20:38:10] lenqbit: has joined #ruby
[20:43:04] za1b1tsu_: has joined #ruby
[20:52:16] scrptktty: has joined #ruby
[20:56:03] ec: has joined #ruby
[20:59:03] lxsameer: has joined #ruby
[21:03:05] bmurt: has joined #ruby
[21:03:57] jp: has joined #ruby
[21:06:33] chouhoulis: has joined #ruby
[21:07:31] snickers: has joined #ruby
[21:07:56] bak1an: has joined #ruby
[21:13:01] chouhoulis: has joined #ruby
[21:19:28] chouhoulis: has joined #ruby
[21:31:16] nowhere_man: has joined #ruby
[21:45:36] ur5us: has joined #ruby
[21:54:03] Puffball: has joined #ruby
[21:56:52] darix: baweaver: there are worse ldap libraries
[22:01:41] DTZUZO: has joined #ruby
[22:05:06] cats: has joined #ruby
[22:05:45] Azure: has joined #ruby
[22:06:27] jane_booty_doe: has joined #ruby
[22:12:28] JJonah: has joined #ruby
[22:12:43] 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?
[22:14:22] 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
[22:15:12] JJonah: elomatreb, yes, i should have specified i want to know if there are any solutions besides that.
[22:15:37] elomatreb: Not really, since ruby doesn't have a proper module system, sadly
[22:15:52] JJonah: elomatreb: thanks, that's what i thought
[22:32:35] knight33: has joined #ruby
[22:36:19] dviola: has joined #ruby
[22:37:37] tdy: has joined #ruby
[22:39:06] jasmith: has joined #ruby
[22:53:30] bmurt: has joined #ruby
[22:59:46] lxsameer: has joined #ruby
[23:02:28] bmurt: has joined #ruby
[23:04:41] dendazen: has joined #ruby
[23:18:16] bmurt: has joined #ruby
[23:19:49] rootsudo: has joined #ruby
[23:29:06] al2o3-cr: has joined #ruby
[23:39:26] teej: has joined #ruby
[23:55:50] wyoung: has left #ruby: ("BBL, it's python time :D")
[23:59:23] akem: has joined #ruby