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
fippy has quit [Remote host closed the connection]
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
johnny56 has joined #ruby
dfucci has quit [Ping timeout: 260 seconds]
philCryo has joined #ruby
dionysus69 has joined #ruby
philCryo has quit [Ping timeout: 260 seconds]
Rudd0 has quit [Ping timeout: 265 seconds]
ur5us_ has joined #ruby
dionysus69 has quit [Quit: dionysus69]
Rudd0 has joined #ruby
voker57 has quit [Remote host closed the connection]
iNs has quit [Ping timeout: 240 seconds]
iNs has joined #ruby
dfucci has joined #ruby
voker57 has joined #ruby
Emmanuel_Chanel has quit [Quit: Leaving]
bambanx has quit [Read error: Connection reset by peer]
johnny56 has quit [Ping timeout: 240 seconds]
dfucci has quit [Ping timeout: 272 seconds]
fippy has joined #ruby
johnny56 has joined #ruby
philCryo has joined #ruby
philCryo has quit [Ping timeout: 240 seconds]
baojg has joined #ruby
banisterfiend has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
banisterfiend has joined #ruby
banisterfiend has quit [Client Quit]
wildtrees has quit [Quit: Leaving]
roshanavand_ has joined #ruby
roshanavand has quit [Ping timeout: 264 seconds]
roshanavand_ is now known as roshanavand
dfucci has joined #ruby
Xiti` has joined #ruby
weaksauce has quit [Quit: Textual IRC Client: www.textualapp.com]
weaksauce has joined #ruby
Xiti has quit [Ping timeout: 265 seconds]
brainfunnel has joined #ruby
dfucci has quit [Ping timeout: 240 seconds]
mistergibson has joined #ruby
bmurt has joined #ruby
Xiti` has quit [Quit: Leaving]
orbyt_ has joined #ruby
philCryo has joined #ruby
philCryo has quit [Ping timeout: 264 seconds]
dfucci has joined #ruby
znz_jp has quit [Remote host closed the connection]
dfucci has quit [Ping timeout: 260 seconds]
DaRock has joined #ruby
znz_jp has joined #ruby
lucasb has quit [Quit: Connection closed for inactivity]
Emmanuel_Chanel has joined #ruby
ur5us has joined #ruby
ur5us_ has quit [Ping timeout: 264 seconds]
bamdad has joined #ruby
<cloud69> I'm trying to live stream some tweets using TweetStream, Active Job and Sidekiq. But how come `TwitterStreamerJob.perform` doesn't seem to get executed? At least I'm not getting any tweets or errors. https://gist.github.com/cloud69420/7819235ce14bcac832290669888aa1b0
gix has quit [Ping timeout: 264 seconds]
philCryo has joined #ruby
philCryo has quit [Ping timeout: 256 seconds]
TCZ has quit [Quit: Diabe? tkwi w szczegó?ach]
helpa has quit [Remote host closed the connection]
helpa has joined #ruby
ur5us_ has joined #ruby
DaRock has quit [Ping timeout: 240 seconds]
ur5us has quit [Ping timeout: 272 seconds]
DaRock has joined #ruby
chouhoulis has quit [Remote host closed the connection]
philCryo has joined #ruby
ChmEarl has quit [Quit: Leaving]
philCryo has quit [Ping timeout: 260 seconds]
bdnelson has quit [Quit: Textual IRC Client: www.textualapp.com]
bdnelson has joined #ruby
dfucci has joined #ruby
DTZUZU has quit [Read error: Connection reset by peer]
bdnelson has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
TheMoonMaster has quit [Ping timeout: 272 seconds]
asdasdas has joined #ruby
brainfunnel has quit [Quit: whoops]
TheMoonMaster has joined #ruby
fowl has quit [Ping timeout: 272 seconds]
dfucci has quit [Ping timeout: 272 seconds]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
fowl has joined #ruby
jokester_ has quit [Ping timeout: 272 seconds]
jokester_ has joined #ruby
DTZUZU has joined #ruby
philCryo has joined #ruby
dcunit3d has joined #ruby
philCryo has quit [Ping timeout: 265 seconds]
ur5us_ has quit [Ping timeout: 260 seconds]
Lewix has quit [Ping timeout: 272 seconds]
Lewix has joined #ruby
dcunit3d has quit [Ping timeout: 265 seconds]
kozowu has quit [Ping timeout: 272 seconds]
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
kozowu has joined #ruby
andornaut has quit [Ping timeout: 260 seconds]
andornaut has joined #ruby
donofrio has quit [Remote host closed the connection]
wallace_mu has quit [Ping timeout: 260 seconds]
asdasdas has quit [Ping timeout: 245 seconds]
Lewix has quit [Ping timeout: 272 seconds]
Lewix has joined #ruby
philCryo has joined #ruby
manveru has quit [Ping timeout: 272 seconds]
manveru has joined #ruby
philCryo has quit [Ping timeout: 264 seconds]
chouhoulis has joined #ruby
chouhoulis has quit [Ping timeout: 240 seconds]
ur5us has joined #ruby
<fippy> <cloud69> Did you run bundle exec sidekiq?
<cloud69> fippy: Oops, no i did not :(
<cloud69> I wrongly assumed it wasn't necessary anymore because of Active Job
factormystic has quit [Ping timeout: 240 seconds]
dcunit3d has joined #ruby
Xiti has joined #ruby
dfucci has joined #ruby
envex has joined #ruby
_paul0 has joined #ruby
paul0 has quit [Ping timeout: 240 seconds]
philCryo has joined #ruby
supercoven has joined #ruby
supercoven has quit [Max SendQ exceeded]
supercoven has joined #ruby
philCryo has quit [Ping timeout: 272 seconds]
ur5us has quit [Ping timeout: 260 seconds]
s2013 has joined #ruby
<cloud69> fippy: thanks :)
johnny56 has quit [Ping timeout: 240 seconds]
dfucci has quit [Ping timeout: 256 seconds]
sleetdrop has joined #ruby
cer0 has quit [Quit: leaving]
johnny56 has joined #ruby
william1_ has joined #ruby
Rudd0 has quit [Ping timeout: 256 seconds]
philCryo has joined #ruby
philCryo has quit [Ping timeout: 240 seconds]
envex has quit []
fippy_ has joined #ruby
fippy has quit [Ping timeout: 265 seconds]
hiroaki has joined #ruby
ur5us has joined #ruby
howdoi has quit [Quit: Connection closed for inactivity]
chouhoulis has joined #ruby
ua has quit [Ping timeout: 256 seconds]
chouhoulis has quit [Ping timeout: 272 seconds]
ua has joined #ruby
dcunit3d has quit [Ping timeout: 265 seconds]
Furai has quit [Quit: WeeChat 2.9]
<cloud69> fippy_: Finally set up redis launched sidekiq. Stupid question but now what? Where are the error messages? How do I debug the code?
ur5us has quit [Ping timeout: 265 seconds]
s2013 has quit [Ping timeout: 256 seconds]
Furai has joined #ruby
<cloud69> nevermind got it
XV8 has quit [Ping timeout: 260 seconds]
dcunit3d has joined #ruby
TomyWork has joined #ruby
BenDover has joined #ruby
philCryo has joined #ruby
XV8 has joined #ruby
Glumetu has joined #ruby
philCryo has quit [Ping timeout: 256 seconds]
dcunit3d has quit [Ping timeout: 256 seconds]
dfucci has joined #ruby
Jonopoly has joined #ruby
SeepingN_ has joined #ruby
SeepingN has quit [Disconnected by services]
cthulchu_ has quit [Ping timeout: 256 seconds]
<fippy_> <cloud69> byebug gem is a nice debugger
`Alison has quit [Quit: ZNC 1.7.4+deb4 - https://znc.in]
`Alison has joined #ruby
philCryo has joined #ruby
philCryo has quit [Ping timeout: 272 seconds]
arooni has quit [Quit: ZNC - http://znc.in]
arooni has joined #ruby
william1_ has quit [Ping timeout: 256 seconds]
william1_ has joined #ruby
Mrgoose6 has joined #ruby
Mrgoose has quit [Ping timeout: 246 seconds]
Mrgoose6 is now known as Mrgoose
DaRock has quit [Ping timeout: 240 seconds]
pwnd_sfw has quit [Read error: Connection reset by peer]
akem has quit [Ping timeout: 256 seconds]
andremedeiros has quit [Quit: ZNC 1.8.2 - https://znc.in]
andremedeiros has joined #ruby
LtHummus_ has joined #ruby
LtHummus has quit [Ping timeout: 265 seconds]
zofrex has quit [Disconnected by services]
nofrex has joined #ruby
mniip_ has joined #ruby
mniip has quit [Ping timeout: 619 seconds]
Emmanuel_Chanel has quit [Quit: Leaving]
pwnd_sfw has joined #ruby
Rudd0 has joined #ruby
mniip has joined #ruby
mniip_ has quit [Ping timeout: 619 seconds]
Bish has joined #ruby
<Bish> i know there is Dir.tmpdir, but is there a way to have a "consistent" tmpdir?
<Bish> so that i can call it from multiple proccesses and it will "find" that here is already tmpdir "image_cache" ?
<pwnd_sfw> You could explicitly create one
braincrash has joined #ruby
sleetdrop has quit [Quit: Textual IRC Client: www.textualapp.com]
ivz_hh has quit [Read error: Connection reset by peer]
<Bish> yeah but how do i know that none else creates /tmp/image_cache
<Bish> i mean, i can't just "pollute" "namespace" like that do i?
<pwnd_sfw> are they multiple processes of the same application? Maybe tmpdir isn't the right place
rapha has joined #ruby
<rapha> hey all
<rapha> is there a simple way of making invisible characters (whitespace and others) in a string, visible?
<rapha> okay, i should add: without changing the visible ones ... i.e., i don't mean to turn the string into a list of unicode codepoints - more like: if it's ASCII, keep it as it is, otherwise, show the codepoint
Jonopoly has quit [Quit: WeeChat 2.9]
Emmanuel_Chanel has joined #ruby
<cloud69> fippy_: Nice, never used it before but looks just like bindings.pry? Anyway how do I byebug this active job code? Everything looks fine in the Sidekiq and Redis consoles. But my Twitter streaming can't be working because I haven't entered the proper credentials yet.
<cloud69> nevermind! seems i can comment out the sidekiq line in application.rb in order to see the results in my console
charrit69 has joined #ruby
baojg has quit [Remote host closed the connection]
baojg has joined #ruby
TCZ has joined #ruby
baojg_ has joined #ruby
baojg has quit [Ping timeout: 264 seconds]
ntt has joined #ruby
<ntt> Hi, I'm having a strange problem with encoding. I have a table in utf8mb4 and I have to convert one field in iso-8859-1. So I'm trying "MyModel.find(1).field.encode('ISO-8859-1', 'UTF-8', :invalid => :replace, :undef => :replace, :replace => '')", but the result is "Giudizio ordinario civile - 1°". if I do the same but with puts before, I obtain "Giudizio ordinario civile - 1°" (without the wrong char). Please, how can I solve?
<ntt> I need to save the correct version in a var
Mikaela has joined #ruby
chouhoulis has joined #ruby
chouhoulis has quit [Ping timeout: 265 seconds]
mistergibson has quit [Read error: Connection reset by peer]
mistergibson has joined #ruby
Mikaela has quit [Quit: Mikaela]
Mikaela has joined #ruby
weaksauce has quit [Ping timeout: 272 seconds]
plant_enjoyer has joined #ruby
cd has quit [Quit: cd]
<Bish> step one, don't use mysql :]
<Bish> charlock_holmes and mojibake is gud
<Bish> for these kind of things
donofrio has joined #ruby
<Bish> encoding = CharlockHolmes::EncodingDetector.detect(s)
<Bish> CharlockHolmes::Converter.convert(s, encoding[:encoding], 'UTF-8')
<Bish> you could write a method "isoify" with that :D
banisterfiend has joined #ruby
Rudd0 has quit [Ping timeout: 265 seconds]
supercoven has quit [Ping timeout: 240 seconds]
Milos has quit [Ping timeout: 272 seconds]
<Glumetu> if i compose the name of an variable using .gsub how can i assign a value of that variable? player = "shirt_color_new".gsub("color" , "blue")
<Glumetu> shirt_blue_new = 221AB4
<Glumetu> or player = 221AB4 ?
derpadmin has quit [Remote host closed the connection]
Milos has joined #ruby
TCZ has quit [Quit: Diabe? tkwi w szczegó?ach]
helpa has quit [Remote host closed the connection]
helpa has joined #ruby
charrit69 has quit [Ping timeout: 240 seconds]
andornaut has quit [Remote host closed the connection]
william1_ has quit [Ping timeout: 256 seconds]
Milos has quit [Ping timeout: 260 seconds]
dcunit3d has joined #ruby
Milos has joined #ruby
stryek has joined #ruby
TCZ has joined #ruby
dcunit3d has quit [Ping timeout: 260 seconds]
baojg has joined #ruby
wallace_mu has joined #ruby
ChmEarl has joined #ruby
dcunit3d has joined #ruby
baojg_ has quit [Ping timeout: 264 seconds]
akem has joined #ruby
<splud> Have some code in ruby which runs as a standalone script. however, need to require that into another script - and these are downloaded with a command, so when the first script is actually require'd into another (literally a wrapper to iterate a procedure), the wrapper will have out of necessity defined some of the classes the second script will also define (for when it'd have been running standalone). Logging and reporting status type stuff. Note
<splud> that the wrapper itself is having to download the second script, so can't outright require it up front - it's not on the filesystem.
<splud> what is a suitable way to define a class or function only if not already defined - or would encapsulating it in a exception handler be the approach?
<splud> Oh, also needs to run across a grossly wide variety of ruby versions - back to 1.87 or so.
charrit69 has joined #ruby
<splud> Glumetu - player would be "shirt_blue_new"
<splud> you might read up on "eval()"
<adam12> Glumetu: Sometimes if you're making dynamic variables you might want a Hash. What's the rest of your code look like?
<adam12> splud: unless defined?(SomeClass); class SomeClass; end; end
<splud> note also that eval isn't going to instantiate a variable - you can't eval("broken = array[]')
charrit69 has quit [Ping timeout: 240 seconds]
braincrash has quit [Ping timeout: 240 seconds]
charrit69 has joined #ruby
ivz_hh has joined #ruby
<Glumetu> tyvm for answering i'm just a noob and try to compose the name of a variable and try to assign to it the value of another variable
<adam12> Glumetu: local_variable_set("shirt_color_new".gsub("color", "blue"), "221AB4")
<adam12> Glumetu: Tho I still think you might want something more here, like a Hash.
brainfunnel has joined #ruby
<Glumetu> i will try with this piece of code cause i only have 5 of them
<adam12> Glumetu: You definitely want a Hash then.
<adam12> Glumetu: If you show some code we could give you a better answer.
braincrash has joined #ruby
SeepingN_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Glumetu> col_j1 = "_J_OO_color_new".gsub("OO","#{$symbF1}")
<Glumetu> this gives me the string
code_zombie has joined #ruby
<Glumetu> but this string i want it to be the actual name of a variable
<Glumetu> and that variable to make it take the value of a allready set variable
SeepingN has joined #ruby
<Glumetu> the $symbF1 = "AB"
<adam12> Glumetu: Paste your file into https://dpaste.org because I'm not following.
william1_ has joined #ruby
<adam12> Glumetu: I'll look at it in a few minutes.
impermanence has joined #ruby
<plant_enjoyer> hey, I want to require a config file with a bunch of constants. can I put them under some namespace?
<plant_enjoyer> I'm doing `require_relative "./config"`, I'd like to refer to the constants like `config.FOO`, `config.BAR`
<plant_enjoyer> should I just make that file a module?
impermanence has quit [Client Quit]
<plant_enjoyer> damn, there is even `Module#constants`. I love ruby! sorry for the noise :)
chouhoulis has joined #ruby
Schmitze333 has joined #ruby
<tsujp> to compile ruby with jemalloc it's just a flag right? As in a literal singular flag?
<adam12> Glumetu: Code didn't make anything clearer for me, unfortunately. What is _J_AB_color_new?
TomyWork has quit [Ping timeout: 260 seconds]
<Glumetu> ok i'll try better w8 1 min
<al2o3-cr> tsujp: yes, --with-jemalloc
<adam12> tsujp: Provided you have jemalloc, yes.
<adam12> tsujp: Depending on the platform, jemalloc might be presumed (FreeBSD?)
Schmitze333 has quit [Remote host closed the connection]
Schmitze333 has joined #ruby
<adam12> Glumetu: At a high level, what are you doing. A game with players who have different shirt colours?
TomyWork has joined #ruby
paydro has joined #ruby
bdnelson has joined #ruby
<Glumetu> this is the best i can explain what i try to do
<Glumetu> the problem lies in the last 5 lines
banisterfiend has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bdnelson has quit [Quit: Textual IRC Client: www.textualapp.com]
<tsujp> I can see there is fullstaq-ruby but they don't have alpine based images
<tsujp> So I am thinking about doing that myself
<tsujp> al2o3-cr adam12 ^
<adam12> Glumetu: There's lots of places to improve this Ruby code, but maybe this gets you unstuck?
plant_enjoyer has quit [Quit: Leaving]
<Glumetu> going to be here for a long time trying to improve :) Thank you for youre time
<adam12> Glumetu: You almost always want a Hash in this case. Using local_variable_set and local_variable_get is not ideal. But I can't figure out what you're ultimate goal is so we'll roll with it.
<adam12> (Hash or other higher order Object)
<Glumetu> that was the ultimate goal ... some of the variables in first group to get in the end the values from second group
Schmitze333 has quit [Ping timeout: 260 seconds]
Schmitze333 has joined #ruby
Schmitze` has joined #ruby
Schmitze333 has quit [Ping timeout: 264 seconds]
Schmitze` has quit [Ping timeout: 240 seconds]
noctux has joined #ruby
cloud69 has quit [Quit: Connection closed for inactivity]
Schmitze` has joined #ruby
greypack has joined #ruby
Schmitze` has quit [Ping timeout: 260 seconds]
Glumetu has quit [Quit: Glumetu]
Rudd0 has joined #ruby
<noctux> hmm, I have to proxy a larger class and override only very few, specific methods, so I came up with using method_missing. However, as the Proxy should pass as the object itself, I also hooked kind_of? like this: https://paste.xinu.at/Bgtn5g/ Is there a better/more standardized way of doing that? or will this soluton most likely blow up somewhere (sory, I'm not too familiar with ruby)
<adam12> noctux: SimpleDelegator or DelegateClass from stdlib would be similar.
<adam12> noctux: I'm not sure about patching kind_of?, but generally patching is_a? and similar can have strange effects.
<adam12> noctux: You could always mixin a module too.
<noctux> adam12: yeah, I'm currently looking into how DelegateClass/SimpleDelegator respond to kind_of?
wallace_mu has quit []
TCZ has quit [Quit: Diabe? tkwi w szczegó?ach]
helpa has quit [Remote host closed the connection]
helpa has joined #ruby
<noctux> ah, ok, so none of the delegation variants actually hook kind_of? by default...
<noctux> yeah, sure, hooking kind_of is really not that great an idea (because .class will still not match, and its hierarchy is off), but it should work in my context. I'll go with SimpleDelegator+patching kind_of? in that case, I guess
<noctux> adam12: thanks a lot!
<adam12> noctux: Cheers.
<noctux> (Testcode for the delegators by the way: https://paste.xinu.at/g7e5/)
Schmitze` has joined #ruby
Schmitze` has quit [Ping timeout: 260 seconds]
cd has joined #ruby
mistergibson has quit [Quit: Leaving]
ntt has quit [Quit: Leaving]
rippa has joined #ruby
cthulchu_ has joined #ruby
braincrash has quit [Ping timeout: 260 seconds]
dorian has quit [Remote host closed the connection]
charrit69 has quit [Quit: Konversation terminated!]
philCryo has joined #ruby
lucasb has joined #ruby
Schmitze` has joined #ruby
Hanma[m] has joined #ruby
<leftylink> hmm. always thought kind_of was such a weird name, don't you?
<leftylink> I can understand `Circle.new.is_a?(Shape)`. a circle is a shape, sure. but what about `Circle.new.kind_of?(Shape)`... should I think of it as "a circle is kind of like a shape" or something
<leftylink> hmmmmmmmmmmmmmmmmmmmmmmmmmmmm
BrianWGray has joined #ruby
<leftylink> oh no I see
<leftylink> "a circle is a kind of shape"
<leftylink> how have I been using Ruby for years and years and not realised that
<leftylink> my goodness
<leftylink> learn something new every day
impermanence has joined #ruby
brainfunnel has quit [Quit: whoops]
weaksauce has joined #ruby
<apotheon> leftylink: Where are you getting Circle and Shape?
weaksauce has quit [Quit: Textual IRC Client: www.textualapp.com]
<leftylink> from one's imagination
<leftylink> an easily recognisable example where one thing might be a subclass of another
weaksauce has joined #ruby
<apotheon> okay
paydro has quit [Ping timeout: 240 seconds]
BTRE has quit [Remote host closed the connection]
dorian has joined #ruby
Schmitze` has quit [Quit: ERC (IRC client for Emacs 27.1)]
william1_ has quit [Ping timeout: 264 seconds]
howdoi has joined #ruby
BTRE has joined #ruby
htmnc has joined #ruby
lechner has joined #ruby
<htmnc> is this the appropriate channel to ask questions about RSpec? I'm having an issue trying to ``require`` Ruby standard libraries purely when running stuff through RSpec but not when running the file directly or ``load``-ing into pry/irb
<lechner> Hi, Why does this command in irb not produce an array with three bugs, please? "Merge subindices for orig sources with multiple tarball components. (Closes: #970750, #971597, #972567)".scan(/Closes:\s+(?:Bug)?#(?:(\d{4,8})\b)(?:,?\s*(?:Bug)?#(?:(\d{4,8})\b))*/i)
<adam12> htmnc: Do you have a Gemfile in your project?
<lechner> adam12: not sure, its from our gitlab instance https://salsa.debian.org/salsa/salsa-webhook/-/blob/master/helpers/bugs.rb
<lechner> sorry
<htmnc> adam12, yep! do I need to add the library to that gemfile?
<htmnc> lechner, I think he was responding to me, sorry
<lechner> htmnc: i'm sorry. always too eager
william1_ has joined #ruby
TomyWork has quit [Remote host closed the connection]
<htmnc> :) no worries lechner
<adam12> htmnc: What are you requiring that fails?
<adam12> htmnc: and do you have a stack trace?
<adam12> lechner: Great example of why multi-line regexps are so nice. ;)
<htmnc> adam12, require "primes", specifically. I'm not allowed to share the gemfile or anything like that but my code is literally just defining a function prime? within a file and, while I've done it in other ways, just as a matter of exercise I wanted to just return Primes:prime?
<adam12> htmnc: What version of Ruby?
<htmnc> adam12, the error is expected no Exception, got #<NameError: uninitialized constant Prime>
<htmnc> 2.5.1, rspec ver 3.2.0
<htmnc> the code is literally require 'prime' at the top of the file and then def prime?(num)\n return Prime::prime?(num)\nend
<adam12> htmnc: definitely `prime` and not `primes? You've used both interchangably
<htmnc> yeah sorry prime? is the function
<htmnc> it works fine if I run it in irb/pry via load
<adam12> htmnc: But for the require. Are you requiring `prime` or `primes`?
<adam12> htmnc: Can you share the stacktrace for the exception?
<htmnc> require "prime", to be specific
<htmnc> omg
<htmnc> I think it's because the first line of the prime_rspec is require "prime" which loads my prime.rb
<adam12> LOL.
<htmnc> is there a way to specify that I want to require the standard lib ver? omg
<htmnc> or to unclutter the namespace? that's sort of hilarious
<adam12> Your better off not cluttering the namespace.
<htmnc> yeah, I mean, the rspec was given to me
ur5us has joined #ruby
<htmnc> maybe it was specifically to avoid people being clever like this LOL
<adam12> In this case, the $LOAD_PATH has the path for your prime.rb ahead of the stdlib prime.rb.
<htmnc> yep
<adam12> What's in your prime.rb? Maybe you can just rename it to something else
<adam12> Unless you're defining Prime there, which in that case.....
dfucci has quit [Remote host closed the connection]
<htmnc> nah, like, the rspec for the exercise I was given specifically wants us to work with a local lib/prime.rb to define our own prime? function
<htmnc> I'm not defining Prime like the module though anywhere
<htmnc> just a method prime?, also correction method, not function
<adam12> htmnc: Ahh. In that case, lib/your_module/prime.rb, module YourModule; module Prime; def self.prime(n); ::Prime.prime?(n)
<htmnc> oooo cool! thanks
<adam12> Add lib to $LOAD_PATH then `require 'your_module/prime'`. No chance of clobbering.
<htmnc> appreciate it :)
<adam12> htmnc: Cheers.
roshanavand_ has joined #ruby
orbyt_ has joined #ruby
roshanavand has quit [Ping timeout: 256 seconds]
roshanavand_ is now known as roshanavand
<adam12> lechner: Hard to understand with everything all clobbered in one, but I think someone intended for part of the regexp to match repeatedly, and it doesn't. Growing out the regexp fixes it, but without knowing enough of the rest of the possible patterns, it's too hard to say what a fix would be. https://rubular.com/r/ey7kMpL72kxZKH
bocaneri has quit [Remote host closed the connection]
<lechner> adam12: actually, i was able to make it work as intended but i do not understand the function of * in scan, and when nil appears too. is there a doc?
william1_ has quit [Quit: WeeChat 2.8]
william1_ has joined #ruby
<adam12> lechner: Technically match might have been more suitable.
william1_ has quit [Client Quit]
william1_ has joined #ruby
william1_ has quit [Client Quit]
<lechner> does that avoid th need to flatten too?
william1_ has joined #ruby
<adam12> lechner: I'm not sure. I think they used `scan` because it might be multiple lines/repeats of `Closes: #11111`. So maybe `scan` is fine.
<adam12> lechner: nil is likely a bug in the regexp. I would of expected something like /Closes:\s+(regexp_to_match_id)+/, where the match group is repeated and only matches, is never nil. That's kind of there, but part of the match is repeated twice, and there's a bunch of non-capturing groups.
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
Takumo has quit [Quit: WeeChat 2.8]
ur5us has quit [Ping timeout: 264 seconds]
ellcs has joined #ruby
akem_ has joined #ruby
ivz_hh has quit [Remote host closed the connection]
ivz_hh has joined #ruby
summerisle_ is now known as summerisle
summerisle has quit [Quit: In my vision, I was on the veranda of a vast estate, a palazzo of some fantastic proportion.]
summerisle has joined #ruby
SeepingN has quit [Ping timeout: 246 seconds]
reaVer has quit [Ping timeout: 256 seconds]
reaVer has joined #ruby
r29v has joined #ruby
<lechner> adam12: is there an error in this one, as an example? "970750 971597 972567".scan(/(\s*\d+)*/)
<adam12> lechner: "970750 971597 972567".scan(/\d+\b/)
<adam12> &>> "970750 971597 972567".scan(/\d+\b/)
<rubydoc> # => ["970750", "971597", "972567"] (https://carc.in/#/r/9ysz)
stdedos has joined #ruby
<lechner> okay, ikind of figured that out, but is it possible to combine this form of multiple matching with an asterisk, or is match better for that?
<adam12> lechner: match would be better for that. scan repeats the pattern multiple times, collecting the Array (or Array of Arrays if you have a capture group).
<adam12> lechner: It might not work for multiple scenarios of `Closes #100\nCloses#200`. You'd have to check.
<lechner> so scan is like the /m switch in Perl?
<adam12> lechner: I'm not sure, but I'd guess it's the same as Ruby's `/m` switch.
<lechner> now i do a match first and the use scan. it works great except if there is no match. j think i need a conditional
<adam12> lechner: match accepts a block. so match(pattern) do |m|
<adam12> lechner: Is that link correct?
<lechner> sorry
<adam12> lechner: It makes the regexp case-insensitive, so it would match `closes:` or `CloSes:` or whatever.
<lechner> so why |m| instead of /m
<adam12> lechner: Ah. Well in this case, |m| is a block argument, not a regexp modifier like /m or /i.
<adam12> lechner: you could call it anything, like |match| or |mtch| or |foo|. It just makes a closure where MatchData is available in the block only if it matches.
<adam12> (like a conditional but without the `if` part)
<lechner> wait, how do i use this?
<adam12> lechner: What do you have now?
<lechner> .scan(/\(Closes:\s*([^)]*)/).flatten[0].scan(/\d+/)
<lechner> .match(/\(Closes:\s*([^)]*)/)[1].scan(/\d+/)
<lechner> actually
<al2o3-cr> lechner: /(?#)\d{4,8}/ # wouldn't this suffice?
<lechner> js that a capturing group? (?#)
<al2o3-cr> lechner: non-capturing.
<al2o3-cr> lechner: (?:#) would be capturing.
<lechner> isn't (?#) a syntax error
<al2o3-cr> lechner: hang on i got the the wrong, (?:) grouping without capturing
<al2o3-cr> lechner: my ruby-fu is 50/50 atm :p
gix has joined #ruby
<lechner> adam12: do i have to use the biock operator |m| inside a .map, or does it work alone?
jinie has quit [Quit: ZNC 1.8.2 - https://znc.in]
dorian has quit [Remote host closed the connection]
william1_ has quit [Quit: WeeChat 2.8]
johnny56 has quit [Ping timeout: 240 seconds]
SeepingN has joined #ruby
powerhouse has quit [Read error: Connection reset by peer]
<summerisle> boy howdy, am I have some weird issues with sassc and ffi
<summerisle> most likely environmental, but not sure where to look
<summerisle> sassc's native bindings are upsetting ffi and it's raising 'Invalid ABI Specified'
<summerisle> all of this is installed via rubygems, so no custom stuff
powerhouse has joined #ruby
<summerisle> and it works on another workstation, so - very strange
fippy__ has joined #ruby
fippy_ has quit [Remote host closed the connection]
ruurd has quit [Quit: ZZZzzz…]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
crankharder has joined #ruby
johnny56 has joined #ruby
TCZ has joined #ruby
ur5us has joined #ruby
r29v has quit [Ping timeout: 240 seconds]
ruurd has joined #ruby
dionysus69 has joined #ruby
dionysus69 has quit [Read error: Connection reset by peer]
crankharder has quit [Quit: Lost terminal]
dorian has joined #ruby
stdedos has quit [Quit: Connection closed]
chouhoulis has quit [Read error: Connection reset by peer]
chouhoul_ has joined #ruby
ruurd has quit [Read error: Connection reset by peer]
ruurd has joined #ruby
ellcs has quit [Ping timeout: 260 seconds]
jinie has joined #ruby
jinie has quit [Client Quit]
TCZ has quit [Quit: Diabe? tkwi w szczegó?ach]
helpa has quit [Remote host closed the connection]
helpa has joined #ruby
jinie has joined #ruby
TCZ has joined #ruby
akem__ has joined #ruby
SeepingN has quit [Read error: Connection reset by peer]
SeepingN has joined #ruby
akem_ has quit [Ping timeout: 256 seconds]
akem_ has joined #ruby
akem has quit [Ping timeout: 265 seconds]
code_zombie has quit [Quit: Leaving]
mokha has joined #ruby
lucio_ has joined #ruby
lucio_ has quit [Client Quit]
pwnd_sfw0 has joined #ruby
pwnd_sfw has quit [Ping timeout: 272 seconds]
pwnd_sfw0 is now known as pwnd_sfw
ruurd has quit [Quit: ZZZzzz…]
ruurd has joined #ruby
ur5us has quit [Ping timeout: 260 seconds]