<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.
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]
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
<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>
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…]
<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.
<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.
<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 ;)