00:12
chalkmonster has quit [Quit: WeeChat 2.8]
00:12
<
poro >
I want to modify a variable that is in the conditional of a loop and has been declared in the global scope
00:12
<
poro >
but I want to modify it within the while loop
00:14
<
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?
00:16
DaRock has joined #ruby
00:18
<
poro >
or do I just use $variable ,I heard that not a good practice
00:18
<
leftylink >
I advise against using $, for understandability
00:18
<
leftylink >
but you will see that line 3 does change variable1.
00:19
<
leftylink >
if you doubt what I say, do `puts variable1` at line 4.
00:20
<
leftylink >
in case anyone dares to accuse me of being unobservant, sha256 d1c7b2202e34f51b277cbe006e961aade84d0b75dc091b0f5274278f0b470584
00:21
sdrew has joined #ruby
00:23
<
poro >
first time I tested it didnt, most likely a syntax mistake on my part
00:23
<
leftylink >
so then, you need to ask yourself, under what mechanism is variable1 being changed back to 1?
00:24
<
poro >
probably because I forgot the double == in the conditional statement
00:24
drincruz has joined #ruby
00:24
<
poro >
whats that hash thingie?
00:25
<
leftylink >
`echo "single equals on line 2 sets variable1 to 1 instead of comparing it to 1" | sha256sum`
00:25
<
leftylink >
output was d1c7b2202e34f51b277cbe006e961aade84d0b75dc091b0f5274278f0b470584
00:25
<
leftylink >
I needed insurance against someone daring to accuse me of not noticing that
00:26
xco has quit [Read error: Connection reset by peer]
00:26
<
leftylink >
it would be unfortunate if I were accused of giving useless advice
00:28
<
leftylink >
useless advice is worse than no advice
00:28
<
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
00:31
bsdband87 has joined #ruby
00:32
<
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
00:33
bsdbandit-01 has quit [Ping timeout: 264 seconds]
00:33
<
poro >
that or Im confusing if and loop statements with functions
00:34
<
poro >
oh no I was right
00:41
bsdbandit-01 has joined #ruby
00:41
bsdbandit-01 has quit [Max SendQ exceeded]
00:43
bsdband87 has quit [Ping timeout: 265 seconds]
00:45
ellcs1 has quit [Ping timeout: 260 seconds]
00:46
bsdbandit-01 has joined #ruby
00:48
chouhoulis has joined #ruby
00:52
tau has joined #ruby
00:55
chalkmonster has joined #ruby
01:00
bruce_lee has quit [Ping timeout: 272 seconds]
01:01
bruce_lee has joined #ruby
01:01
bruce_lee has quit [Changing host]
01:01
bruce_lee has joined #ruby
01:11
poro has quit [Ping timeout: 246 seconds]
01:24
drincruz has quit [Ping timeout: 256 seconds]
01:26
joast has quit [Quit: Leaving.]
01:32
chalkmonster has quit [Quit: WeeChat 2.8]
01:34
cow[moo] has joined #ruby
01:36
cassolas has joined #ruby
01:41
cassolas has quit [Ping timeout: 264 seconds]
01:45
_whitelogger has joined #ruby
01:53
drincruz has joined #ruby
01:58
drincruz has quit [Ping timeout: 256 seconds]
02:30
drincruz has joined #ruby
02:31
poro has joined #ruby
02:32
CrazyEddy has joined #ruby
02:33
xco has joined #ruby
02:35
drincruz has quit [Ping timeout: 272 seconds]
02:50
awebdev has joined #ruby
02:50
awebdev has quit [Remote host closed the connection]
02:57
romanlevin has quit [Quit: Ping timeout (120 seconds)]
02:57
romanlevin has joined #ruby
02:58
x0f has quit [Quit: quit]
02:58
x0f has joined #ruby
02:58
arthurnn has quit [Ping timeout: 260 seconds]
02:59
yokel has quit [Ping timeout: 260 seconds]
02:59
baweaver has quit [Ping timeout: 260 seconds]
03:00
arthurnn has joined #ruby
03:00
havenwood has joined #ruby
03:01
havenwood has quit [Changing host]
03:01
havenwood has joined #ruby
03:01
baweaver has joined #ruby
03:01
baweaver is now known as Guest99333
03:01
yokel has joined #ruby
03:06
ChmEarl has quit [Quit: Leaving]
03:07
r29v has joined #ruby
03:20
tau has quit [Ping timeout: 265 seconds]
03:28
Arkantos has joined #ruby
03:38
cassolas has joined #ruby
03:42
cassolas has quit [Ping timeout: 265 seconds]
03:48
_whitelogger has joined #ruby
03:51
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
03:54
gix has joined #ruby
03:55
gix- has quit [Ping timeout: 240 seconds]
03:59
r29v has quit [Quit: r29v]
04:05
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
04:08
howdoi has joined #ruby
04:28
polishdub has joined #ruby
04:31
drincruz has joined #ruby
04:36
drincruz has quit [Ping timeout: 258 seconds]
05:04
Arkantos has quit [Ping timeout: 246 seconds]
05:08
Arkantos has joined #ruby
05:20
bsdbandit-01 has quit [Ping timeout: 265 seconds]
05:36
bsdbandit-01 has joined #ruby
05:39
cassolas has joined #ruby
05:44
cassolas has quit [Ping timeout: 264 seconds]
06:03
lesha has quit [Ping timeout: 265 seconds]
06:08
sdrew has quit [Quit: *poof*]
06:14
poro has quit [Quit: Leaving]
06:18
Jonopoly has joined #ruby
06:21
Xiti has quit [Quit: Leaving]
06:22
Garb0 has joined #ruby
06:28
Jonopoly has quit [Quit: WeeChat 2.3]
06:28
mozzarella has quit [Remote host closed the connection]
06:29
mozzarella has joined #ruby
06:32
drincruz has joined #ruby
06:35
Xiti has joined #ruby
06:37
drincruz has quit [Ping timeout: 265 seconds]
06:43
shaman42 has joined #ruby
06:48
_whitelogger has joined #ruby
07:14
sagax has quit [Ping timeout: 260 seconds]
07:29
chouhoulis has quit [Quit: Leaving...]
07:34
cnsvc_ has joined #ruby
07:34
imode has quit [Ping timeout: 246 seconds]
07:39
cnsvc_ has quit [Ping timeout: 240 seconds]
07:40
cassolas has joined #ruby
07:42
ineb has joined #ruby
07:44
cassolas has quit [Ping timeout: 240 seconds]
07:45
sagax has joined #ruby
07:52
ineb has left #ruby ["WeeChat 2.8"]
07:58
howdoi has quit [Quit: Connection closed for inactivity]
08:20
cliluw has quit [Ping timeout: 264 seconds]
08:33
drincruz has joined #ruby
08:38
drincruz has quit [Ping timeout: 265 seconds]
08:39
cliluw has joined #ruby
08:46
ropeney has joined #ruby
08:53
conta has joined #ruby
08:57
_whitelogger has joined #ruby
09:09
_whitelogger has joined #ruby
09:11
chalkmonster has joined #ruby
09:57
ho0po3 has joined #ruby
10:00
ho0po3 has left #ruby [#ruby]
10:05
cadeskywalker has quit [Quit: WeeChat 1.6]
10:17
Besnik_b has joined #ruby
10:20
sagax has quit [Remote host closed the connection]
10:34
drincruz has joined #ruby
10:39
drincruz has quit [Ping timeout: 260 seconds]
10:52
prestorium has joined #ruby
11:07
Garb0 has quit [Ping timeout: 265 seconds]
11:09
prestorium has quit [Quit: prestorium]
11:40
fuDwitc has joined #ruby
11:41
vondruch has quit [Ping timeout: 260 seconds]
11:50
fuDwitc_ has joined #ruby
11:52
fuDwitc has quit [Ping timeout: 240 seconds]
12:14
fuDwitc has joined #ruby
12:17
fuDwitc_ has quit [Ping timeout: 264 seconds]
12:22
fuDwitc_ has joined #ruby
12:26
fuDwitc has quit [Ping timeout: 258 seconds]
12:30
drincruz has joined #ruby
13:02
cnsvc_ has joined #ruby
13:16
xco has joined #ruby
13:16
xco has quit [Client Quit]
13:17
xco has joined #ruby
13:23
gdonald has joined #ruby
13:24
cnsvc_ has quit [Ping timeout: 240 seconds]
13:24
fuDwitc_ has quit [Remote host closed the connection]
13:25
fuDwitc has joined #ruby
13:29
fuDwitc has quit [Ping timeout: 246 seconds]
13:34
bsdbandit-01 has quit [Quit: -a- Connection Timed Out]
13:39
bsdbandit-01 has joined #ruby
13:39
drincruz has quit [Ping timeout: 256 seconds]
13:39
bsdbandit-01 has quit [Max SendQ exceeded]
13:43
bsdbandit-01 has joined #ruby
13:48
drincruz has joined #ruby
13:50
hiroaki has joined #ruby
14:11
drincruz has quit [Ping timeout: 256 seconds]
14:23
lesha has joined #ruby
14:33
DaRock has quit [Ping timeout: 258 seconds]
14:34
bsdbandit-01 has quit [Quit: -a- Connection Timed Out]
14:37
lucasb has joined #ruby
14:39
bsdbandit-01 has joined #ruby
14:44
drale2k has joined #ruby
15:03
bsdband95 has joined #ruby
15:04
bsdbandit-01 has quit [Ping timeout: 256 seconds]
15:04
bsdband95 has quit [Read error: Connection reset by peer]
15:05
bsdband17 has joined #ruby
15:29
poro has joined #ruby
15:32
drale2k has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
15:37
AndreYuhai has joined #ruby
15:37
<
AndreYuhai >
hey there, Any way I can colorize my IRB?
15:46
<
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
15:50
orbyt_ has joined #ruby
15:55
<
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 :)
15:57
jinmiaoluo has joined #ruby
16:00
<
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.
16:04
drale2k has joined #ruby
16:13
schne1der has joined #ruby
16:25
jinmiaoluo has quit [Ping timeout: 260 seconds]
16:27
jinmiaoluo has joined #ruby
16:29
conta has joined #ruby
16:30
drale2k has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
16:33
jinie has joined #ruby
16:39
imode has joined #ruby
16:41
jinmiaoluo has quit [Ping timeout: 260 seconds]
16:43
<
jhass >
the fix is to run code outside rubymine :P
16:43
jinmiaoluo has joined #ruby
16:44
qual has joined #ruby
16:46
qual has quit [Client Quit]
16:48
schne1der has quit [Ping timeout: 240 seconds]
16:51
cnsvc_ has joined #ruby
16:52
drale2k has joined #ruby
16:53
sagax has joined #ruby
16:56
cnsvc_ has quit [Ping timeout: 240 seconds]
16:59
bsdband17 has quit [Quit: -a- Connection Timed Out]
16:59
bsdbandit-01 has joined #ruby
17:07
sauvin has quit [Read error: Connection reset by peer]
17:07
greengriminal has joined #ruby
17:13
sauvin has joined #ruby
17:14
rippa has joined #ruby
17:17
cnsvc_ has joined #ruby
17:21
howdoi has joined #ruby
17:25
cnsvc_ has quit [Ping timeout: 240 seconds]
17:30
<
AndreYuhai >
Or just while typing in there be more careful. :D
17:44
conta has quit [Remote host closed the connection]
17:45
gavlee has quit [Excess Flood]
17:47
gavlee has joined #ruby
17:51
alexherbo2 has joined #ruby
18:00
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
18:01
xco has joined #ruby
18:12
jinmiaoluo has quit [Ping timeout: 246 seconds]
18:22
ChmEarl has joined #ruby
18:36
eyeris has joined #ruby
18:37
<
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
18:37
<
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
18:48
void09 has joined #ruby
19:17
gpanders has left #ruby ["WeeChat 2.8"]
19:23
lesha has quit [Ping timeout: 246 seconds]
19:29
eyeris has quit [Quit: leaving]
19:32
cnsvc_ has joined #ruby
19:41
bl4ckth0r has joined #ruby
19:41
bl4ckth0r has quit [Client Quit]
19:43
blackthor has quit [Ping timeout: 260 seconds]
19:49
kinduff has quit [Read error: Connection reset by peer]
19:49
kinduff has joined #ruby
19:50
gigetoo has joined #ruby
19:50
ellcs1 has joined #ruby
19:51
howdoi has quit [Quit: Connection closed for inactivity]
20:01
ChmEarl has quit [Ping timeout: 265 seconds]
20:04
ChmEarl has joined #ruby
20:05
DTZUZU has joined #ruby
20:31
howdoi has joined #ruby
20:33
cnsvc_ has quit [Ping timeout: 240 seconds]
20:45
pwnd_nsfw has quit [Quit: Leaving]
20:47
pwnd_nsfw has joined #ruby
20:52
drale2k has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
20:53
lesha has joined #ruby
20:56
Mikaela has quit [Quit: Mikaela]
20:57
Mikaela has joined #ruby
21:00
gitter1234 has quit [Quit: Connection closed for inactivity]
21:00
TCZ has joined #ruby
21:09
drale2k has joined #ruby
21:10
chalkmonster has quit [Quit: WeeChat 2.8]
21:11
TCZ is now known as DoomSlayer2020
21:17
bsdbandit-01 has quit [Ping timeout: 256 seconds]
21:21
bsdband16 has joined #ruby
21:24
ur5us has joined #ruby
21:37
buckworst has joined #ruby
21:42
<
xco >
but getting a syntax error ;)
21:42
<
xco >
can forwardable be used here anyway?
21:45
chalkmonster has joined #ruby
21:48
ellcs1 has quit [Ping timeout: 260 seconds]
21:51
bsdbandit-01 has joined #ruby
21:52
<
havenwood >
xco: This isn't right: def_delegator @driver, :navigate.send(:to, (url)), :navigate_to(url)
21:53
<
havenwood >
xco: def_delegators :@driver, :navigate_to, :find_element, find_element_by, find_element_by
21:53
<
havenwood >
xco: I mean: def_delegators :@driver, :navigate_to, :find_element, :find_element_by, :find_element_by
21:53
<
jhass >
doesn't it need to be two?
21:53
<
jhass >
one def_delegators @driver.navigate?
21:54
<
jhass >
ah, it doesn't even take the instance var, right
21:54
<
jhass >
too caught in crystal macro land :D
21:54
<
xco >
havenwood I DON'T GET IT
21:54
<
xco >
sorry for caps
21:54
bsdband16 has quit [Ping timeout: 246 seconds]
21:55
<
havenwood >
xco: When you call those methods, they're delegated to @driver as the receiver of the method call.
21:55
<
havenwood >
jhass: I was super interested in Matz's warming to macros. I haven't seen anything yet though for Ruby 3.
21:55
<
jhass >
def_delegators: :@driver, :navigate, ...; def_delegator :navigator, :to, :navigate_to
21:56
<
havenwood >
jhass: ah, yeah, you're right
21:56
<
jhass >
eh, :navigate in the second one
21:56
<
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?
21:56
<
havenwood >
xco: yup
21:57
<
xco >
how's @driver then supposed to know to call @driver.find_element(type, element) with the args?
21:57
<
havenwood >
xco: it delegates the method along with its arity
21:57
<
jhass >
def delegators just slurp all the arguments
21:58
<
jhass >
def find_element(*args, &block); @driver.find_element(*args, &block); end
21:59
<
havenwood >
xco: yup
21:59
greypack_1 has joined #ruby
21:59
greypack has quit [Ping timeout: 260 seconds]
22:00
<
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.
22:02
<
xco >
havenwood NoMethodError :D
22:04
<
jhass >
like this is "#{<--begin}\n#{<<-end}" construct, just why...
22:05
<
havenwood >
xco: Full error?
22:05
<
havenwood >
xco: Looks like you doubled up and omitted one: :find_element_by, :find_elements_by
22:05
<
havenwood >
those really are two methods, haha
22:05
<
havenwood >
anyways, what's the full error?
22:05
<
xco >
full error pasted
22:06
<
havenwood >
xco: Make sure you're using latest code. The line number seems odd.
22:07
foxxx0 is now known as forkxxx0
22:07
forkxxx0 is now known as foxxx0
22:07
<
havenwood >
xco: #navigate_to seems to be private
22:07
<
havenwood >
xco: "forwarding to private method"
22:10
<
xco >
havenwood #navigate_to is the commented out code
22:10
<
xco >
it's the only one in the codebase
22:10
cnsvc_ has joined #ruby
22:11
<
havenwood >
xco: Ah, I just didn't see it wasn't a straight delegated method.
22:11
<
havenwood >
xco: navigate.to not navigate_to
22:12
<
havenwood >
xco: My eyes saw an underscore scanning these.
22:12
<
xco >
that will mean
22:12
<
havenwood >
xco: Which is an argument actually in favor of Forwardable. The ones not forwarded aren't
*just* straight delgation.
22:12
<
xco >
all the methons of @driver are private
22:13
<
havenwood >
xco: Go back to the method for the @driver.navigate.to method.
22:13
<
havenwood >
xco: Only :find_element_by and :find_elements_by are actually straight delegation, so you can do those two.
22:13
DoomSlayer2020 has quit [Quit: Leaving]
22:14
<
havenwood >
xco: You'd have to change :find_element to match `name: element` to delegate that one too.
22:14
<
havenwood >
xco: #navigate_to is right in your original.
22:14
<
havenwood >
xco: you can forward #abort!, sec
22:15
<
havenwood >
xco: def_delegator :@driver, :quit, :abort!
22:15
cnsvc_ has quit [Ping timeout: 240 seconds]
22:15
<
havenwood >
xco: def_delegators :@driver, :find_element_by, :find_elements_by
22:16
<
havenwood >
xco: Those ^ should be right.
22:17
drale2k has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
22:18
<
xco >
havenwood wait
22:19
<
havenwood >
xco: Again my eyes failed me. The method names are different.
22:20
<
havenwood >
xco: You added a _by that I didn't catch.
22:20
<
havenwood >
xco: So you'd have to do those with #def_delegator instead of #def_delegators.
22:20
<
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)
22:20
<
havenwood >
xco: It doesn't work. My eyes failed me.
22:21
<
havenwood >
xco: (Multitasking fail)
22:21
<
xco >
so i'm not goign crazy? we can't use forwadable here?
22:21
<
havenwood >
xco: def_delegator :@driver, :find_element, :find_element_by
22:21
<
havenwood >
xco: def_delegator :@driver, :find_elements, :find_elements_by
22:21
<
havenwood >
xco: Those two and the #abort! one.
22:21
<
havenwood >
xco: Finally this should work :P
22:22
<
havenwood >
xco: It's like a spot the difference in the pictures game.
22:22
<
havenwood >
xco: Do those three #def_delegator methods work?
22:23
<
xco >
havenwood testing
22:24
<
havenwood >
xco: Looks right with comments removed :)
22:25
<
xco >
can't believe it's working, testing again
22:25
<
havenwood >
xco: Many folk would argue for `attr_accessor` instead of `attr`.
22:25
<
havenwood >
xco: The benefit, when comparing to see if this is better, is that you can clearly see which three are "aliases."
22:26
<
xco >
havenwood confirmed working :)
22:26
<
havenwood >
xco: Then you can concentrate on what makes the two methods not "just aliases."
22:26
<
havenwood >
xco: Woot
22:27
<
havenwood >
xco: You might consider exposing `:chrome` as a default kwarg.
22:27
<
havenwood >
xco: def initialize(options = nil, browser: :chrome)
22:27
<
havenwood >
xco: WebDriver.for(browser
22:37
<
xco >
havenwood all good now thanks ;)
22:41
lesha has quit [Remote host closed the connection]
22:42
lesha has joined #ruby
22:42
alexherbo2 has quit [Ping timeout: 256 seconds]
22:42
greypack_1 has quit [Quit: All your IRC are belong to ZNC]
22:46
hiroaki has quit [Ping timeout: 246 seconds]
22:50
joast has joined #ruby
22:51
lesha_ has joined #ruby
22:53
lesha has quit [Ping timeout: 246 seconds]
22:56
envex has joined #ruby
22:57
AndreYuhai has quit [Quit: Leaving]
23:01
Kilo`byte has joined #ruby
23:02
cnsvc_ has joined #ruby
23:10
dviola has joined #ruby
23:12
cnsvc_ has quit [Ping timeout: 240 seconds]
23:13
greypack has joined #ruby
23:18
gitter1234 has joined #ruby
23:26
lucasb has quit [Quit: Connection closed for inactivity]
23:30
greengriminal has quit [Quit: This computer has gone to sleep]
23:30
DTZUZU has quit [Quit: WeeChat 2.8]
23:31
avoo22 has joined #ruby
23:31
howdoi has quit [Quit: Connection closed for inactivity]
23:34
cnsvc_ has joined #ruby
23:35
Technodrome has joined #ruby
23:39
cnsvc_ has quit [Ping timeout: 240 seconds]
23:39
DaRock has joined #ruby
23:41
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
23:42
jetchisel has joined #ruby
23:43
jetchisel has quit [Max SendQ exceeded]
23:45
Arkantos has joined #ruby
23:46
TCZ has joined #ruby
23:47
jetchisel has joined #ruby