xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
alfiemax has quit [Remote host closed the connection]
Mia has joined #ruby
Mia has joined #ruby
Mia has quit [Changing host]
yokel has joined #ruby
TCZ has joined #ruby
Cork has joined #ruby
yokel has quit [Ping timeout: 240 seconds]
TCZ has quit [Client Quit]
TCZ has joined #ruby
no_gravity has joined #ruby
<no_gravity>
In Ruby, you do not need to add () to call a function?
<jhass>
right, in most context's you don't
<no_gravity>
So instead of sayHello() you can just write sayHello?
<jhass>
yes
<no_gravity>
jhass: In which context do you need to?
<jhass>
if it becomes amiguous, for example while passing the result of a method call to another it can become necessary
<jhass>
also note that ruby style convention for method names is underscore_case, so say_hello
<no_gravity>
So this will not ork? sayHello getName
<jhass>
it will
<no_gravity>
When will it not work?
<jhass>
it will, but consider puts name_of person, child, is that puts(name_of(person), child) or puts(name_of(person, child))
<jhass>
(ruby convention is also to leave of get_ prefixes, use foo= instead of set_foo and foo? instead of is_foo)
<no_gravity>
I would expect it to be puts(name_of(person(child)))
<jhass>
that'd be for puts name_of person child
<jhass>
note the comman I put in
<jhass>
in my original example
<no_gravity>
Oh
yokel has joined #ruby
<no_gravity>
That I would expect to be puts(name_of(person,child))
<jhass>
and it would be, but if you need the other way around you put parens. and I would argue to put them in either case to make it easier to read :)
<no_gravity>
I see
xco has joined #ruby
<jhass>
so puts name_of(person, child) or puts name_of(person), child
<no_gravity>
Yup
chalkmonster has joined #ruby
<no_gravity>
Im not sure what to think about it.
<no_gravity>
It makes it impossible to say if "puts name" outputs the value of a variable called name or the ouput of a function called name.
<no_gravity>
And seems to lead to wrong error messages.
<no_gravity>
name: undefined method `name' for main
<jhass>
if your method is so big, you cannot keep in mind the local variables, it's too big :)
<jhass>
&>> name
<jhass>
>> name
<ruby[bot]>
jhass: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
<no_gravity>
The error is not that there is no method called name. But that there is neither a method nor a variable called name.
<jhass>
meh okay, both bots broken
mikecmpbll has quit [Ping timeout: 246 seconds]
<jhass>
the message is "undefined local variable or method `name'"
<gthank>
I got a bunch of stackoverflow answers when I googled, but none explained what it actually was
<nakilon>
this is how you convert this oct to hex: "\342\200\250".bytes.pack "C*" => "\xE2\x80\xA8"
whathappens has quit [Remote host closed the connection]
whathappens has joined #ruby
mikecmpbll has quit [Quit: inabit. zz.]
yokel has joined #ruby
BSaboia has joined #ruby
BSaboia has quit [Read error: Connection reset by peer]
BSaboia has joined #ruby
weaksauce has joined #ruby
ellcs has joined #ruby
ramfjord has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
yokel has quit [Ping timeout: 256 seconds]
yokel has joined #ruby
sh7d has quit [Ping timeout: 258 seconds]
sh7d has joined #ruby
yokel has quit [Ping timeout: 240 seconds]
yokel has joined #ruby
dfucci has quit [Ping timeout: 246 seconds]
braincrash has quit [Ping timeout: 246 seconds]
yokel has quit [Ping timeout: 246 seconds]
TomyWork has quit [Quit: Leaving]
schne1der has quit [Ping timeout: 258 seconds]
sgen has joined #ruby
yokel has joined #ruby
vondruch has quit [Ping timeout: 258 seconds]
yokel has quit [Ping timeout: 240 seconds]
yokel has joined #ruby
rapha has left #ruby ["WeeChat 2.3"]
<nakilon>
btw ,our local Papa Johns emailed pizza promocode with some binary nonsense, claiming it's ASCII but it's clearly 3-byte encoded and at first I thought they someone messed the Endian, but the 2nd byte is rotated by 2, not 4, and the third byte is weird anyway
yokel has quit [Ping timeout: 264 seconds]
<gthank>
What sort of baroque tooling are they using where you get weirdo encoding errors like that?
BSaboia has quit [Quit: This computer has gone to sleep]
yokel has quit [Ping timeout: 240 seconds]
dfucci has quit [Ping timeout: 256 seconds]
yokel has joined #ruby
topazPants has joined #ruby
<pgib>
I'm not sure if RSpec questions are in scope, but #rspec has been nonresponsive for over a day. I'm trying to programmatically omit specific examples from a shared examples. I have a way to stub them out, but they still show as passing in the results. I also don't want them to show as skipped or pending. I simply want to be able to completely disable "it" blocks based on a variable. Some of what I've tried so far: https://dpaste.org/1qd1
skape has quit [Quit: Connection closed for inactivity]
kristian_on_linu has joined #ruby
topazPants has left #ruby [#ruby]
<nakilon>
gthank weird thing is that no matter how you encode the codetable shifting, Russian letters are all placed similarly both in UTF and CP1251 (32 chars upper case, 32 lower case) but their promocode is changing in 6 bits plus 1 bit for upper case (only in set in the very first char -- the beginning of the sentense I assume); i.e. they use 6 bits to
<nakilon>
encode 32 chars, wtf
<gthank>
pgib Would it be acceptable to just tag them and run the specs that don't match, or similar? I haven't messed with spec in a year or two, but I'm almost positive it had some functionality like that
<nakilon>
either I'm crazy or it's not baroque tooling but a real puzzle that costs far more than their 20% pizza discount
<pgib>
There is tagging, but I don't know if you can enable/disable tags programmatically
<pgib>
this is a shared example. So there may be a Controller that supports :update, and :create. But maybe another that supports only :create, and I'd like to disable the update checks in that case
<gthank>
nakilon Secretly recruiting security team or some such
<gthank>
pgib Sorry, I think you're already out of my depth.
Eiam has joined #ruby
dfucci has joined #ruby
schne1der has joined #ruby
dfucci has quit [Ping timeout: 240 seconds]
justache has quit [Remote host closed the connection]
yokel has quit [Ping timeout: 240 seconds]
justache has joined #ruby
neshpion has joined #ruby
whathappens has quit []
wimpog has joined #ruby
alestane has joined #ruby
<alestane>
Hi! I'm trying to build an arbitrary series of callbacks, which I'm currently imagining as an array of Proc values. However, Im trying to bind different inputs into them, and it seems like they're getting a shared variable and all seeing the same values. How can I capture the current value of an expression in a new Proc, or is there a better way to do this?
<wimpog>
New to Ruby/Rails here. For catching ActiveRecord create errors, can I use begin/rescue and print e.message, e.backtrace.inspect?
skape has joined #ruby
jenrzzz has joined #ruby
gix has joined #ruby
pgib has quit [Quit: 00 PC LOAD LETTER]
pgib has joined #ruby
<pgib>
wimpog There is also a fairly active #rails
<wimpog>
pgib: but I like it here. Would you help me?
<pgib>
I don't know the answer to your question
<wimpog>
Thank you, @pgib. I'll go to #rails
Rudd0 has quit [Ping timeout: 260 seconds]
jenrzzz has quit [Ping timeout: 256 seconds]
<wimpog>
@pgib they're not letting me into #rails. So staying here....
<wimpog>
New to Ruby/Rails here. For catching ActiveRecord create errors, can I use begin/rescue and print e.message, e.backtrace.inspect?
bmurt has joined #ruby
<pgib>
sry, #RubyOnRails
yokel has joined #ruby
ellcs has quit [Ping timeout: 260 seconds]
davispuh has joined #ruby
yokel has quit [Ping timeout: 256 seconds]
<wimpog>
Thanks, @pgib
ellcs has joined #ruby
yokel has joined #ruby
<adam12>
wimpog: Those are exceptions; you can rescue them without issue. The begin/end parts of `rescue` are optional in _some_ cases, depending on your Ruby version. Just FYI.
<phaul>
&>> :does_this_work?
<phaul>
hm
<adam12>
alestane: If you have an example it might help, but in essence you just described the Rack interface (which passes around `env` which is a Hash).
howdoi has joined #ruby
yokel has quit [Ping timeout: 240 seconds]
ellcs has quit [Ping timeout: 260 seconds]
<adam12>
pgib: Starting at the simplest method, can you just wrap the `it` blocks in a giant if statement?
<wimpog>
@adam12 how do I do it then?
yokel has joined #ruby
<adam12>
wimpog: What do you mean? Show me an example and I'll riff off that.
<wimpog>
begin record.create... rescue => e log exception with e.message end
<ruby[bot]>
wimpog: we in #ruby do not like pastebin.com, it loads slowly for most, has ads which are distracting and has terrible formatting. Please use https://gist.github.com
ellcs has joined #ruby
<wimpog>
@adam12 I want to catch errors/exceptions that happen during create in record_transaction()
<adam12>
wimpog: It looks fine. You might want to narrow the exceptions you rescue since right now you're capturing a fair amount, but I'm sure it looks fine.
<Scriptonaut>
hey all, lately I've been having issues with git conflicts happening with the rails encrypted credentials file. This is almost impossible to deal with. Let's say I want to rebase my branch on master. I skip the credentials file, rm it, replace it with the one on master, then open up the old one on my branch before the rebase, and manually look over it to see what's different, then commit that.
<adam12>
wimpog: Also presumably, you're not accepting card numbers or CVC codes directly, which would be logged in that params call.
<Scriptonaut>
how do you deal with merge conflicts happening in your rails credentials files? Is there a way to handle this that most people do?
<wimpog>
@adam12: thank you! Yeah at the moment I'm not sure which specific exception to look for. Once I see what is being logged, I might be able to narrow it down. No, I'm not logging cc numbers or cvc codes. That code snippet accepts params from the payment gateway callback. Thank you for your help!
<pgib>
adam12 - I had tried that.
<pgib>
I forget the exact error, but I cannot reference the any variables or methods outside of the body of it, let, etc.. blocks. (no describe, context, etc)
<phaul>
for completeness of info this is in the logs : Sep 11 21:21:57 son-1 bash[71068]: [2020/09/11 21:21:57.742] !! (eval):5:in `block in __dry_initializer_initialize__': Yarr::Evaluator::Mode: option 'filter' is required (KeyError)
yokel has joined #ruby
davispuh has joined #ruby
<adam12>
pgib: Does `before` accept a block argument? I think it does. Maybe try: before(:all) { |example| example.metadata[:skip] = true }
<adam12>
s/accept/pass
<pgib>
it does. Good idea. It's kludgy, but if it works...
yokel has quit [Ping timeout: 260 seconds]
dfucci has joined #ruby
akemhp has quit [Remote host closed the connection]
dfucci has quit [Ping timeout: 240 seconds]
<pgib>
adam12. Hmph.. Well, I do get each example in the before block prior to the example running. However, it doesn't seem skippable at that point
wimpog has quit [Quit: wimpog]
jenrzzz has joined #ruby
<adam12>
pgib: :\ Hmm.
TCZ has joined #ruby
<pgib>
yeah. Looks good on paper
<pgib>
Perhaps I could tag the examples. I need a way to include/exclude tags programmatically then
jenrzzz has quit [Ping timeout: 256 seconds]
<pgib>
Hmm. seems doable. Hold on
ellcs has quit [Ping timeout: 260 seconds]
lunarkitty7 has joined #ruby
yokel has joined #ruby
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tsrt^ has quit [Read error: Connection reset by peer]
yokel has quit [Ping timeout: 246 seconds]
cthu| has quit [Ping timeout: 264 seconds]
cthulchu has joined #ruby
<pgib>
adam12. Dang... hardcoding a value to eliminate error, even this still runs the 'create' examples: https://dpaste.org/cAJ7
alestane has quit [Quit: alestane]
justache has quit [Remote host closed the connection]
<pgib>
verified that the configuration was changed within an 'it' block with pry
yokel has joined #ruby
justache has joined #ruby
alestane has joined #ruby
alestane has quit [Client Quit]
braincrash has joined #ruby
alestane has joined #ruby
alestane has quit [Client Quit]
<pgib>
I think it might have to do with the whole declare block being interpreted at load time. At that point the plan is finalized?
dfucci has joined #ruby
yokel has quit [Ping timeout: 256 seconds]
TCZ has quit [Quit: Leaving]
dfucci has quit [Ping timeout: 240 seconds]
zapata has quit [Quit: WeeChat 2.9]
govg has joined #ruby
_smurf has quit [Remote host closed the connection]
yokel has joined #ruby
dfucci has joined #ruby
ctOS has quit [Quit: Connection closed for inactivity]
yokel has quit [Ping timeout: 240 seconds]
yokel has joined #ruby
dfucci has quit [Ping timeout: 240 seconds]
<adam12>
pgib: Not sure tbh. How are you using this? `include_examples`?
<pgib>
Yeah. Looks like that might accept a block? That could ease it
Rudd0 has joined #ruby
<pgib>
include_example "strong params", [:update] then act on that before even having a describe block..
<adam12>
pgib: it_behaves_like accepts a block too. Maybe you could do something there.
spacesuitdiver has joined #ruby
neshpion has quit [Quit: WeeChat 2.9]
yokel has quit [Ping timeout: 246 seconds]
leitz has quit [Quit: Leaving]
<nakilon>
I wonder if there is a way to encode UTF-8 with negative positions
<nakilon>
this would explain how they converted 2-byte encoding to 3-byte
yokel has joined #ruby
_whitelogger has joined #ruby
yokel has quit [Ping timeout: 265 seconds]
yokel has joined #ruby
jenrzzz has joined #ruby
schne1der has quit [Ping timeout: 256 seconds]
yokel has quit [Ping timeout: 246 seconds]
jenrzzz has quit [Ping timeout: 240 seconds]
va5c0 has joined #ruby
yokel has joined #ruby
akemhp has joined #ruby
yokel has quit [Ping timeout: 265 seconds]
dfucci has joined #ruby
dfucci has quit [Ping timeout: 246 seconds]
justache has quit [Remote host closed the connection]