havenwood changed the topic of #ruby to: Rules: https://ruby-community.com | Ruby 2.7.2, 2.6.6, 3.0.0-preview1: https://www.ruby-lang.org | Paste 4+ lines of text to https://dpaste.org | Books: https://goo.gl/wpGhoQ | Logs: https://irclog.whitequark.org/ruby | BLM <3 | Can't talk? Register/identify with NickServ
jenrzzz has joined #ruby
Technodrome has joined #ruby
infinityfye has quit [Quit: Leaving]
rubydoc_ has joined #ruby
phaul has joined #ruby
arahael has joined #ruby
rubydoc_ has quit [Ping timeout: 240 seconds]
phaul has quit [Ping timeout: 264 seconds]
jenrzzz has quit [Ping timeout: 240 seconds]
s2013 has joined #ruby
tv- has quit [Quit: WeeChat 2.8]
s2013 has quit [Read error: Connection reset by peer]
jenrzzz has joined #ruby
baojg has joined #ruby
drincruz has joined #ruby
baojg_ has quit [Ping timeout: 264 seconds]
tpanarch1st has quit [Ping timeout: 256 seconds]
jenrzzz has quit [Ping timeout: 260 seconds]
jenrzzz has joined #ruby
drincruz has quit [Ping timeout: 240 seconds]
DaRock has joined #ruby
SeepingN has joined #ruby
SeepingN has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
phaul has joined #ruby
rubydoc_ has joined #ruby
TCZ has joined #ruby
bmurt has joined #ruby
phaul has quit [Ping timeout: 264 seconds]
rubydoc_ has quit [Ping timeout: 260 seconds]
bmurt has quit [Ping timeout: 260 seconds]
drincruz has joined #ruby
drincruz has quit [Ping timeout: 264 seconds]
tv- has joined #ruby
bocaneri has joined #ruby
gix has quit [Ping timeout: 246 seconds]
bocaneri has quit [Max SendQ exceeded]
bocaneri has joined #ruby
GankMove has joined #ruby
bmurt has joined #ruby
DaRock has quit [Ping timeout: 256 seconds]
mozzarella has quit [Ping timeout: 272 seconds]
mozzarella has joined #ruby
TCZ has quit [Quit: Diabe? tkwi w szczegó?ach]
helpa has quit [Remote host closed the connection]
helpa has joined #ruby
cthulchu_ has quit [Read error: Connection reset by peer]
cthulchu_ has joined #ruby
cloud69 has joined #ruby
cthulchu_ has quit [Ping timeout: 264 seconds]
Tempesta has quit [Quit: See ya!]
dviola has quit [Quit: WeeChat 2.9]
dviola has joined #ruby
Tempesta has joined #ruby
GankMove has quit [Read error: Connection reset by peer]
panorain has quit [Quit: Leaving]
ChmEarl has quit [Quit: Leaving]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ur5us_ has quit [Ping timeout: 260 seconds]
roshanavand_ has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
roshanavand has quit [Ping timeout: 272 seconds]
roshanavand_ is now known as roshanavand
axsuul has quit [Ping timeout: 240 seconds]
orbyt_ has joined #ruby
axsuul has joined #ruby
jenrzzz has quit [Ping timeout: 240 seconds]
donofrio has quit [Remote host closed the connection]
axsuul has quit [Ping timeout: 256 seconds]
cthulchu_ has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cloud69 has quit [Quit: Connection closed for inactivity]
jenrzzz has joined #ruby
cthulchu_ has quit [Ping timeout: 246 seconds]
donofrio has joined #ruby
axsuul has joined #ruby
axsuul has quit [Ping timeout: 240 seconds]
code_zombie has quit [Quit: Leaving]
orbyt_ has joined #ruby
jenrzzz has quit [Ping timeout: 272 seconds]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 240 seconds]
claudiuinberlin has joined #ruby
jenrzzz has joined #ruby
SeepingN has joined #ruby
jenrzzz has quit [Ping timeout: 260 seconds]
johnny56_ has quit [Ping timeout: 256 seconds]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
johnny56_ has joined #ruby
axsuul has joined #ruby
rubydoc_ has joined #ruby
phaul has joined #ruby
SeepingN has quit [Quit: The system is going down for reboot NOW!]
_whitelogger has joined #ruby
rubydoc_ has quit [Ping timeout: 260 seconds]
phaul has quit [Ping timeout: 240 seconds]
axsuul has quit [Ping timeout: 260 seconds]
johnny56_ has quit [Ping timeout: 240 seconds]
teclator has joined #ruby
ur5us_ has joined #ruby
johnny56_ has joined #ruby
dfucci has joined #ruby
Glumetu has joined #ruby
al2o3-cr has quit [Ping timeout: 256 seconds]
vondruch has joined #ruby
Glumetu has quit [Quit: Glumetu]
gix has joined #ruby
jenrzzz has joined #ruby
axsuul has joined #ruby
cd has quit [Quit: cd]
canton7 has quit [Quit: ZNC - http://znc.in]
canton7 has joined #ruby
ur5us_ has quit [Ping timeout: 264 seconds]
gix has quit [Quit: Client exiting]
jenrzzz has quit [Ping timeout: 256 seconds]
dfucci has quit [Ping timeout: 272 seconds]
dfucci has joined #ruby
supercoven has joined #ruby
supercoven has quit [Max SendQ exceeded]
supercoven has joined #ruby
supercoven has quit [Max SendQ exceeded]
supercoven has joined #ruby
supercoven has quit [Max SendQ exceeded]
vondruch has quit [Ping timeout: 246 seconds]
supercoven has joined #ruby
supercoven has quit [Max SendQ exceeded]
supercoven has joined #ruby
supercoven has quit [Max SendQ exceeded]
rubydoc_ has joined #ruby
phaul has joined #ruby
rubydoc_ has quit [Excess Flood]
rubydoc_ has joined #ruby
jenrzzz has joined #ruby
al2o3-cr has joined #ruby
TomyWork has joined #ruby
vondruch has joined #ruby
rubydoc_ has quit [Remote host closed the connection]
rubydoc_ has joined #ruby
jenrzzz has quit [Ping timeout: 246 seconds]
shokohsc has quit [Ping timeout: 240 seconds]
cnsvc has quit [Ping timeout: 240 seconds]
otagi[m] has quit [Quit: Bridge terminating on SIGTERM]
MeVegan[m] has quit [Quit: Bridge terminating on SIGTERM]
batisi[m] has quit [Quit: Bridge terminating on SIGTERM]
Hanma[m] has quit [Quit: Bridge terminating on SIGTERM]
glimpse[m] has quit [Quit: Bridge terminating on SIGTERM]
turt2live has quit [Quit: Bridge terminating on SIGTERM]
danielk43[m] has quit [Quit: Bridge terminating on SIGTERM]
gypsy5[m] has quit [Quit: Bridge terminating on SIGTERM]
jo-so has quit [Quit: Bridge terminating on SIGTERM]
stan has quit [Quit: Bridge terminating on SIGTERM]
jenrzzz has joined #ruby
akem_ has quit [Quit: Leaving]
akem has joined #ruby
jenrzzz has quit [Ping timeout: 246 seconds]
hsiktas[m] has joined #ruby
jenrzzz has joined #ruby
rubydoc_ has quit [Ping timeout: 240 seconds]
akem has quit [Ping timeout: 268 seconds]
rubydoc_ has joined #ruby
infinityfye has joined #ruby
jenrzzz has quit [Ping timeout: 244 seconds]
sorah has joined #ruby
jenrzzz has joined #ruby
phaul has quit [Ping timeout: 260 seconds]
rubydoc_ has quit [Ping timeout: 246 seconds]
jenrzzz has quit [Ping timeout: 240 seconds]
Hanma[m] has joined #ruby
danielk43[m] has joined #ruby
stan has joined #ruby
gypsy5[m] has joined #ruby
glimpse[m] has joined #ruby
turt2live has joined #ruby
MeVegan[m] has joined #ruby
jo-so has joined #ruby
otagi[m] has joined #ruby
batisi[m] has joined #ruby
vondruch has quit [Ping timeout: 240 seconds]
bamdad has quit [Ping timeout: 240 seconds]
tpanarch1st has joined #ruby
phaul has joined #ruby
rubydoc_ has joined #ruby
rubydoc_ has quit [Ping timeout: 240 seconds]
phaul has quit [Ping timeout: 264 seconds]
_joes__ has joined #ruby
_joes__ has quit [Client Quit]
_joes__ has joined #ruby
phaul has joined #ruby
rubydoc_ has joined #ruby
_joes__ has quit []
BH23 has joined #ruby
BH23 has quit [Client Quit]
BH23 has joined #ruby
akem has joined #ruby
jmcgnh has quit [Ping timeout: 240 seconds]
vondruch has joined #ruby
TheBrayn has quit [Quit: WeeChat 2.9]
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
canton7 has quit [Quit: ZNC - http://znc.in]
canton7 has joined #ruby
drincruz has joined #ruby
roshanavand has quit [Quit: Quitting...]
al2o3-cr has quit [Ping timeout: 256 seconds]
BenDover has joined #ruby
vondruch has quit [Ping timeout: 272 seconds]
akem_ has joined #ruby
akem has quit [Ping timeout: 272 seconds]
canton7 has quit [Quit: ZNC - http://znc.in]
Rudd0 has quit [Ping timeout: 240 seconds]
canton7 has joined #ruby
drincruz has quit [Ping timeout: 265 seconds]
roshanavand has joined #ruby
Mia has quit [Write error: Connection reset by peer]
jenrzzz has joined #ruby
Mia has joined #ruby
Mia has joined #ruby
Mia has quit [Changing host]
drincruz has joined #ruby
jenrzzz has quit [Ping timeout: 272 seconds]
m27frogy has quit [Ping timeout: 246 seconds]
vondruch has joined #ruby
m27frogy has joined #ruby
TomyWork has quit [Remote host closed the connection]
TomyWork has joined #ruby
akem__ has joined #ruby
akem_ has quit [Ping timeout: 260 seconds]
infinityfye has quit [Ping timeout: 246 seconds]
Ediz has joined #ruby
<Ediz> Hello everyone
<Ediz> Today I published my first gem, I'm not sure if this is the place to ask for this but I'd love to have my code to be reviewed and would love to have any opinions/comments regarding it so I can improve. I kindly ask, if you have spare time you'd like to help me with, to check my code and let me know your comments on how I can improve and if I've done anything wrong there. https://github.com/edizarca/simple_rate_limiter
<Ediz> tyvm in advance please be harsh :D
stryek has joined #ruby
<jhass> Ediz: people would generally not commit .gem files and also for gems skip Gemfile.lock (so CI more realistically tests dependency trees of people using the gem). You also committed a GPL as LICENSE and a MIT as LICENSE.txt, which is highly confusing. If you want to dual license I would recommend combining that into one file and explaining the dual licensing. Not sure if .rspec_status is a file to be
<jhass> committed, never saw it before. Same for the coverage folder. You also don't want to commit the .bundle folder. You might want to give the README a lot more love, especially the first paragraph with the TODO.
<jhass> Ediz: you're violating naming conventions a bit by calling the gem simple_rate_limiter but use RateLimiter as a namespace
<jhass> code wise from a quick glance it looks pretty good, maybe a bit heavy on the get_ prefix side for my personal taste, but nicely modular and structured
rubydoc_ has quit [Remote host closed the connection]
rubydoc_ has joined #ruby
phaul has quit [Ping timeout: 240 seconds]
<Ediz> tyvm jhass!
<Ediz> I really appreciate it
jmcgnh has joined #ruby
phaul has joined #ruby
sleetdrop has joined #ruby
bmurt has joined #ruby
TheBrayn has joined #ruby
phaul has quit [Ping timeout: 240 seconds]
rubydoc_ has quit [Ping timeout: 256 seconds]
sleetdrop has quit [Remote host closed the connection]
ignorand has joined #ruby
phaul has joined #ruby
rubydoc_ has joined #ruby
rubydoc_ has quit [Excess Flood]
rubydoc_ has joined #ruby
rubydoc_ has quit [Remote host closed the connection]
rubydoc_ has joined #ruby
jcalla has joined #ruby
ignorand has quit [Disconnected by services]
jenrzzz has joined #ruby
rubydoc_ has quit [Ping timeout: 240 seconds]
jenrzzz has quit [Ping timeout: 264 seconds]
phaul has quit [Ping timeout: 264 seconds]
rubydoc_ has joined #ruby
phaul has joined #ruby
rubydoc_ has quit [Excess Flood]
impermanence has quit [Quit: Connection closed]
akem__ is now known as akem
phaul has quit [Ping timeout: 264 seconds]
phaul has joined #ruby
phaul has quit [Ping timeout: 240 seconds]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cow[moo] has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bmurt has joined #ruby
cow[moo] has joined #ruby
orbyt_ has joined #ruby
phaul has joined #ruby
jcalla has quit [Quit: Leaving]
jcalla has joined #ruby
ChmEarl has joined #ruby
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
phaul has quit [Ping timeout: 256 seconds]
brendan- has quit [Quit: Textual IRC Client: www.textualapp.com]
Rudd0 has joined #ruby
infinityfye has joined #ruby
brendan- has joined #ruby
dionysus69 has joined #ruby
brendan- has quit [Client Quit]
phaul has joined #ruby
cow[moo] has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cow[moo] has joined #ruby
cow[moo] has quit [Client Quit]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
al2o3-cr has joined #ruby
phaul has quit [Ping timeout: 240 seconds]
phaul has joined #ruby
cow[moo] has joined #ruby
cow[moo] has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
phaul has quit [Ping timeout: 246 seconds]
phaul has joined #ruby
cow[moo] has joined #ruby
phaul has quit [Ping timeout: 260 seconds]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cow[moo] has quit [Client Quit]
cthulchu_ has joined #ruby
rippa has joined #ruby
shokohsc has joined #ruby
phaul has joined #ruby
phaul has quit [Ping timeout: 272 seconds]
infinityfye has quit [Ping timeout: 240 seconds]
phaul has joined #ruby
jenrzzz has joined #ruby
akem has quit [Quit: Leaving]
cow[moo] has joined #ruby
jenrzzz has quit [Ping timeout: 246 seconds]
questi has joined #ruby
<questi> to install rb file dependencies i can install them as a gem?
<questi> sudo gem install lib
jenrzzz has joined #ruby
<jhass> ?xy
<jhass> questi: what's your actual problem? :)
<jhass> why do you want to "install rb file dependencies" as a gem?
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
<questi> it was on a first page of google :)
<questi> quick way to install required libs
orbyt_ has joined #ruby
orbyt_ has quit [Client Quit]
akem has joined #ruby
rippa has joined #ruby
jcalla has quit [Ping timeout: 260 seconds]
vondruch has quit [Read error: Connection reset by peer]
orbyt_ has joined #ruby
drincruz has quit [Ping timeout: 246 seconds]
lucasb has joined #ruby
bmurt has joined #ruby
jcalla has joined #ruby
jenrzzz has quit [Ping timeout: 240 seconds]
drincruz has joined #ruby
<riceandbeans> I want to take a File.stat('/path').mode and compare it to what I'd normally use, say 0755, but the numbers are coming out in an unexpected way
<riceandbeans> If I pp the File.stat it looks right, if I take the field the number is an Integer but weird
<riceandbeans> mode=0100644 (file rw-r--r--),
<riceandbeans> Really I just want the 0644 there
<jhass> >> 0o755
<jhass> &>> 0o755
* jhass kicks the bots
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<riceandbeans> jhass: but look
<jhass> riceandbeans: 0755 is octal usually, 493 as an integer
<riceandbeans> [19] pry(main)> File.stat('/etc/hosts').mode
<riceandbeans> => 33188
<jhass> .to_s(8)
<leftylink> pinkpandabot: rb 33188.to_s(8)
<riceandbeans> Gah, that's what I needed, .to_s(8)
<pinkpandabot> "100644" - https://carc.in/#/r/9znh
<riceandbeans> I forgot about that
<riceandbeans> Thanks
<riceandbeans> Then I have to chop off the first 2 numbers but I can handle that lol
<havenwood> &>> 33188.digits(8)
<havenwood> riceandbeans: Or #digits with 8.
<havenwood> #=> [4, 4, 6, 0, 0, 1]
<jhass> it's octal because then each number is three bits
<jhass> means you can mask out the values you need easily
<jhass> pinkpandabot: rb (0o765 & 0o070) >> 3
<jhass> aww it doesn't like me
<riceandbeans> I know it's octal in *nix but I didn't expect the field to return int
<riceandbeans> File.stat('/etc/hosts').mode.to_s(8)[2,4]
<riceandbeans> Anyway, that's a normal looking mode
<jhass> octal is just an integer representation
<riceandbeans> Sure, so is hex and binary
<jhass> .mode & 0o777
<riceandbeans> But when the field in a pp shows the octal I kind of expected calling the method to print octal too
<jhass> an integer doesn't have an "inherent representation"
<riceandbeans> file modes are a special case anyway
<riceandbeans> It's not really one whole octal value, it's an array of them
<riceandbeans> But here it's treated as one
<Tuor> Hi, I worked a little on my deduplication utility https://gitlab.com/nod0n/dedup. I don't remember who was intrested in it. (it has a README now), any comments / suggestion to improve it?
<jhass> no, it's one whole integer
<jhass> there's no "octal value", there's an "octal representation"
<riceandbeans> Doesn't change that it's not 1, but 3 and another that carries other data
<jhass> 1 or 3 what, what are naming here
<riceandbeans> say, 0755, file mode
<jhass> it's just a bitfield
<riceandbeans> that's really [0,7,5,5]
<jhass> 0brrrwwwxxx
<jhass> no, it's stored litterally as 0755 or 493 in decimal or 111101101 in binary
<havenwood> Tuor: When you want an offset with #each_with_index, like +1, consider: each.with_index(1)
<havenwood> Tuor: #with_index takes an offset unlike #each_with_index, for whatever historical reason.
<havenwood> Tuor: With OptionParser I think it's nicer to use the :into keyword with #parse! with a collection like a Hash or Struct.
<jhass> riceandbeans: sorry, I should've written 0buruwuxgrgwgxorowox where u = owner, g = group, o = others, r = read, w = write, x = execute
<jhass> so now we can compose, 0b110100100.to_s(8) => "644"
<riceandbeans> TIL it's not stored as separate values.
phage has joined #ruby
<jhass> riceandbeans: so the extra stuff it's just extra fields in the bitfield that linux gained over time. sticky bit and stuff like that
<jhass> because these days it's actually not relevant to cram everything into 12 or 16 bits
<riceandbeans> Ah
<Tuor> havenwood: have tried in the past, didn't get it to work, will try again, makes more sence then individual variables.
<havenwood> Tuor: Consider going ahead and cutting a gem. :)
<havenwood> Tuor: You're close to gem structure. It's a nice way to expose an executable too, even if you never mean to publish the gem to RubyGems.
<Tuor> I created a gem ~5 years ago. Will have to read on how to do it.
<Tuor> havenwood: thx.
Iarfen has joined #ruby
<Tuor> (I probably never published it, my company propably didn't want me to)
questi has quit [Quit: Leaving.]
questi has joined #ruby
<Tuor> I'll try the :into way and I'll try to get it into a gem. :)
dionysus69 has quit [Quit: dionysus69]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Tuor> havenwood: what is `ARGV.options` exactly, I can't figure it out. Where is it documented?
<Tuor> This method does only exist, when 'optionparser' is required, but I still can't find where it is documented... :(
<havenwood> Tuor: I tried to show a few undocumented features in that ^ example.
<havenwood> Tuor: We probably should document them. ¯\_(ツ)_/¯
<Tuor> havenwood: thank you, I think it makes sense. Let's see if I did understand it. ;)
orbyt_ has joined #ruby
bocaneri has quit [Remote host closed the connection]
TomyWork has quit [Quit: Leaving]
htmnc has joined #ruby
<htmnc> when I'm defining static methods for a class, is there any meaningful difference between defining self.<methodname> vs using the scope resolution explicitly via def <class>::<methodname>? they seem to execute in exactly the same ways
<htmnc> I've been trying to google around but I'm not sure what keywords to use since when I say 'scope resolution' and all that I get a bunch of stack overflow questions about what '::' is instead of comparing the two
<adam12> htmnc: None.
<htmnc> thanks!
<adam12> htmnc: Long ago, :: was used to denote class method calls. It kinda fell out of favour.
<htmnc> yeah makes sense, I think when I first learned ruby 1.9 was 'new'
<htmnc> or unstable
jenrzzz has joined #ruby
<Tuor> havenwood: how does this work? `Dedup[DEFAULTS]` https://gist.github.com/havenwood/d43aae6f4116314cbf00f9e46f340d80#file-paint-L12
<adam12> htmnc: It's in Why's book and mentioned, so it's at least 1.8 days.
<htmnc> makes sense, I'll have to double check but it's probably in my copy of The Ruby Programming Language
<adam12> htmnc: wrt self vs <class name>, inside a class definition, self resolves to <class name> anyways.
<htmnc> ohhh wait so if I inherit a class is self. more generic than <explicit parent class>:: because of that?
<adam12> htmnc: Don't follow.
<havenwood> Tuor: Same as: Dedup.new(DEFAULTS)
<Tuor> Ah ok.
<adam12> havenwood: It's interesting syntax.
<adam12> havenwood: I'm not sure I've ever seen Struct with that. Do you know if it's using the Object's call?
<htmnc> so if I have a class A and a class B < A, and within A I define a method A::foo, I was sorta thinking that self.foo would be more explicitly B::foo adam12
<htmnc> it's not really important because inheritance I just for some reason had the thought that the self. might be more polymorphic
<adam12> havenwood: Oh actually it's documented.
jenrzzz has quit [Ping timeout: 265 seconds]
<havenwood> adam12: Yeah, it's like semi documented. There should be a ::[] but it's only mentioned under ::new.
<adam12> havenwood: Yeah. I looked at struct.c and saw it in call-seq. I can't recall ever seeing it before.
<adam12> havenwood: Even source doesnt' lend much of a clue...
<havenwood> adam12: I tried to go off the beaten trail for this gist, for whatever reason.
questi has quit [Ping timeout: 240 seconds]
<adam12> htmnc: It probably won't make a difference because of the scope during parsing.
<htmnc> adam12, makes sense, thank you
phaul has quit [Ping timeout: 260 seconds]
phage has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
jenrzzz has joined #ruby
<Tuor> havenwood: My option should be like this: '--dry-run' but my symbol is :dry_run (as :'dry-run' would be ugly). How can I map it?
<havenwood> Tuor: See my `--glow-in-the-dark` example.
jenrzzz has quit [Ping timeout: 240 seconds]
<havenwood> Tuor: --[no-]glow_in_the_dark
<Tuor> havenwood: ah now i get it. thx!
ur5us_ has joined #ruby
<Tuor> second question, '--main MAIN_PATH' and '--secondary SECONDARY_PATH' should be able to be passed each one or more times. How can I get optparse to add it to the array? Example: dedup.rb --main 1 --main 2 --secondary 3
phaul has joined #ruby
howdoi has joined #ruby
<Tuor> havenwood: I'm sorry, but I can't see where they use the same options multiple times, or more important, where they make it possible to use the same option multiple times.
<Tuor> This example isn't using the :into way.
<Tuor> I know I can do it by calling blocks for a option like I did before: https://gitlab.com/nod0n/dedup/-/blob/master/dedup.rb#L16 but how can I achieve that, now that I use .permute!(into: dedup)?
cnsvc has joined #ruby
htmnc has quit [Quit: Leaving]
xvx has joined #ruby
jcalla has quit [Remote host closed the connection]
<Tuor> I now found a way, but's it's the same as before: o.on('-mMAIN_PATH', '--main MAIN_PATH', 'a main path') {|p| dedup[:main] << p}
Synthead has joined #ruby
<Synthead> What is the new ruby 2.7 "pass through" parameters officially called? i.e. def my_method(...); call_another_method(...); end
<adam12> Synthead: Argument forwarding
<Synthead> adam12: great, thanks! it seems to be called a bunch of stuff online :D
<adam12> Synthead: I took it from the Ruby release notes, so I'm presuming it's accurate.
<Synthead> :+1:
shoshin has left #ruby ["The Lounge - https://thelounge.chat"]
jenrzzz has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Technodrome has joined #ruby
jenrzzz has quit [Ping timeout: 240 seconds]
pwnd_sfw3 has joined #ruby
pwnd_sfw has quit [Ping timeout: 256 seconds]
pwnd_sfw3 is now known as pwnd_sfw
<Synthead> How would you document methods with YARD that accept argument forwarding?
<adam12> Synthead: Not sure if it's even possible yet, but I could be wrong.
jenrzzz has joined #ruby
duderonomy has joined #ruby
jenrzzz has quit [Ping timeout: 240 seconds]
jenrzzz has joined #ruby
<Tuor> havenwood: I'll continue an other day, but I'm not completly sattisfied: https://gitlab.com/nod0n/dedup/-/blob/0eee53856e70ab584c36aaac76f8ef53198f6f15/dedup.rb (it's somewhat complex and in my opinion it was easier to read before)
<havenwood> Tuor: Just got back. I can show you how to make a custom type coercion for "multiple" some other time.
jenrzzz has quit [Ping timeout: 272 seconds]
<havenwood> Tuor: The most straightforward way is to use the pre-made Array type conversion, but that'd mean comma delimiting rather than passing the argument multiple times.
<havenwood> Tuor: You can make a custom type coercion that'll do the multiple times way though too.
<havenwood> Tuor: Or use the old-school syntax, like you have done.
<Tuor> ah ok. ',' could be part of a "path". '/tmp/this,is,a,valid,path'. I found the ',' separator way on the internet, but that's why I didn't use it. Would be intresting, having a custom coercion, but sadly not tonight. I have to work tomorrow. :) Thank you and have a good night.
jenrzzz has joined #ruby
Synthead has quit [Quit: Leaving]
TCZ has joined #ruby
jenrzzz has quit [Ping timeout: 256 seconds]
jenrzzz has joined #ruby
dfucci has quit [Ping timeout: 260 seconds]
jenrzzz has quit [Ping timeout: 272 seconds]
cd has joined #ruby
orbyt_ has joined #ruby
phaul has quit [Ping timeout: 272 seconds]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 264 seconds]
dfucci has joined #ruby
phaul has joined #ruby
gix has joined #ruby
dfucci has quit [Ping timeout: 260 seconds]
BenDover has quit [Quit: BenDover]
dfucci has joined #ruby
phaul has quit [Ping timeout: 240 seconds]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
TCZ has quit [Quit: Diabe? tkwi w szczegó?ach]
helpa has quit [Remote host closed the connection]
helpa has joined #ruby
dfucci has quit [Ping timeout: 246 seconds]
Iarfen has quit [Remote host closed the connection]
ruurd has joined #ruby
ruurd has quit [Client Quit]
ruurd has joined #ruby
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
phaul has joined #ruby
dfucci has joined #ruby
phaul has quit [Remote host closed the connection]
phaul has joined #ruby
Technodrome has joined #ruby
hiroaki has quit [Ping timeout: 256 seconds]
dfucci has quit [Ping timeout: 246 seconds]
<riceandbeans> Is there a less horrid way to write this?
<riceandbeans> expect(File.stat(filepath).mode.to_s(8)[3]).to be >= 4
<ruurd> regexp the mode string?
<riceandbeans> i just feel like ^^^^^ looks unclear
<ruurd> obscure at least.
<ruurd> as in what is this person testing here exactly?
<riceandbeans> Yeah, well, I'm not winning anyone over with that test
<riceandbeans> Hence asking how would I make it at least less ugly
<leftylink> I sort of want to suggest https://ruby-doc.org/core-2.7.0/Integer.html#method-i-allbits-3F but sometimes I am not confident in my understanding of the *bits? methods.
<leftylink> this absolutely is a case where allbits? would be useful though
<leftylink> ruby 2.5 required
<ruurd> huh?
<leftylink> no allbits? in 2.4
<ruurd> meaning the bits and the mask are the same right?
<ruurd> or am I crosseyed?
<riceandbeans> I'll be lucky to have a ruby that new
<leftylink> pinkpandabot: rb [0x1234, 0x1100, 0x1034].map { _1.allbits?(0x200) }
<pinkpandabot> [true, false, false] - https://carc.in/#/r/9zpm
<leftylink> that jives with my understanding
<jhass> riceandbeans: (.mode & 0o700 >> 6).to be >= 0o4
<leftylink> also note that a positive index with to_s(8) is going to cause a person much unhappiness
<riceandbeans> leftylink: In what case would File.stat.mode.to_s(8) return a positive index?
e2 has joined #ruby
<leftylink> you're using a positive index right there, with [3]
<leftylink> as for your question... I'll take a look on my filesystem and see if it'll ever be an issue
<leftylink> with any luck, it'll nevver be an issue
<riceandbeans> lol
<jhass> (.mode & 0x700).to be >= 0o400 is fine too
<riceandbeans> I don't understand that line
<riceandbeans> I mean, the first hove
<riceandbeans> half rather
<jhass> learn bitmasks, valuable tool in your belt well beyond this
<riceandbeans> I mean, I understand file mode levels as sums of 1,2,4
<jhass> 0b110 & 0b101 #=> 0b100
<jhass> that's just an artifact of being a bitfield
<jhass> that the sums are powers of two
<riceandbeans> I don't understand the other thing you just did either
<riceandbeans> IS that just like the commonality?
xvx has quit [Ping timeout: 264 seconds]
<riceandbeans> of 110 and 101, they both had 1
<riceandbeans> or rather the 100
<jhass> yes, it's binary and
<jhass> 0b110 | 0b101 #=> 0b111 # binary or
<riceandbeans> Why in the first one did you >> 6
<jhass> that's a shift
<jhass> 0b1100 >> 2 #=> 0b11
<jhass> each octal digits is three binary digits, we want to extract the binary digits 7-9, so we have to "get rid" of 1-6
<leftylink> a little weird isn't it... File::Stat has world_readable? and world_writable? and readable?, writable? (for the effective uid), but not something like owner_readable?. too bad.
<leftylink> maybe not weird, just nobody ever asks for that
drincruz has quit [Ping timeout: 240 seconds]
<riceandbeans> leftylink: Instead they do horrible things like I wrote, or if they're smarter they do stuff like jhass
<jhass> heh, "smarter", second example above should be 0o not 0x too of course
<leftylink> well, with 2.5 or above one can use less brainpower with allbits?, but behind the scenes allbits? is just doing the bitwise AND and comparing
<leftylink> so, good to know
<jhass> mh, allbits? still requires you to understand bitmasks
<riceandbeans> I feel like Perl is my native tongue and I couldn't do bitmasks with Perl either so I feel particularly dumb right now and like i need to study this
<leftylink> I am waiting for anyone in this channel to say "I'm not an allbit, I'm an orbit"
<leftylink> anyone
<leftylink> ... guess not
<leftylink> they would have said it by now, they've had 15 minutes since I first brought up allbits
<riceandbeans> The random fundamental stuff you don't get when you don't go to school at all
<jhass> fwiw I always have to open pry and verify these too
<riceandbeans> jhass: I don't think this is right
<riceandbeans> I have pry open all the time
<riceandbeans> # ls /etc/rc.conf
<riceandbeans> 15562782 .rw-r--r-- 1.1k root wheel 21 Nov 20:19 /etc/rc.conf
<riceandbeans> So, 0644
<riceandbeans> [11] pry(main)> File.stat('/etc/rc.conf').mode & 0o700 >> 6
<riceandbeans> => 4
<riceandbeans> I would expect that to be 6
<jhass> >> binds stronger I think
<riceandbeans> What?
<jhass> (.mode & 0o700) >> 6
<leftylink> it definitely does
<leftylink> not because I memorised that by heart but because I just tried it
<leftylink> I never even tried to memorise which comes first
<riceandbeans> [13] pry(main)> File.stat('/etc/rc.conf')(.mode & 0o700) >> 6
<riceandbeans> SyntaxError: unexpected '(', expecting end-of-input
<riceandbeans> File.stat('/etc/rc.conf')(.mode & 0o700) >> 6
<leftylink> always have to try it every single time
<jhass> I'm lazy ;P
<jhass> of course the ( goes to the start of line
<jhass> leftylink: eh, I have some gut feeling and my rule of thumb is if I had to double check, just add parens
<riceandbeans> riiiiiiiiiight
<riceandbeans> Ok, NOW it returns 6
<jhass> because then I don't have to double check again next time I read the cocde
<leftylink> the only one I know is that && goes before || because && is multiplication and || is addition
<riceandbeans> ....what?
<leftylink> which reminds me, what was that language that has no operator precedence at all?
jenrzzz has joined #ruby
drincruz has joined #ruby
<riceandbeans> brainfuck?
ur5us_ has quit [Ping timeout: 264 seconds]
TCZ has joined #ruby
jenrzzz has quit [Ping timeout: 240 seconds]