havenwood changed the topic of #ruby to: Rules & more: https://ruby-community.com | Ruby 2.6.0, 2.5.3, 2.4.5: 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!
hutch has quit [Ping timeout: 245 seconds]
hutch has joined #ruby
<Rich_Morin_> I had to resort to unpack('C*').select {|b| b < 128 }.pack('C*'), which seems a bit indirect...
sputnik13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
DarthGandalf has joined #ruby
<al2o3-cr> Rich_Morin_: Have you tried using String#scrub ?
uplime has quit [Quit: uplime]
<al2o3-cr> &>> "foo\xffbar\xfebaz\xfd".scrub('')
<rubydoc> # => "foo\xFFbar\xFEbaz\xFD" (https://carc.in/#/r/5z6d)
<al2o3-cr> wtf, that works.
<Rich_Morin_> thanks, that looks promising. More generally, however, I wonder whether/why the regex engine doesn't have a way to deal with non-Unicode strings.
<al2o3-cr> &>> "foo\xffbar\xfebaz\xfd".force_encoding('utf-8').scrub('')
<rubydoc> # => "foobarbaz" (https://carc.in/#/r/5z6f)
also_uplime has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jenrzzz has quit [Ping timeout: 246 seconds]
duderonomy has joined #ruby
<al2o3-cr> &>> "foo\xff".b.gsub /\xff/n, ''
<rubydoc> # => "foo" (https://carc.in/#/r/5z6n)
sanscoeu_ has joined #ruby
also_uplime is now known as uplime
saysjonathan has joined #ruby
<al2o3-cr> encode to binary then use n modifier.
sanscoeur has quit [Ping timeout: 245 seconds]
sanscoeu_ has quit [Ping timeout: 258 seconds]
<al2o3-cr> why they don't mention that in the Regex docs i'm uncertain.
<al2o3-cr> nvm. they do ;)
<Rich_Morin_> Well, I'm glad to know about it. Meanwhile, scrub() seems to do everything I need.
<al2o3-cr> cool ;)
nowhere_man has quit [Ping timeout: 252 seconds]
<al2o3-cr> &>> "".encoding
<rubydoc> # => #<Encoding:US-ASCII> (https://carc.in/#/r/5z6s)
Tempesta has joined #ruby
hutch has quit [Ping timeout: 250 seconds]
venmx has joined #ruby
eddof13 has quit [Quit: eddof13]
jenrzzz has joined #ruby
rkazak has joined #ruby
saysjonathan has quit [Ping timeout: 272 seconds]
r29v has quit [Quit: r29v]
jenrzzz has quit [Ping timeout: 245 seconds]
jenrzzz has joined #ruby
Rich_Morin_ has quit [Quit: Rich_Morin_]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
Swyper has joined #ruby
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
orbyt_ has joined #ruby
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
p1c0 has left #ruby [#ruby]
Rich_Morin_ has quit [Client Quit]
saysjonathan has joined #ruby
rkazak has quit [Quit: Sleep.....ing....]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
nowhere_man has joined #ruby
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
\void has quit [Quit: So long, and thanks for all the fish.]
tdy has joined #ruby
drale2k_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
saysjonathan has quit [Ping timeout: 258 seconds]
Nicmavr has quit [Read error: Connection reset by peer]
Nicmavr has joined #ruby
venmx has quit [Remote host closed the connection]
tdy has quit [Ping timeout: 246 seconds]
drale2k_ has joined #ruby
drale2k_ has quit [Client Quit]
drale2k_ has joined #ruby
saysjonathan has joined #ruby
r29v has joined #ruby
jenrzzz has quit [Ping timeout: 258 seconds]
apparition has joined #ruby
SqREL has joined #ruby
SqREL has quit [Ping timeout: 246 seconds]
SeepingN has quit [Quit: The system is going down for reboot NOW!]
nowhere_man has quit [Remote host closed the connection]
Rich_Morin_ has joined #ruby
evdubs has quit [Remote host closed the connection]
evdubs has joined #ruby
Swyper has quit [Remote host closed the connection]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
hutch has joined #ruby
nowhere_man has joined #ruby
hutch has quit [Ping timeout: 240 seconds]
tdy has joined #ruby
orbyt_ has joined #ruby
SqREL has joined #ruby
SqREL has quit [Ping timeout: 268 seconds]
hutch has joined #ruby
Rich_Morin_ has quit [Quit: Rich_Morin_]
drale2k_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
saysjonathan has quit [Ping timeout: 258 seconds]
saysjonathan has joined #ruby
saysjonathan has quit [Ping timeout: 250 seconds]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
r29v has quit [Quit: r29v]
tfitts has joined #ruby
wmoxam has joined #ruby
Azure has quit [Ping timeout: 246 seconds]
hutch has quit [Ping timeout: 250 seconds]
hutch has joined #ruby
\void has joined #ruby
Xiti has quit [Ping timeout: 250 seconds]
kent\n has quit [Ping timeout: 250 seconds]
kent\n has joined #ruby
hutch has quit [Ping timeout: 250 seconds]
Xiti has joined #ruby
orbyt_ has joined #ruby
saysjonathan has joined #ruby
Azure has joined #ruby
tdy has quit [Ping timeout: 268 seconds]
braincrash has quit [Quit: bye bye]
braincrash has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
hutch has joined #ruby
stryek has quit [Quit: Connection closed for inactivity]
orbyt_ has joined #ruby
saysjonathan has quit [Ping timeout: 246 seconds]
tdy has joined #ruby
hutch has quit [Ping timeout: 268 seconds]
hutch has joined #ruby
tdy has quit [Read error: error:1408F119:SSL routines:ssl3_get_record:decryption failed or bad record mac]
tdy has joined #ruby
Puffball has joined #ruby
Rich_Morin_ has joined #ruby
saysjonathan has joined #ruby
ziyadb has joined #ruby
tdy has quit [Ping timeout: 258 seconds]
_whitelogger has joined #ruby
rkazak has joined #ruby
mikecmpbll has quit [Quit: inabit. zz.]
vonfry has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
donofrio has quit [Remote host closed the connection]
tdy has joined #ruby
rkazak has quit [Ping timeout: 268 seconds]
vonfry has quit [Quit: WeeChat 2.3]
davidw has quit [Ping timeout: 245 seconds]
saysjonathan has quit [Ping timeout: 245 seconds]
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tdy has quit [Ping timeout: 250 seconds]
envex has joined #ruby
Rich_Morin__ has joined #ruby
Rich_Morin_ has quit [Ping timeout: 272 seconds]
AJA4350 has quit [Ping timeout: 258 seconds]
comet23 has quit [Quit: Connection closed for inactivity]
saysjonathan has joined #ruby
AJA4350 has joined #ruby
duderonomy has joined #ruby
hutch has quit [Ping timeout: 244 seconds]
saysjonathan has quit [Ping timeout: 272 seconds]
hutch has joined #ruby
dellavg_ has joined #ruby
tfitts has quit [Quit: Connection closed for inactivity]
apparition has quit [Quit: Bye]
hutch has quit [Ping timeout: 245 seconds]
fcambus has left #ruby [#ruby]
saysjonathan has joined #ruby
jinie_ has joined #ruby
dinfuehr_ has quit [Ping timeout: 245 seconds]
dinfuehr has joined #ruby
SqREL has joined #ruby
AJA4350 has quit [Quit: AJA4350]
rippa has joined #ruby
dinfuehr has quit [Ping timeout: 240 seconds]
SqREL has quit [Ping timeout: 240 seconds]
dinfuehr has joined #ruby
dinfuehr has quit [Ping timeout: 250 seconds]
dinfuehr has joined #ruby
SqREL has joined #ruby
irdr has quit [Remote host closed the connection]
saysjonathan has quit [Ping timeout: 258 seconds]
sauvin has joined #ruby
Rich_Morin__ has quit [Quit: Rich_Morin__]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
saysjonathan has joined #ruby
maryo has joined #ruby
\void has quit [Quit: So long, and thanks for all the fish.]
saysjonathan has quit [Ping timeout: 268 seconds]
SqREL has quit [Remote host closed the connection]
Emmanuel_Chanel has quit [Ping timeout: 250 seconds]
Puffball has quit [Remote host closed the connection]
irdr has joined #ruby
conta has joined #ruby
Emmanuel_Chanel has joined #ruby
za1b1tsu has joined #ruby
saysjonathan has joined #ruby
reber has joined #ruby
<tbuehlmann> take my like
<baweaver> Could I make it more efficient with tokenization? Probably. Do I care? Not really at the moment.
<baweaver> Am I outing myself as an ex sys-admin yet? :P
ur5us has joined #ruby
saysjonathan has quit [Ping timeout: 246 seconds]
maryo has quit [Ping timeout: 250 seconds]
Dbugger has joined #ruby
saysjonathan has joined #ruby
gix has joined #ruby
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
duderonomy has joined #ruby
duderonomy has quit [Client Quit]
maryo has joined #ruby
TheBloke has quit [Quit: Textual IRC Client: www.textualapp.com]
paraxial has joined #ruby
paraxial has quit [Quit: The Lounge - https://thelounge.github.io]
saysjonathan has quit [Ping timeout: 245 seconds]
paraxial has joined #ruby
catbusters has joined #ruby
ua__ has joined #ruby
adzad_dadad4_ has joined #ruby
adzad_dadad4_ has quit [Quit: Leaving]
ua_ has quit [Ping timeout: 240 seconds]
Dbugger has quit [Ping timeout: 264 seconds]
gmcabrita has joined #ruby
drale2k_ has joined #ruby
sputnik13 has joined #ruby
mikecmpbll has joined #ruby
sputnik13 has quit [Client Quit]
dinfuehr has quit [Ping timeout: 258 seconds]
dinfuehr has joined #ruby
gmcabrita has quit []
gmcabrita has joined #ruby
Some-body_ has joined #ruby
za1b1tsu has quit [Ping timeout: 244 seconds]
DarthGandalf has quit [Ping timeout: 264 seconds]
Some-body_ is now known as DarthGandalf
saysjonathan has joined #ruby
Hess has joined #ruby
maryo has quit [Ping timeout: 258 seconds]
gmcabrita has quit [Remote host closed the connection]
ellcs has joined #ruby
za1b1tsu has joined #ruby
ellcs has quit [Ping timeout: 268 seconds]
drale2k_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Nicmavr has quit [Read error: Connection reset by peer]
Nicmavr has joined #ruby
Hess has quit [Ping timeout: 256 seconds]
saysjonathan has quit [Ping timeout: 250 seconds]
ur5us has quit [Remote host closed the connection]
lxsameer has joined #ruby
lucasb has joined #ruby
maryo has joined #ruby
saysjonathan has joined #ruby
olspookishmagus has joined #ruby
maryo has quit [Ping timeout: 250 seconds]
Swyper has joined #ruby
Swyper has quit [Ping timeout: 244 seconds]
memofun has joined #ruby
drale2k_ has joined #ruby
drale2k_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Swyper has joined #ruby
Swyper has quit [Remote host closed the connection]
drale2k_ has joined #ruby
saysjonathan has quit [Ping timeout: 250 seconds]
houhoulis has joined #ruby
memofun has quit [Ping timeout: 250 seconds]
saysjonathan has joined #ruby
reber has quit [Remote host closed the connection]
saysjonathan has quit [Ping timeout: 268 seconds]
saysjonathan has joined #ruby
saysjonathan has quit [Client Quit]
Swyper has joined #ruby
za1b1tsu has quit [Remote host closed the connection]
AJA4350 has joined #ruby
catbusters has quit [Quit: Connection closed for inactivity]
conta1 has joined #ruby
<yebyen> thanks phaul for that explanation, I just re-read it all and that really demystified it for me
RougeR has joined #ruby
<yebyen> any_instance_of(Object) really is way more nebulous than it needed to be
conta1 has quit [Ping timeout: 245 seconds]
<yebyen> expect(subject).to receive would work just as well
<yebyen> i'm just not accustomed to method names starting with capital letters
<yebyen> that's a go convention i could've recognized though, i'm pretty sure... i don't use go much, but every function exposed by a module has to be capitalized afaik
<yebyen> that's probably accidental
<yebyen> but I get it now, it's not ClassName()
<phaul> yebyen: np. I was thinking about this too, it was an interesting problem to crack
<yebyen> it's (implied self) .Method()
<phaul> also RSpec is really to blame for not handling the error correctly.
<yebyen> there is probably a bug in there resulting in that stack too deep infinite recursion
<yebyen> but could also be, if i went down the rabbit hole i'd find an implementation detail of rspec that explains why it has to be like this
<yebyen> i bet i find an issue if i search for it that says "don't intercept methods on instance of Kernel, ya big dummy"
<yebyen> or maybe i'm the first person to think of doing that... yeah no
ianfleeton has joined #ruby
houhoulis has quit [Remote host closed the connection]
arup_r has joined #ruby
dinfuehr has quit [Ping timeout: 250 seconds]
arup_r has quit [Client Quit]
dinfuehr has joined #ruby
ellcs has joined #ruby
dinfuehr has quit [Ping timeout: 258 seconds]
dinfuehr has joined #ruby
hiroaki has joined #ruby
dinfuehr has quit [Ping timeout: 250 seconds]
dinfuehr has joined #ruby
Swyper has quit [Remote host closed the connection]
KeyJoo has joined #ruby
conta has quit [Quit: conta]
ellcs has quit [Ping timeout: 260 seconds]
hiroaki has quit [Ping timeout: 244 seconds]
segy has quit [Quit: ZNC - http://znc.in]
segy has joined #ruby
RougeR has quit [Read error: Connection reset by peer]
alexterziev has quit [Ping timeout: 256 seconds]
drale2k_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
hiroaki has joined #ruby
drale2k_ has joined #ruby
conta has joined #ruby
conta has quit [Ping timeout: 246 seconds]
drale2k_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
hiroaki has quit [Ping timeout: 250 seconds]
Dbugger has joined #ruby
SuperLag has quit [Quit: reboot]
SuperLag has joined #ruby
SuperLag has quit [Remote host closed the connection]
SuperLag has joined #ruby
FrostCandy has joined #ruby
<FrostCandy> im using a gem called like this gem::method.where(state: 'ny') and if I type it like that it works, but I have a hash called parameters and add state like this parameters[:state] = 'ga' then I pass the hash but it doesnt work. How can I pass a hash properly to the gem method?
<FrostCandy> I tried turning the hash into a string, so the variable holds a string like state: 'ny', but that doesnt work because I assume state: isn't sent as a symbol?
<FrostCandy> I guess what I need to do is turn my has into a set of symbols and strings
Aqo has joined #ruby
Aqo has quit [Client Quit]
<ianfleeton> FrostCandy, does parameters = {}; parameters[:state] = 'ga'; gem::method.where(parameters); work?
Aqo has joined #ruby
dviola has joined #ruby
<FrostCandy> ianfleeton: nope, thta's essentiall what I was doing. so far i tied sending parameters, pareameters.to_json, parmeters.to_s and even running it through a loop to create state: 'ga'
<FrostCandy> only thing that works is by manually typeing the symbol and value so far :(
FastJack has quit [Remote host closed the connection]
<FrostCandy> maybe pareameters is a reserved variable heh i'll try to change that variable name.
<Iambchop> FrostCandy: "it doesnt work" means what? it would be helpful if you could provide the code, expected output, actual output, and any error messages: https://dpaste.de
<FrostCandy> Iambchop: omg it was the word parameters lol, i changed it to pvar = {} and so on, works fine
<FrostCandy> maybe it's a ruby on rails issue not ruby
<phaul> where is gem::method coming from? who defined it? don't override :method
<phaul> &ri method
<phaul> and don't use :: for sending messages
<FrostCandy> phaul dont use double colons here? or you mean for calling the gem and method?
<phaul> I am confused by your code tbh. What is gem, what is its class, is method a method of gem? Is it redefinition of Object#method ?
<Iambchop> FrostCandy: https://github.com/rubocop-hq/ruby-style-guide/blob/master/README.md#syntax " Use :: only to reference constants...Do not use :: for regular method invocation"
lucasb has quit [Quit: Connection closed for inactivity]
dviola has quit [Quit: WeeChat 2.3]
dviola has joined #ruby
FastJack has joined #ruby
<FrostCandy> Iambchop: ok thanks, we're using an old version of ruby so I don't know if things were diff back when they designed it, but good to know.
ianfleeton has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Iambchop> What gem and what version of ruby/rails?
Rich_Morin_ has joined #ruby
<FrostCandy> OpenStates is the gem and ruby 2.1
maryo has joined #ruby
conta has joined #ruby
cd has joined #ruby
hiroaki has joined #ruby
<Iambchop> Okay, some confusion on terminology: "OpenStates::Bill.where(state: 'tx', q: 'taxi')" OpenStates is a module, OpenStates::Bill is a class
conta has quit [Ping timeout: 244 seconds]
<Iambchop> depending where in the rails stack you are calling this from "parameters" is a defined method, that could be where you got tripped up there
fuzzface has joined #ruby
fuzzface has quit [Client Quit]
<phaul> that explains what happens with the parameters name, but does not explain what the heck gem::method is
<phaul> which is why I asked what gem was, how it was defined... ^^
<phaul> one way i can imagine it being defined is module X; def self.method; OpenStates::Bill.new; end; end; gem = X; X::method.where ...
Rich_Morin_ has quit [Quit: Rich_Morin_]
<phaul> or gem::method.where as gem is X
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
Rich_Morin_ has joined #ruby
Rich_Morin_ has quit [Client Quit]
hiroaki has quit [Ping timeout: 250 seconds]
tdy has joined #ruby
<phaul> we will never know..
hiroaki has joined #ruby
hutch has joined #ruby
tiff has joined #ruby
maryo has quit [Ping timeout: 250 seconds]
Swyper has joined #ruby
<FrostCandy> phaul: it was response = OpenStates::Legislator.where(state: 'ga') So I guess that is the Openstates Modual, the Legilator class and the where method? Yup terminology problem on my end.
orbyt_ has joined #ruby
duderonomy has joined #ruby
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 250 seconds]
AJA4351 is now known as AJA4350
<phaul> ah, makes sense. so the code we saw wasn't the actual code. ok nm
<FrostCandy> phaul: ya, my bad
TheBloke has joined #ruby
profetes_ has joined #ruby
rindolf has joined #ruby
<rindolf> hi all
profetes has quit [Ping timeout: 252 seconds]
hutch has quit [Ping timeout: 240 seconds]
<al2o3-cr> hi rindolf
<rindolf> al2o3-cr: hi, sup?
<al2o3-cr> not a lot
hutch has joined #ruby
<rindolf> al2o3-cr: ah
<rindolf> al2o3-cr: where are you from?
<al2o3-cr> the moon
hutch has quit [Ping timeout: 240 seconds]
cow[moo] has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
planigan has quit [Ping timeout: 246 seconds]
AJA4351 has joined #ruby
<rindolf> al2o3-cr: heh
planigan has joined #ruby
AJA4350 has quit [Ping timeout: 244 seconds]
AJA4351 is now known as AJA4350
dviola has quit [Ping timeout: 258 seconds]
hutch has joined #ruby
dviola has joined #ruby
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
Swyper has quit [Remote host closed the connection]
Azure has quit [Ping timeout: 250 seconds]
Rich_Morin_ has joined #ruby
KeyJoo has quit [Quit: KeyJoo]
FrostCandy has quit []
_whitelogger has joined #ruby
hutch has quit [Ping timeout: 272 seconds]
Azure has joined #ruby
dviola has quit [Ping timeout: 240 seconds]
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 245 seconds]
AJA4351 is now known as AJA4350
Rich_Morin_ has quit [Quit: Rich_Morin_]
dviola has joined #ruby
dellavg_ has quit [Ping timeout: 258 seconds]
cow[moo] has joined #ruby
Aqo has quit [Ping timeout: 250 seconds]
catbusters has joined #ruby
drale2k_ has joined #ruby
JasonO has quit [Excess Flood]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
JasonO has joined #ruby
orbyt_ has joined #ruby
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 250 seconds]
AJA4351 is now known as AJA4350
RiPuk has joined #ruby
hutch has joined #ruby
<baweaver> I made a new thing: https://github.com/baweaver/globs
<baweaver> It does this: Globs.expand("test.{a, b}.{1, 2}.com") # => ["test.a.1.com", "test.a.2.com", "test.b.1.com", "test.b.2.com"]
VladGh has joined #ruby
<canton7> baweaver, looking at the code (haven't tried to run it), looks like it will give the wrong answers if you have ',' or '..' outside of the { }? Also no support for having a literal { or }?
<baweaver> Nope. It's for a very simple usecase so I haven't bothered with that.
<baweaver> Mostly domain name expansions
hutch has quit [Ping timeout: 250 seconds]
<canton7> might want to put some limitations in the readme then? (the string being expanded can't contain the sequences '{', '}', ',', '..'
<canton7> (also we seem to be going the way of node.js, with 5-line methods being turned into their own packages, complete with code of conduct)
<baweaver> Playing with StringScanner at the moment so it'll likely be irrelevant
<baweaver> I don't see anything particularly wrong with having a well defined usecase being bundled into a library.
<baweaver> Nor do I see issues with codes of conduct.
<canton7> well, except that you end up here: https://www.theregister.co.uk/2018/11/26/npm_repo_bitcoin_stealer/
tdy has quit [Ping timeout: 250 seconds]
conta has joined #ruby
<baweaver> That's already an inherit risk with any package distribution system, whether or not there are hundreds of short libraries.
<baweaver> As to how to fix that, that's quite a hard problem.
<canton7> yes, but the probability increases with the number of packages in your dependency tree
<canton7> the solution is "don't use a package to provide something you could implement by adding a file or two to your project"
<baweaver> It's "a" solution, but taken to what rigor?
<baweaver> Should you reimplement everything and burn through a ton of engineer time?
<baweaver> or only packages deemed to be too small to care?
<canton7> of course there's a tradeoff
<canton7> but writing 5 lines of code yourself isn't "burning through a ton of engineer time"
tdy has joined #ruby
<baweaver> You make a lot of assumptions with that statement
<canton7> and really you need to be checking your dependencies, which burns its own engineer time
hutch has joined #ruby
conta has quit [Ping timeout: 272 seconds]
<baweaver> Primarily that lines of code is a metric directly correlated to time it would have taken to write.
<canton7> (license, known issues, whether it's maintained, etc)
<baweaver> Not necessarily. Some incredibly succinct code takes substantially longer to write.
<canton7> of course, I was taking an extreme example
<baweaver> Most everything in engineering is a case of nuance
<al2o3-cr> bash: printf "%0s\n" "test."{a..f}.{1..6}".com"
<baweaver> which is, admittedly, a headache all its own.
johnny56_ has quit [Quit: johnny56_]
<al2o3-cr> yeah, `printf "%s\n" test.{a..f}.{1..6}.com`
<al2o3-cr> now, how to implement brace expansion.
<baweaver> Ruby has built in printf support doesn't it?
orbyt_ has quit [Ping timeout: 258 seconds]
<al2o3-cr> baweaver: sure.
Nicmavr has quit [Read error: Connection reset by peer]
<baweaver> May be able to leverage that I'd think
<baweaver> Though I may be having a good deal of fun with StringScanner at the moment.
Nicmavr has joined #ruby
SCHAPiE has quit [Ping timeout: 246 seconds]
kenichi has quit [Quit: ZNC - http://znc.in]
kenichi has joined #ruby
tiff has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
AJA4351 has joined #ruby
SCHAPiE has joined #ruby
AJA4350 has quit [Ping timeout: 268 seconds]
AJA4351 is now known as AJA4350
<baweaver> hrm, not getting Ruby's printf to do it, probably because the shell expanded the globs
<al2o3-cr> baweaver: you won't, ruby doesn't have brace expansion :P
<baweaver> It does now :D
<baweaver> Cleaning it up with StringScanner
<al2o3-cr> baweaver: cool, i'd like to see this ;)
rindolf has quit [Ping timeout: 258 seconds]
hutch has quit [Ping timeout: 268 seconds]
<al2o3-cr> &>> (?a..?f).zip(1..6).map { |x| "test.#{x.join('.')}.com" }
<rubydoc> # => ["test.a.1.com", "test.b.2.com", "test.c.3.com", "test.d.4.com", "test.e.5.com", "test.f.6.com"] (https://carc.in/#/r/5zj7)
<al2o3-cr> no.
<phaul> how about enumerable / enumerator #* for cartesian product?
<al2o3-cr> &>> [*?a..?f].product([*1..6]).map { |x| "test.#{x.join('.')}.com" }
<rubydoc> # => ["test.a.1.com", "test.a.2.com", "test.a.3.com", "test.a.4.com", "test.a.5.com", "test.a.6.com", "te ...check link for more (https://carc.in/#/r/5zj8)
<phaul> ah cool :) it exists
<phaul> &list product
<rubydoc> Array#product
<phaul> do you think it would be a good companion to the new Enumerator#+ Enumerable#chain?
p1c0 has joined #ruby
<al2o3-cr> it could work i suppose. could cause confusion.
clemens3 has joined #ruby
Rich_Morin_ has joined #ruby
<al2o3-cr> &>> (?a..?f).flat_map { |x| (1..6).map { |y| "test.#{x}.#{y}.com" } }
<rubydoc> # => ["test.a.1.com", "test.a.2.com", "test.a.3.com", "test.a.4.com", "test.a.5.com", "test.a.6.com", "te ...check link for more (https://carc.in/#/r/5zjd)
<baweaver> Most of the issue is entirely in doing n-level globs
<baweaver> could be one, two, five, ten
<baweaver> who knows
<al2o3-cr> then n level loops haha :)
<al2o3-cr> jk :P
<al2o3-cr> baweaver: i see what your trying to implement :)
<baweaver> reduce is real danged useful for that type of thing
<canton7> baweaver, Array#product
<al2o3-cr> of course. (but inject) hehe
<al2o3-cr> but yeay what canton7 said.
johnny56 has joined #ruby
<baweaver> It can take n-products, sure. The fun part then is extracting the glob areas.
<canton7> you can regex that! /((?:|[^\\])(?:\\\\)*){(.+[^\\](?:\\\\)*)}/
<lupine> *sob*
<lupine> just because you can, doesn't mean you should
<canton7> but, I tend to just go back to a token-based parser with a bit of state to say "in escape" at that point...
<baweaver> StringScanner looks to get close to that
chouhoulis has joined #ruby
<baweaver> still figuring out how to make that work, but about got it
<canton7> yeah, you could quite happily use StringScanner for that
<baweaver> Need to go back to writing though
<canton7> though I tend to just loop through character by character
<baweaver> Could. StringScanner just makes it a bit nicer with scan_until and friends
<canton7> oops, /((?:^|]^\\].....
<canton7> but, you'll want to be processing your input to remove escapes, which means you want to be copying non-escaped input chars to your output anyway
<canton7> but yeah, not too much difference
<baweaver> Notedly I'm not really experienced in token parsing
<baweaver> Haven't really tried it before, so a bit of fun
<baweaver> Though I'll probably not go too far down this rabbit hole, more interested in making a nicer API around TracePoint
<al2o3-cr> TracePoints API is pretty sound tbh.
AJA4351 has joined #ruby
<baweaver> It's super powerful, but there's a lot to it.
<baweaver> So the idea there was a pared down API to it for more beginners
AJA4350 has quit [Ping timeout: 246 seconds]
AJA4351 is now known as AJA4350
<al2o3-cr> it pretty simple enough compared to set_trace
chouhoulis has quit [Remote host closed the connection]
<baweaver> TracePoint.watch_method(:name) for instance
<baweaver> things like that to not require a lot of conditional branches when creating one
sagax has joined #ruby
<al2o3-cr> baweaver: C method Ruby method how to differenciate?
<baweaver> very carefully
<baweaver> but yeah, that was one of the concerns
orbyt_ has joined #ruby
<baweaver> Most of it requires me to spend a lot of time thinking about it and writing down ideas
<al2o3-cr> A lot of consideration as been put into TracePoint.
<baweaver> currently still in the thinking stage, so most ideas aren't well formed quite yet.
<baweaver> It's insanely powerful, no doubt
<baweaver> but too much power can lead to indecision or difficulty in learning or use
<al2o3-cr> baweaver: i see your intention though.
<baweaver> but yeah, still definitely in the "I wonder if..." stage
<baweaver> Not everything I dream up is necessarily a good idea :P
<baweaver> hence mentioning it on occasion to see _how bad_ it might be
<al2o3-cr> haha, most of your stuff is good though!
<baweaver> Gotta balance the scales :D
<al2o3-cr> bacon butty or an orange, i'd take the bacon butty :P
<baweaver> But yeah, like with product and everything else there's a non-trivial chance there's a better way to do something I hadn't considered yet
<baweaver> I just have fun playing with it in the mean time
<baweaver> gotta pre-warm that cache
<al2o3-cr> hehe :)
<al2o3-cr> &18>> "foo"
<rubydoc> I'm terribly sorry, I could not evaluate your code because of an error: StandardError:Couldn't match lang/mode
<al2o3-cr> &1.8>> "foo"
<baweaver> phaul
<phaul> 2.0 is the first one it understands
<al2o3-cr> phaul: ah.
<phaul> carc.in is the limiting factor
<al2o3-cr> hint hint to jhass to upgrade to 2.6 ;)
<al2o3-cr> 18>> "foo"
<ruby[bot]> al2o3-cr: # => "foo" (https://eval.in/1077092)