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!
chalkmonster has quit [Quit: WeeChat 2.8]
<poro> I want to modify a variable that is in the conditional of a loop and has been declared in the global scope
<poro> but I want to modify it within the while loop
<poro> wair
<poro> wait
<poro> yea so if I just do variable = newvalue from the local scope a new variable with the same name is created, how do I changed a global variable from a local scope?
<poro> change*
DaRock has joined #ruby
<poro> or do I just use $variable ,I heard that not a good practice
<leftylink> I advise against using $, for understandability
<leftylink> but you will see that line 3 does change variable1.
<leftylink> if you doubt what I say, do `puts variable1` at line 4.
<leftylink> in case anyone dares to accuse me of being unobservant, sha256 d1c7b2202e34f51b277cbe006e961aade84d0b75dc091b0f5274278f0b470584
sdrew has joined #ruby
<poro> oh god
<poro> it does
<poro> first time I tested it didnt, most likely a syntax mistake on my part
<leftylink> so then, you need to ask yourself, under what mechanism is variable1 being changed back to 1?
<poro> probably because I forgot the double == in the conditional statement
<leftylink> great
drincruz has joined #ruby
<poro> whats that hash thingie?
<leftylink> `echo "single equals on line 2 sets variable1 to 1 instead of comparing it to 1" | sha256sum`
<leftylink> output was d1c7b2202e34f51b277cbe006e961aade84d0b75dc091b0f5274278f0b470584
<leftylink> I needed insurance against someone daring to accuse me of not noticing that
<poro> oh hahaha
xco has quit [Read error: Connection reset by peer]
<leftylink> it would be unfortunate if I were accused of giving useless advice
<leftylink> useless advice is worse than no advice
<leftylink> if the only advice I would have been able to give is useless, I should instead stay silent, if I want to benefit the channel
bsdband87 has joined #ruby
<poro> ok so I tried the opposite, local to global, it works too, first language I learned about scopes with was JS so I see ruby does it differently
bsdbandit-01 has quit [Ping timeout: 264 seconds]
<poro> that or Im confusing if and loop statements with functions
<poro> oh no I was right
bsdbandit-01 has joined #ruby
bsdbandit-01 has quit [Max SendQ exceeded]
bsdband87 has quit [Ping timeout: 265 seconds]
ellcs1 has quit [Ping timeout: 260 seconds]
bsdbandit-01 has joined #ruby
chouhoulis has joined #ruby
tau has joined #ruby
chalkmonster has joined #ruby
bruce_lee has quit [Ping timeout: 272 seconds]
bruce_lee has joined #ruby
bruce_lee has quit [Changing host]
bruce_lee has joined #ruby
davispuh has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
poro has quit [Ping timeout: 246 seconds]
drincruz has quit [Ping timeout: 256 seconds]
joast has quit [Quit: Leaving.]
chalkmonster has quit [Quit: WeeChat 2.8]
cow[moo] has joined #ruby
cassolas has joined #ruby
cassolas has quit [Ping timeout: 264 seconds]
_whitelogger has joined #ruby
drincruz has joined #ruby
LtHummus has quit [Quit: ZNC 1.8.0 - https://znc.in]
drincruz has quit [Ping timeout: 256 seconds]
drincruz has joined #ruby
poro has joined #ruby
CrazyEddy has joined #ruby
xco has joined #ruby
<xco> i need some ideas on the best possible ways to test this https://github.com/siaw23/alice/blob/master/alice.rb 
drincruz has quit [Ping timeout: 272 seconds]
awebdev has joined #ruby
awebdev has quit [Remote host closed the connection]
romanlevin has quit [Quit: Ping timeout (120 seconds)]
romanlevin has joined #ruby
havenwood has quit [Quit: ZNC 1.8.0 - https://znc.in]
x0f has quit [Quit: quit]
x0f has joined #ruby
arthurnn has quit [Ping timeout: 260 seconds]
yokel has quit [Ping timeout: 260 seconds]
baweaver has quit [Ping timeout: 260 seconds]
arthurnn has joined #ruby
havenwood has joined #ruby
havenwood has quit [Changing host]
havenwood has joined #ruby
baweaver has joined #ruby
baweaver is now known as Guest99333
yokel has joined #ruby
ChmEarl has quit [Quit: Leaving]
r29v has joined #ruby
tau has quit [Ping timeout: 265 seconds]
Arkantos has joined #ruby
cassolas has joined #ruby
cassolas has quit [Ping timeout: 265 seconds]
_whitelogger has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
gix has joined #ruby
gix- has quit [Ping timeout: 240 seconds]
r29v has quit [Quit: r29v]
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
howdoi has joined #ruby
polishdub has joined #ruby
drincruz has joined #ruby
drincruz has quit [Ping timeout: 258 seconds]
Arkantos has quit [Ping timeout: 246 seconds]
Arkantos has joined #ruby
bsdbandit-01 has quit [Ping timeout: 265 seconds]
bsdbandit-01 has joined #ruby
cassolas has joined #ruby
cassolas has quit [Ping timeout: 264 seconds]
lesha has quit [Ping timeout: 265 seconds]
sdrew has quit [Quit: *poof*]
poro has quit [Quit: Leaving]
Jonopoly has joined #ruby
Xiti has quit [Quit: Leaving]
Garb0 has joined #ruby
Jonopoly has quit [Quit: WeeChat 2.3]
mozzarella has quit [Remote host closed the connection]
mozzarella has joined #ruby
drincruz has joined #ruby
Xiti has joined #ruby
drincruz has quit [Ping timeout: 265 seconds]
shaman42 has joined #ruby
_whitelogger has joined #ruby
envex has quit []
sagax has quit [Ping timeout: 260 seconds]
chouhoulis has quit [Quit: Leaving...]
cnsvc_ has joined #ruby
imode has quit [Ping timeout: 246 seconds]
cnsvc_ has quit [Ping timeout: 240 seconds]
cassolas has joined #ruby
ineb has joined #ruby
cassolas has quit [Ping timeout: 240 seconds]
sagax has joined #ruby
ineb has left #ruby ["WeeChat 2.8"]
howdoi has quit [Quit: Connection closed for inactivity]
cliluw has quit [Ping timeout: 264 seconds]
drincruz has joined #ruby
drincruz has quit [Ping timeout: 265 seconds]
cliluw has joined #ruby
ropeney has quit [Quit: ZNC 1.7.4 - https://znc.in]
ropeney has joined #ruby
conta has joined #ruby
_whitelogger has joined #ruby
_whitelogger has joined #ruby
chalkmonster has joined #ruby
ho0po3 has quit []
ho0po3 has joined #ruby
ho0po3 has left #ruby [#ruby]
cadeskywalker has quit [Quit: WeeChat 1.6]
Arkantos has quit [Quit: Textual IRC Client: www.textualapp.com]
Besnik_b has joined #ruby
sagax has quit [Remote host closed the connection]
drincruz has joined #ruby
drincruz has quit [Ping timeout: 260 seconds]
prestorium has joined #ruby
Garb0 has quit [Ping timeout: 265 seconds]
prestorium has quit [Quit: prestorium]
fuDwitc has joined #ruby
vondruch has quit [Ping timeout: 260 seconds]
fuDwitc_ has joined #ruby
fuDwitc has quit [Ping timeout: 240 seconds]
fuDwitc has joined #ruby
fuDwitc_ has quit [Ping timeout: 264 seconds]
fuDwitc_ has joined #ruby
fuDwitc has quit [Ping timeout: 258 seconds]
drincruz has joined #ruby
cnsvc_ has joined #ruby
xco has joined #ruby
xco has quit [Client Quit]
xco has joined #ruby
gdonald has joined #ruby
cnsvc_ has quit [Ping timeout: 240 seconds]
fuDwitc_ has quit [Remote host closed the connection]
fuDwitc has joined #ruby
fuDwitc has quit [Ping timeout: 246 seconds]
bsdbandit-01 has quit [Quit: -a- Connection Timed Out]
bsdbandit-01 has joined #ruby
drincruz has quit [Ping timeout: 256 seconds]
bsdbandit-01 has quit [Max SendQ exceeded]
bsdbandit-01 has joined #ruby
drincruz has joined #ruby
hiroaki has joined #ruby
drincruz has quit [Ping timeout: 256 seconds]
lesha has joined #ruby
DaRock has quit [Ping timeout: 258 seconds]
bsdbandit-01 has quit [Quit: -a- Connection Timed Out]
lucasb has joined #ruby
bsdbandit-01 has joined #ruby
drale2k has joined #ruby
bsdband95 has joined #ruby
bsdbandit-01 has quit [Ping timeout: 256 seconds]
bsdband95 has quit [Read error: Connection reset by peer]
bsdband17 has joined #ruby
poro has joined #ruby
drale2k has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
AndreYuhai has joined #ruby
<AndreYuhai> hey there, Any way I can colorize my IRB?
<jhass> ?pry
<ruby[bot]> Pry, the better IRB, provides easy object inspection `ls`, `history`, viewing docs `?`, viewing source `$`, syntax highlighting and other features (see `help` for more). Put `binding.pry` in your source code for easy debugging. Install Pry (https://pryrepl.org/): gem install pry pry-doc
orbyt_ has joined #ruby
<AndreYuhai> jhass, oh I am just installing 2.7.1 to try this but I will probably be using pry from now on. I was using pry in my code anyway but not on console. Thank you :)
jinmiaoluo has joined #ruby
<AndreYuhai> The only thing I hate when using pry is that when I run the code in RubyMine and then pry console pops up, if I put quotes (e.g. "") and then try to go back and edit inside the quotes, it gets messed up. I don't know why, maybe there is a fix but I have not checked.
drale2k has joined #ruby
schne1der has joined #ruby
jinmiaoluo has quit [Ping timeout: 260 seconds]
jinmiaoluo has joined #ruby
conta has joined #ruby
drale2k has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jinie has quit [Quit: ZNC 1.6.1 - http://znc.in]
jinie has joined #ruby
imode has joined #ruby
jinmiaoluo has quit [Ping timeout: 260 seconds]
<jhass> the fix is to run code outside rubymine :P
jinmiaoluo has joined #ruby
qual has joined #ruby
qual has quit [Client Quit]
schne1der has quit [Ping timeout: 240 seconds]
cnsvc_ has joined #ruby
drale2k has joined #ruby
sagax has joined #ruby
cnsvc_ has quit [Ping timeout: 240 seconds]
bsdband17 has quit [Quit: -a- Connection Timed Out]
bsdbandit-01 has joined #ruby
sauvin has quit [Read error: Connection reset by peer]
greengriminal has joined #ruby
sauvin has joined #ruby
rippa has joined #ruby
cnsvc_ has joined #ruby
howdoi has joined #ruby
cnsvc_ has quit [Ping timeout: 240 seconds]
<AndreYuhai> Or just while typing in there be more careful. :D
conta has quit [Remote host closed the connection]
gavlee has quit [Excess Flood]
gavlee has joined #ruby
alexherbo2 has joined #ruby
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
xco has joined #ruby
jinmiaoluo has quit [Ping timeout: 246 seconds]
ChmEarl has joined #ruby
eyeris has joined #ruby
<eyeris> Anyone know how to make sorbet ignore a particular gem? It's complaining about how io-console is overriding the open method. I'd love to be able to make it ignore that gem's errors while I create and submit a fix. https://pastebin.com/7JLSyFST
<ruby[bot]> eyeris: 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
void09 has joined #ruby
gpanders has left #ruby ["WeeChat 2.8"]
lesha has quit [Ping timeout: 246 seconds]
eyeris has quit [Quit: leaving]
cnsvc_ has joined #ruby
bl4ckth0r has joined #ruby
bl4ckth0r has quit [Client Quit]
blackthor has quit [Ping timeout: 260 seconds]
kinduff has quit [Read error: Connection reset by peer]
kinduff has joined #ruby
gigetoo has joined #ruby
ellcs1 has joined #ruby
howdoi has quit [Quit: Connection closed for inactivity]
ChmEarl has quit [Ping timeout: 265 seconds]
ChmEarl has joined #ruby
DTZUZU has joined #ruby
howdoi has joined #ruby
cnsvc_ has quit [Ping timeout: 240 seconds]
pwnd_nsfw has quit [Quit: Leaving]
pwnd_nsfw has joined #ruby
drale2k has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
lesha has joined #ruby
Mikaela has quit [Quit: Mikaela]
Mikaela has joined #ruby
gitter1234 has quit [Quit: Connection closed for inactivity]
TCZ has joined #ruby
drale2k has joined #ruby
chalkmonster has quit [Quit: WeeChat 2.8]
TCZ is now known as DoomSlayer2020
bsdbandit-01 has quit [Ping timeout: 256 seconds]
bsdband16 has joined #ruby
ur5us has joined #ruby
buckworst has joined #ruby
<xco> anyone familiar with forwadable i'm trying to change the commented out message to use delegation this is what i have https://gist.github.com/xcobar/ea966505c735574744dea1b2d1997e45
<xco> but getting a syntax error ;)
<xco> can forwardable be used here anyway?
chalkmonster has joined #ruby
ellcs1 has quit [Ping timeout: 260 seconds]
bsdbandit-01 has joined #ruby
<havenwood> xco: This isn't right: def_delegator @driver, :navigate.send(:to, (url)), :navigate_to(url)
<havenwood> xco: def_delegators :@driver, :navigate_to, :find_element, find_element_by, find_element_by
<havenwood> xco: I mean: def_delegators :@driver, :navigate_to, :find_element, :find_element_by, :find_element_by
<jhass> doesn't it need to be two?
<jhass> one def_delegators @driver.navigate?
<jhass> ah, it doesn't even take the instance var, right
<jhass> too caught in crystal macro land :D
<xco> havenwood I DON'T GET IT
<xco> oops
<xco> sorry for caps
bsdband16 has quit [Ping timeout: 246 seconds]
<havenwood> xco: When you call those methods, they're delegated to @driver as the receiver of the method call.
<havenwood> jhass: I was super interested in Matz's warming to macros. I haven't seen anything yet though for Ruby 3.
<jhass> def_delegators: :@driver, :navigate, ...; def_delegator :navigator, :to, :navigate_to
<havenwood> jhass: ah, yeah, you're right
<jhass> eh, :navigate in the second one
<xco> havenwood you mean when i do def_delegators :@driver, :navigate_to, :find_element, :find_element_by, :find_elements_by they all go to @driver?
<havenwood> xco: yup
<xco> how's @driver then supposed to know to call @driver.find_element(type, element) with the args?
<havenwood> xco: it delegates the method along with its arity
<xco> 😲
<jhass> def delegators just slurp all the arguments
<jhass> def find_element(*args, &block); @driver.find_element(*args, &block); end
<xco> ?
<havenwood> xco: yup
<xco> wooooow
greypack_1 has joined #ruby
greypack has quit [Ping timeout: 260 seconds]
<havenwood> xco: It doesn't work quite for :find_element, since the args change. You can use #def_delegator to get your #abort! #quit alias too, but it doesn't DRY up as much as the bulk one.
<xco> havenwood NoMethodError :D
<jhass> I always found Forwardable's implementation kind of weird https://github.com/ruby/ruby/blob/master/lib/forwardable.rb#L198-L235
<jhass> like this is "#{<--begin}\n#{<<-end}" construct, just why...
<havenwood> xco: Full error?
<havenwood> xco: Looks like you doubled up and omitted one: :find_element_by, :find_elements_by
<havenwood> oh
<havenwood> those really are two methods, haha
<havenwood> anyways, what's the full error?
<xco> full error pasted
<havenwood> xco: Make sure you're using latest code. The line number seems odd.
foxxx0 is now known as forkxxx0
forkxxx0 is now known as foxxx0
<havenwood> xco: #navigate_to seems to be private
<havenwood> xco: "forwarding to private method"
<xco> havenwood #navigate_to is the commented out code
<xco> it's the only one in the codebase
cnsvc_ has joined #ruby
<havenwood> xco: Ah, I just didn't see it wasn't a straight delegated method.
<havenwood> xco: navigate.to not navigate_to
<havenwood> xco: My eyes saw an underscore scanning these.
<xco> that's ok :)
<xco> buuttt then
<xco> that will mean
<havenwood> xco: Which is an argument actually in favor of Forwardable. The ones not forwarded aren't *just* straight delgation.
<xco> all the methons of @driver are private
<havenwood> xco: Go back to the method for the @driver.navigate.to method.
<havenwood> xco: Only :find_element_by and :find_elements_by are actually straight delegation, so you can do those two.
DoomSlayer2020 has quit [Quit: Leaving]
<havenwood> xco: You'd have to change :find_element to match `name: element` to delegate that one too.
<havenwood> xco: #navigate_to is right in your original.
<havenwood> xco: you can forward #abort!, sec
<havenwood> xco: def_delegator :@driver, :quit, :abort!
cnsvc_ has quit [Ping timeout: 240 seconds]
<havenwood> xco: def_delegators :@driver, :find_element_by, :find_elements_by
<havenwood> xco: Those ^ should be right.
drale2k has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<xco> havenwood wait
<xco> never mind
<xco> it's not working with the currect changes in https://gist.github.com/xcobar/ea966505c735574744dea1b2d1997e45
<xco> with errors
<havenwood> xco: Again my eyes failed me. The method names are different.
<havenwood> xco: You added a _by that I didn't catch.
<havenwood> xco: So you'd have to do those with #def_delegator instead of #def_delegators.
<xco> havenwood first of all this doesnt' make any sense to me, when i call #find_element_by anywhere how does it know to call @driver.find_element(type, element)
<havenwood> xco: It doesn't work. My eyes failed me.
<havenwood> xco: (Multitasking fail)
<xco> so i'm not goign crazy? we can't use forwadable here?
<havenwood> xco: def_delegator :@driver, :find_element, :find_element_by
<havenwood> xco: def_delegator :@driver, :find_elements, :find_elements_by
<havenwood> xco: Those two and the #abort! one.
<havenwood> xco: Finally this should work :P
<havenwood> xco: It's like a spot the difference in the pictures game.
<havenwood> xco: Do those three #def_delegator methods work?
<xco> havenwood testing
<xco> that works
<havenwood> xco: Looks right with comments removed :)
<xco> can't believe it's working, testing again
<havenwood> xco: Many folk would argue for `attr_accessor` instead of `attr`.
<xco> +1
<havenwood> xco: The benefit, when comparing to see if this is better, is that you can clearly see which three are "aliases."
<xco> havenwood confirmed working :)
<havenwood> xco: Then you can concentrate on what makes the two methods not "just aliases."
<havenwood> xco: Woot
<havenwood> xco: You might consider exposing `:chrome` as a default kwarg.
<havenwood> xco: def initialize(options = nil, browser: :chrome)
<havenwood> xco: WebDriver.for(browser
<xco> +1
<xco> havenwood all good now thanks ;)
lesha has quit [Remote host closed the connection]
lesha has joined #ruby
alexherbo2 has quit [Ping timeout: 256 seconds]
greypack_1 has quit [Quit: All your IRC are belong to ZNC]
hiroaki has quit [Ping timeout: 246 seconds]
joast has joined #ruby
lesha_ has joined #ruby
lesha has quit [Ping timeout: 246 seconds]
envex has joined #ruby
Kilo`byte has quit [Quit: ZNC - 1.6.0 - http://znc.in]
AndreYuhai has quit [Quit: Leaving]
Kilo`byte has joined #ruby
cnsvc_ has joined #ruby
dviola has joined #ruby
cnsvc_ has quit [Ping timeout: 240 seconds]
greypack has joined #ruby
gitter1234 has joined #ruby
lucasb has quit [Quit: Connection closed for inactivity]
greengriminal has quit [Quit: This computer has gone to sleep]
DTZUZU has quit [Quit: WeeChat 2.8]
avoo22 has joined #ruby
howdoi has quit [Quit: Connection closed for inactivity]
cnsvc_ has joined #ruby
Technodrome has joined #ruby
cnsvc_ has quit [Ping timeout: 240 seconds]
DaRock has joined #ruby
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jetchisel has joined #ruby
jetchisel has quit [Max SendQ exceeded]
Arkantos has joined #ruby
TCZ has joined #ruby
jetchisel has joined #ruby