havenwood changed the topic of #ruby to: Rules & more: https://ruby-community.com | Ruby 2.7.1, 2.6.6, 2.5.8: 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!
TomyLobo has joined #ruby
inguz has quit [Quit: I am functioning within established parameters.]
roadie has quit [Ping timeout: 244 seconds]
sergioro has quit [Ping timeout: 264 seconds]
Emmanuel_Chanel has quit [Ping timeout: 256 seconds]
SeepingN has joined #ruby
gitter1234 has joined #ruby
renich has quit [Quit: renich]
sergioro has joined #ruby
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
FolkLore has quit [Read error: Connection reset by peer]
ur5us has quit [Ping timeout: 252 seconds]
roadie has joined #ruby
troulouliou_div2 has joined #ruby
oneeggeach has joined #ruby
Emmanuel_Chanel has joined #ruby
troulouliou_div2 has quit [Remote host closed the connection]
stryek has quit [Quit: Connection closed for inactivity]
troulouliou_div2 has joined #ruby
sergioro has quit [Ping timeout: 260 seconds]
roadie has quit [Ping timeout: 240 seconds]
drincruz has joined #ruby
troulouliou_div2 has quit [Quit: Leaving]
Garb0 has quit [Quit: Leaving]
davispuh has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
ur5us has joined #ruby
<havenwood> howdoi: If you increment me too much I break. Be careful! Use tests!
<baweaver> havenwood
<baweaver> refactoring fun
<havenwood> baweaver: o/
<baweaver> Danged mutexes
<havenwood> baweaver: Oh lordy!
<baweaver> Will show you what I have some time after tomorrow
<havenwood> Nice
<howdoi> havenwood: hah hah okies
<baweaver> Most of it is rewiring the StaticPath into a Concurrent::MutableStruct
<baweaver> Then rewiring directory to use static paths instead, shim the updater logic into it, and try a state machine on top of pending updates
<baweaver> Other than that, remove all of the exceptions in favor of DryRB Result types
<havenwood> Oh, v-words.
<havenwood> I can't read, haha.
<havenwood> Back in a sec.
<baweaver> No worries
AndroidKK has left #ruby ["WeeChat 2.8"]
<havenwood> baweaver: So many mutexes sychronizing! Like a ballet of mutexes.
<baweaver> You can get rid of most of them by making the directory use concurrent maps
donofrio has quit [Remote host closed the connection]
<baweaver> I'll show you my notes later on all of it
<baweaver> Took a while to try and understand what they were doing on that and how to shim most of it out
<baweaver> The really big problem is there's a ton of logic in there which belongs in the individual paths and directories instead of as standalone cache functions which operate on them
<howdoi> &>> [nil, 1, 2, nil].find { |n| break(n.to_s) if n.even? rescue NoMethodError}
<rubydoc> # => nil (https://carc.in/#/r/90zr)
<howdoi> but I wanted `2` :/
drincruz has quit [Ping timeout: 246 seconds]
<howdoi> havenwood: ^
<havenwood> &>> [nil, 1, 2, nil].find { |n| break(n.to_s) if n&.even? }
<rubydoc> # => "2" (https://carc.in/#/r/90zs)
<havenwood> howdoi: ^
<havenwood> howdoi: The "lonely person" operator.
<howdoi> interesting, trying to rewrite
<howdoi> [nil, 1, 2, nil].find { |n| break(foo(v)) if v rescue Error }
<howdoi> ^ in my case `foo(v)` is bombing
<havenwood> in what way?
<howdoi> in `[nil, 1, 2, nil].find { |n| break(foo(v)) if v rescue Error }`
<howdoi> foo(v) bombs, gets rescued and breaks with wrong data
<havenwood> howdoi: Put the rescue around the foo method call.
<havenwood> howdoi: Show the broken code snippet and I'm sure someone here can help. I'm assuming you're not wrapping the #foo call in the rescue block.
<havenwood> gotta go afk for a bit
<howdoi> h.find {|k,v| break(foo(v)) if v} and rescue around foo?
<howdoi> broken snippet: h.find {|k,v| break(foo(v)) if v rescue Error}
<howdoi> sure
xco has joined #ruby
xco has quit [Client Quit]
drincruz has joined #ruby
wymillerlinux has quit [Remote host closed the connection]
<howdoi> rephrasing the problem statement for everyone: i have an hash like `h={:t1=>'', :t2:''}` I need to apply a method `foo` on each element, as soon as any one of them pass without exceptions on `foo` I should return with the result of `foo(v)`
<howdoi> h.find {|k,v| break(foo(v)) if v rescue Error} rescues but with the wrong result
urushisenpai has joined #ruby
urushisenpai has left #ruby ["Leaving"]
wymillerlinux_ has joined #ruby
<leftylink> you see that we have filter_map but we do not have find_map. matz didn't want to add it without a use case in https://bugs.ruby-lang.org/issues/8421
<leftylink> so because of the lack of find_map, I usually use map followed by find
<leftylink> can use lazy if it really must only execute the block on elements before the first matching one
wymillerlinux_ is now known as wymillerlinux
<howdoi> interesting, so we do a find and then map, but the find returns a wrong value in case of rescue
<howdoi> leftylink: seriously? almost 7 years ago and there were no use cases?!
cgi has joined #ruby
<cgi> {"severity":"ERROR","time":"2020-05-08T01:38:25.41Z","correlation_id":null,"exception":"undefined method `kubeclient' for nil:NilClass","cluster_id":1,"class_name":"Clusters::Cleanup::ServiceAccountWorker","event":"sidekiq_retries_exhausted","message":"undefined method `kubeclient' for nil:NilClass"}
<cgi> how do i install kubeclient so that this method is found? This is an error from gitlab
<cgi> I did ' sudo gem install kubeclient ' - but i still get this error
Xiti has quit [Quit: Leaving]
Xiti has joined #ruby
SeepingN has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
gitter1234 has quit [Quit: Connection closed for inactivity]
sergioro has joined #ruby
<havenwood> cgi: It looks like a configuration error. Any idea what #kubeclient was supposed to be called on?
<havenwood> cgi: It doesn't seem like the kubeclient gem called #kubeclient on anything on first inspection. I'd suspect a config error. Figure out what object responds to #kubeclient.
RiPuk has quit [Quit: ZNC 1.8.0 - https://znc.in]
RiPuk has joined #ruby
roadie has joined #ruby
<cgi> havenwood, thanks
SeepingN has joined #ruby
RiPuk has quit [Ping timeout: 256 seconds]
RiPuk has joined #ruby
roadie has quit [Ping timeout: 260 seconds]
SeepingN has quit [Quit: The system is going down for reboot NOW!]
Tempesta has quit [Quit: See ya!]
RiPuk has quit [Ping timeout: 256 seconds]
RiPuk has joined #ruby
ChmEarl has quit [Quit: Leaving]
impermanence has joined #ruby
chalkmonster has joined #ruby
<havenwood> cgi: Any time. Good luck!
cgi has quit [Quit: Leaving]
Tempesta has joined #ruby
sergioro has quit [Quit: Lost terminal]
kinduff has quit [Read error: Connection reset by peer]
kinduff has joined #ruby
iNs has quit [Remote host closed the connection]
iNs has joined #ruby
roadie has joined #ruby
jcalla has quit [Ping timeout: 256 seconds]
orbyt_ has joined #ruby
sauvin has joined #ruby
roadie has quit [Ping timeout: 252 seconds]
drincruz has quit [Ping timeout: 246 seconds]
roadie has joined #ruby
ur5us has quit [Ping timeout: 260 seconds]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
orbyt_ has joined #ruby
orbyt_ has quit [Client Quit]
roadie has quit [Ping timeout: 246 seconds]
d3bug has quit [Quit: Connection closed for inactivity]
chouhoulis has quit [Remote host closed the connection]
roadie has joined #ruby
imode has quit [Ping timeout: 264 seconds]
roadie has quit [Ping timeout: 265 seconds]
roadie has joined #ruby
hassox has quit [Remote host closed the connection]
yokel has quit [Ping timeout: 246 seconds]
roadie has quit [Ping timeout: 260 seconds]
yokel has joined #ruby
alazy has joined #ruby
<alazy> I know nothing of ruby. Long ago, I ran gem install bropages. It broke since I upgraded my disto to a new release, can't find ruby 2.5, I have 2.7. Tried gem install --system, gem upgrade. No joy. What must I do?
roadie has joined #ruby
conta has joined #ruby
burgestrand has joined #ruby
schne1der has joined #ruby
<jhass> alazy: try locating the existing binwrapper (which), removing it (rm) and then installing the gem again (gem install)
roadie has quit [Ping timeout: 265 seconds]
blackmesa has joined #ruby
roadie has joined #ruby
alexherbo2 has joined #ruby
Other has joined #ruby
ritalinona has quit [Ping timeout: 240 seconds]
impermanence has quit [Ping timeout: 260 seconds]
dionysus69 has joined #ruby
jcalla has joined #ruby
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
xco has joined #ruby
Garb0 has joined #ruby
blackmesa has quit [Read error: Connection reset by peer]
blackmesa has joined #ruby
brianj has joined #ruby
<brianj> I have sorted list of integers of increasing order for example [1,6,9, 34, 35, 88, 100, 101], I need to when given an integer return the integer in the array that is lowert and closest to the input integer. Do you guys have any suggestions?
roadie has quit [Remote host closed the connection]
<phaul> either a linear scan from left to right, or a binary chop
roadie has joined #ruby
<phaul> linear scan could be done with take_while
pwnd_nsfw has quit [Read error: Connection reset by peer]
<brianj> yeah i prefer it to stop when it has a candidate..let me look up the api for take while..
<phaul> &ri Array#take_while
<brianj> you woul do a take_while{}.last ?
<phaul> that works
<brianj> &ri chop
<rubydoc> brianj: I found 2 entries matching method chop. Use &list chop if you would like to see a list
<brianj> &list chop
<rubydoc> String#chop, Kernel#chop
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Technodrome has joined #ruby
xco has joined #ruby
wilhelm418 has joined #ruby
brianj has quit [Remote host closed the connection]
roadie has quit [Ping timeout: 244 seconds]
dionysus69 has quit [Ping timeout: 258 seconds]
alexherbo2 has quit [Ping timeout: 240 seconds]
cd has quit [Quit: cd]
kristian_on_linu has joined #ruby
roadie has joined #ruby
roadie has quit [Remote host closed the connection]
alexherbo2 has joined #ruby
burgestrand has quit [Quit: burgestrand]
<al2o3-cr> they've gone. i was going to suggest i = 750; integers.reverse.bsearch { |n| n < i } which should be considerably faster.
<phaul> I'm not sure, due to the reverse. I was going to say bsearch, but woldnt reverse bring this back to linear?
darkstardev13 has quit [Ping timeout: 260 seconds]
<al2o3-cr> ah, yeah, you probably right there phaul ;)
<phaul> you could bsearch index. and -1. but you have to take care of the edge cases
burgestrand has joined #ruby
apotheon has quit [Ping timeout: 264 seconds]
alexherbo2 has quit [Ping timeout: 240 seconds]
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
apotheon has joined #ruby
<al2o3-cr> i think that's the only way.
stdedos has joined #ruby
alazy has left #ruby ["WeeChat 2.8"]
lucianp has joined #ruby
rmnull has joined #ruby
rmnull has quit [Client Quit]
<lucianp> Is there a way in ruby to create user-defined literals like in c++ e.g. 5_widgets, in which you essentially define a conversion from 5 to some other type?
<phaul> you could decorate Integer with widgets and do 5.widgets, which is what rails does with 5.days.ago
troulouliou_dev has joined #ruby
rcvu has quit [Ping timeout: 264 seconds]
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jeromelanteri has joined #ruby
burgestrand has quit [Quit: burgestrand]
Technodrome has joined #ruby
drincruz has joined #ruby
burningserenity has joined #ruby
burningserenity has quit [Quit: Leaving.]
burningserenity has joined #ruby
burningserenity has quit [Client Quit]
burningserenity has joined #ruby
akem_ has joined #ruby
akem has quit [Read error: Connection reset by peer]
Scient has quit [Ping timeout: 256 seconds]
jhass has quit [Ping timeout: 256 seconds]
jhass has joined #ruby
xco has quit [Ping timeout: 256 seconds]
x0n has quit [Ping timeout: 256 seconds]
canton7 has quit [Ping timeout: 256 seconds]
x0n has joined #ruby
Scient has joined #ruby
canton7 has joined #ruby
hodbogi has joined #ruby
alexherbo2 has joined #ruby
blackmesa has quit [Ping timeout: 246 seconds]
blackmesa has joined #ruby
hiroaki_ has joined #ruby
hiroaki has quit [Ping timeout: 240 seconds]
itok has quit [Ping timeout: 256 seconds]
itok has joined #ruby
mcspud has quit [Ping timeout: 256 seconds]
mcspud has joined #ruby
darris has quit [Ping timeout: 256 seconds]
darris has joined #ruby
daemonwrangler has quit [Ping timeout: 256 seconds]
daemonwrangler has joined #ruby
kinduff has quit [Read error: Connection reset by peer]
kinduff has joined #ruby
burningserenity has quit [Quit: Leaving.]
caterfxo has quit [Ping timeout: 260 seconds]
blackmesa has quit [Ping timeout: 258 seconds]
TCZ has joined #ruby
burgestrand has joined #ruby
Esa__ has joined #ruby
burningserenity has joined #ruby
kristian_on_linu has quit [Remote host closed the connection]
rcvu has joined #ruby
llua has quit [Ping timeout: 256 seconds]
llua has joined #ruby
rippa has joined #ruby
plutes has quit [Ping timeout: 246 seconds]
m_antis has joined #ruby
burningserenity has quit [Remote host closed the connection]
<hodbogi> I am trying to set up some software written with Ruby that requires a particular gem that fails during a C compile. I managed to get the same version of hat gem patched and built and if I do a bundle list it shows correct version, I also tried to install it globally on the system, but when I go back to the software I'm trying to set up bundle list doesn't show it, and bundle install fetches the gem again and fails compile
<hodbogi> as expected. Is there a reasonable way to get this ruby project to use the gem I installed globally and ignore its own intentions? I know very little about Ruby.
<jhass> hodbogi: what does bundle which thegemname show?
akem_ has quit [Read error: Connection reset by peer]
<hodbogi> the actual command bundle which <gem> ? it tells me which is not a valid bundle command.
chouhoulis has joined #ruby
akem_ has joined #ruby
<jhass> oh sorry, that was the gem version, I meant bundle show <gem> :)
<hodbogi> Ok. i tried it in the parent project directory then did it also in the directory where I buuilt a patched version:
<hodbogi> I'm an idiot for selecting ruby syntax for shell output but oh well :D
<jhass> really, bcrypt doesn't build for you? What kind of system is this? :D
<jhass> your shell prompt is confusing for showing no directory name :P
<jhass> I'd be interested in the output inside the project that uses the gem
sagax has joined #ruby
<hodbogi> FreeBSD. I haven't looked in complete detail of what's happening, At first I thought it might be that it doesn't like clang but I didn't look into the source much to see what was really causing it to break. I can paste the output if you would like, sure.
cow[moo] has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cow[moo] has joined #ruby
<jhass> bundle update bcrypt-ruby might the simplest solution then
<hodbogi> Yeah, I believe when I compiled bcrypt in the ports it compiled .13 as well, however this project didn't seem to want to use it. I read somewhere you can configure the versions it looks for, kind of like the way you would with Elixir in a mix file
<jhass> anyways: your patch is not picked up because bundle is invoked with --path vendor/bundle or --deployment which sets the former implicitly. That makes bundler pretty much ignore any system wide installed gems and setup a site local dir in vendor/bundle
<hodbogi> I had a feeling I might have to change those
<hodbogi> ah
<jhass> see waht bundle update bcrypt does
<hodbogi> "Using bcrypt 3.1.13 (was 3.1.12)"
<jhass> sounds good
<hodbogi> so, that's interesting, does that work just because the project doesn't care as long as it's at least .12?
<jhass> I gathered it's mastodon, right? let's take a loo
<jhass> look
<hodbogi> Yes it's mastodon.
<jhass> which version you got?
<jhass> let's assume latest. https://github.com/tootsuite/mastodon/blob/85f0e0a606905ecda1322a0f7b65d8b4ff91dd69/Gemfile does not explicitly lock bcrypt to any version.
<jhass> https://github.com/tootsuite/mastodon/blob/85f0e0a606905ecda1322a0f7b65d8b4ff91dd69/Gemfile.lock#L178 is the only dependency with a dependency on it and it restricts it to ~> 3.0 which is shorthand for >= 3.0, < 4.0
<jhass> so that's why bundler could update it, no version conflict :)
<hodbogi> yes. I used git and downloaded the stable tag
<hodbogi> that's interesting. I was curious thinking, "what happens if a newer version broke it?"
<hodbogi> But I don't know Ruby well enough. I know that Elixir's package management is kind of sort of similar in some ways
plutes has joined #ruby
<jhass> that's kinda the point of Gemfile.lock & bundler, the project can release an exact set of dependencies that it's tested against
<jhass> so yes, you shouldn't screw around with this too much
<jhass> luckily a large part of the ecosystemm does follow semver quite properly, so as long as you don't edit any version constraint in Gemfile you should be pretty safe
<adam12> bcrypt on FreeBSD :( I spent a bunch of time debugging that fix and it was only a one line change :)
<jhass> but of course it'll have you deal with merge conflicts and potentially unsupported configurations, yes
akem__ has joined #ruby
rcvu has quit [Ping timeout: 256 seconds]
<hodbogi> rofl
<hodbogi> I like freebsd because after a few years once your libraries all become out of sync you can just pkg remove all and use synth to recompile or pkg to reinstall every bit of software again, it's like reformatting without having to reformat
<hodbogi> there are other reasons I appreciate it too, such as kernel code cleanliness, but its never let me down as a server
akem_ has quit [Ping timeout: 256 seconds]
<jhass> yeah I guess the biggest issue is that just not enough people use it :D
rippa has quit [Ping timeout: 256 seconds]
al2o3-cr has quit [Ping timeout: 256 seconds]
<hodbogi> This is true
<adam12> You definitely trailblaze a bit with FreeBSD.
al2o3-cr has joined #ruby
<apotheon> It never felt like trailblazing when I've used FreeBSD.
<apotheon> It's pretty solid, in my experience.
<hodbogi> I like how we're all properly capitalizing FreeBSD, probably because we've typed it so much
<hodbogi> just kind of amusing
<apotheon> It takes me a long time to break myself of capitalization habits when it seems like a good idea to just be lax about it.
* jhass is a hipster and runs archlinux on personal servers
<apotheon> It was something like 2010 by the time I stopped capitalizing "internet" when referring to *the* Internet.
conta has quit [Remote host closed the connection]
imjoehaines has quit [Quit: rirc v0.1.2]
blackmesa has joined #ruby
blackmesa1 has joined #ruby
troulouliou_dev has quit [Quit: Leaving]
sergioro has joined #ruby
imjoehaines has joined #ruby
blackmesa has quit [Ping timeout: 240 seconds]
wymillerlinux_ has joined #ruby
TCZ has quit [Quit: Leaving]
wymillerlinux has quit [Ping timeout: 264 seconds]
wymillerlinux_ is now known as wymillerlinux
jeromelanteri has quit [Quit: Leaving]
howdoi has quit [Quit: Connection closed for inactivity]
<hodbogi> I had a professor that worked at Western Electric that would probably bring the whip out if you said Internet without a capital I
<hodbogi> He would probably even ask you if it's capitalized if you said it out loud in person just to be that kind of guy
kristian_on_linu has joined #ruby
jeromelanteri has joined #ruby
m_antis has quit [Quit: Textual IRC Client: www.textualapp.com]
sphex has quit [Ping timeout: 272 seconds]
<apotheon> hodbogi: seems annoying
<apotheon> I didn't ever give anyone else crap for not capitalizing it. I just capitalized it.
wymillerlinux has quit [Remote host closed the connection]
<apotheon> Basically, I only complain about lack of capitalization when it introduces ambiguity.
sphex has joined #ruby
<havenwood> Pick your style guide and follow it precisely.
<hodbogi> It wasn't so bad. He used to hand us stuff to pass around, fiber cables, thicknet cables, osciloscopes, even tennis balls and say "do not stick this in your eye" every time.
<apotheon> I aim for reduced ambiguity and some reasonable sense of "correctness".
<apotheon> hodbogi: nice line
<hodbogi> He would also pput questions on your test like "how much current is going through this node?" and if you wrote 3 instead of 3 mA or something, he would fail your test.
<havenwood> When Chicago Manual of Style went from "Internet" to "internet" in 2017 it resolved much of the lingering debate.
<hodbogi> even if he wrote how many amps instead of how much current, you had to be 100% explicit
<havenwood> AP and turabian saying lowercase "internet" is enough for me.
<hodbogi> lol
wymillerlinux has joined #ruby
<hodbogi> while I'm here, I set bundle to development mode with bundle install --deployment --with development to see what was going on with postgres, and I was curious if there's a way to undo that later on?
<hodbogi> setting bundle to development mode is not the correct phrase, but it's all I had on the top of my head lol
stdedos has quit [Quit: Connection closed]
<apotheon> Chicago Manual of Style is largely ignorable.
<apotheon> . . . but I don't think I've encountered any use of "internet" to mean something other than *the* Internet since about 2006, so it doesn't fundamentally matter.
<jhass> hodbogi: So bundler allows to define "groups" in the Gemfile. One of the groups Mastodon defines is called "development". It lists additional dependencies useful for development on the application. --with makes bundler install the gems from that group. It does not change anything about how it installs the other gems
nowhereman has joined #ruby
<jhass> you could call --without development to bundle install and that will make bundler to remember to not install those anymore. But it won't actually uninstall them, just not install any changes/updates to that group
<havenwood> apotheon: Alas, it's a publishing industry standard. Ruby style seems to me to be getting less fragmented over the years, maybe partially due to RuboCop coaxing folk in a direction.
nowhere_man has quit [Read error: Connection reset by peer]
<havenwood> I wouldn't mind a `ruby fmt`...
<havenwood> I can *almost* tolerate the RuboCop defaults these days.
<adam12> I use standard and it mostly stays out of my way.
<jhass> I still can't, some stuff gets worse honestly
<havenwood> Layout/SpaceInsideHashLiteralBraces: EnforcedStyle: no_space
<jhass> stuff like forcing the argument name of operator methods, just no
<havenwood> I've gotten down to just a dozen tweaks.
<adam12> Except standard (or rubocop?) hates `or return SomeConst`. So if you're using dry-monads you end up disabling that rule in a bunch of places :)
blackmesa1 has quit [Ping timeout: 246 seconds]
burgestrand has quit [Quit: burgestrand]
stnly has quit [Ping timeout: 240 seconds]
d3bug has joined #ruby
stnly has joined #ruby
<hodbogi> jhass:That makes a lot of sense
stnly has quit [Ping timeout: 256 seconds]
renich has joined #ruby
stnly has joined #ruby
ellcs has joined #ruby
shokohsc has quit [Quit: The Lounge - https://thelounge.chat]
shokohsc has joined #ruby
stnly has quit [Quit: Ping timeout (120 seconds)]
stnly has joined #ruby
conta has joined #ruby
orbyt_ has joined #ruby
plutes has quit [Ping timeout: 260 seconds]
chalkmonster has quit [Quit: WeeChat 2.8]
plutes has joined #ruby
plutes has quit [Client Quit]
plutes has joined #ruby
SeepingN has joined #ruby
duderonomy has joined #ruby
davispuh has joined #ruby
akem__ is now known as akem
cow[moo] has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
kinduff has quit [Read error: Connection reset by peer]
kinduff has joined #ruby
mouseghost has joined #ruby
<mouseghost> is `or' the same as `
<mouseghost> ||' (err sorry for newline in there)
<jhass> mouseghost: almost, they have different precedence!
<mouseghost> ohh
<mouseghost> i see, that might explain things, thanks
lxsameer has quit [Ping timeout: 258 seconds]
sphex has quit [Read error: Connection reset by peer]
blackmesa has joined #ruby
sphex has joined #ruby
burningserenity has joined #ruby
sergioro has quit [Ping timeout: 256 seconds]
lxsameer has joined #ruby
ChmEarl has joined #ruby
conta has quit [Quit: conta]
alexherbo2 has quit [Quit: The Lounge - https://thelounge.chat]
gix has joined #ruby
burningserenity has quit [Ping timeout: 240 seconds]
renich has quit [Quit: renich]
chalkmonster has joined #ruby
burningserenity has joined #ruby
imode has joined #ruby
burningserenity has quit [Ping timeout: 240 seconds]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
kristian_on_linu has quit [Remote host closed the connection]
Besnik_b has quit [Remote host closed the connection]
xco has joined #ruby
wymillerlinux has quit [Ping timeout: 246 seconds]
alexherbo2 has joined #ruby
sauvin has quit [Remote host closed the connection]
burningserenity has joined #ruby
freshmaker666 has quit [Quit: ZNC 1.7.2 - https://znc.in]
freshmaker666 has joined #ruby
<lucianp> Is it possible to get the character (or approximation of the character) of the line of the caller? The data from caller_locations provides the lineno, but I don't see the character/column number.
<adam12> lucianp: Never seen one. Maybe with some magic it would be possible. What's your use case?
cow[moo] has joined #ruby
burningserenity has quit [Ping timeout: 272 seconds]
<lucianp> adam12: (ab)using the caller_locations data to keep track of some static data specific to that call site. However, if the caller calls the same method twice on the same line, I'm lacking a way to distinguish between the two calls. If I had a character number of the line, that'd be sufficient to distinguish the two call sites on the same line.
<adam12> lucianp: You might be able to get this through TracePoint but I'm not 100% sure.
<adam12> lucianp: I would of suggested taking __method__.to_s and matching it to the caller_locations line but if it's the same method name that wouldn't work, unless somehow you had a stack of method calls and you knew where you were in the line. Not super elegant.
<adam12> lucianp: Nevermind. Just lineno in Tracepoint too.
<lucianp> method name would be the same, yea
<jhass> do I want to know what you're doing there? :D
MrCrackPot has joined #ruby
<lucianp> I'm writing a method that returns true once every specified time interval. I'm trying to stuff everything inside of it so the caller doesn't have to manage object instance lifetimes. :)
<jhass> honestly I think as a caller I would prefer having to do that so I can understand why and when my calls to the same method return what
<jhass> like maybe I want to check twice for the same time interval?
<jhass> on different code locations
<lucianp> in a sense, the why/when is specified as a parameter. The interface looks like: if once_every(2.minutes) then do_something_that_happens_every_2_mins end
<lucianp> I don't actually expect to have to use it more than once per line, so lacking a char number is not a big issue. Figured I'd try to fix that minor issue if possible though.
<jhass> Yes, I think I'd prefer a @cap ||= FreqCap.new(2.minutes, 1); if @cap.passes? kind of interface. Much easier to reason about IMO :) I don't like code where I see it and stop with, wait, how the does it do this?
<jhass> also the variable gives you an opportunity to give context info to what the cap is about
<jhass> you could name it things like @buy_limit and what not
<lucianp> yea, I see that'd be useful in a broader set of use cases
burningserenity has joined #ruby
conta has joined #ruby
meimeix has joined #ruby
stnly has quit [Quit: Ping timeout (120 seconds)]
stnly has joined #ruby
burningserenity has quit [Ping timeout: 258 seconds]
burningserenity has joined #ruby
MrCrackPot has quit [Quit: Leaving]
burningserenity has quit [Ping timeout: 260 seconds]
robotmay has quit [Remote host closed the connection]
robotmay has joined #ruby
sergioro has joined #ruby
stnly has quit [Quit: Ping timeout (120 seconds)]
stnly has joined #ruby
Garb0 has quit [Remote host closed the connection]
chalkmonster has quit [Quit: WeeChat 2.8]
wilhelm418 has quit [Ping timeout: 260 seconds]
stnly has quit [Quit: Ping timeout (120 seconds)]
stnly has joined #ruby
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
stnly has quit [Ping timeout: 240 seconds]
stnly has joined #ruby
conta has quit [Quit: conta]
arooni has quit [Ping timeout: 264 seconds]
imode has quit [Read error: Connection reset by peer]
Other has quit [Ping timeout: 240 seconds]
imode has joined #ruby
FastJack has quit [Ping timeout: 260 seconds]
wilhelm418 has joined #ruby
FastJack has joined #ruby
ritalinona has joined #ruby
arooni has joined #ruby
d3bug has quit [Quit: Connection closed for inactivity]
wymillerlinux has joined #ruby
wymillerlinux has quit [Remote host closed the connection]
wymillerlinux has joined #ruby
xco has joined #ruby
cow[moo] has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
gato has joined #ruby
arooni has quit [Ping timeout: 258 seconds]
pwl has joined #ruby
s2013 has joined #ruby
cd has joined #ruby
gato has quit [Quit: Connection closed]
romanlevin has quit [Ping timeout: 246 seconds]
renich has joined #ruby
cow[moo] has joined #ruby
arooni has joined #ruby
romanlevin has joined #ruby
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
xco has joined #ruby
stnly has quit [Quit: Ping timeout (120 seconds)]
stnly has joined #ruby
tomg has joined #ruby
ldepandis has joined #ruby
wymillerlinux has quit [Remote host closed the connection]
wymillerlinux has joined #ruby
alexherbo2 has quit [Quit: The Lounge - https://thelounge.chat]
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
caterfxo has joined #ruby
xco has joined #ruby
cnsvc has joined #ruby
inanepenguin has joined #ruby
mouseghost has quit [Quit: mew wew]
falconfox has joined #ruby
blackmesa has quit [Ping timeout: 264 seconds]
Vashy has quit [Ping timeout: 252 seconds]
Vashy has joined #ruby
mikecmpbll has joined #ruby
falconfox has quit [Remote host closed the connection]
TCZ has joined #ruby
drincruz has quit [Ping timeout: 260 seconds]
TCZ has quit [Quit: Leaving]
ruskie has quit [Quit: ...]
davispuh has quit [Ping timeout: 264 seconds]
buckworst has joined #ruby
davispuh has joined #ruby
buckworst has quit [Client Quit]
cnsvc has quit [Ping timeout: 240 seconds]
ruskie has joined #ruby
nowhereman has quit [Ping timeout: 265 seconds]
cnsvc has joined #ruby
ellcs has quit [Ping timeout: 260 seconds]
wymillerlinux has quit [Read error: Connection reset by peer]
wymillerlinux has joined #ruby
cow[moo] has quit [Ping timeout: 264 seconds]
pwl has quit [Ping timeout: 272 seconds]
cnsvc has quit [Ping timeout: 240 seconds]
cnsvc has joined #ruby
blackmesa has joined #ruby