havenwood changed the topic of #ruby to: Rules & more: https://ruby-community.com | Ruby 2.6.1, 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!
cranq has joined #ruby
Swyper has joined #ruby
Swyper has quit [Ping timeout: 255 seconds]
alnk has quit [Quit: leaving]
zapata has joined #ruby
alnk has joined #ruby
tdy2 is now known as tdy
Psy-Q has quit [Read error: Connection reset by peer]
Psy-Q has joined #ruby
sameerynho has quit [Ping timeout: 245 seconds]
dviola has quit [Quit: WeeChat 2.4]
houhoulis has quit [Ping timeout: 245 seconds]
blackmesa1 has quit [Ping timeout: 264 seconds]
houhoulis has joined #ruby
houhoulis has quit [Ping timeout: 250 seconds]
cagomez has joined #ruby
arescorpio has joined #ruby
Swyper has joined #ruby
Swyper has quit [Remote host closed the connection]
apparition has joined #ruby
def_jam has quit [Read error: Connection reset by peer]
AndroidKitKat has quit [Quit: バイバイ〜!]
bga57 has quit [Ping timeout: 250 seconds]
AndroidKitKat has joined #ruby
def_jam has joined #ruby
barg has joined #ruby
bruul has joined #ruby
<barg> i'm getting an error when I try to run selenium in ruby https://gist.github.com/gartha1/5fe5da228a7302f2acc0ae66a407aeb8
<barg> Exception `LoadError' at C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55 - cannot load such file -- selenium-webdriver
<barg> Exception `Errno::EADDRNOTAVAIL' at C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/selenium-webdriver-3.141.0/lib/selenium/webdriver/common/socket_lock.rb:61 - The requested address is not va
<barg> its context. - bind(2) for "127.0.0.1" port 9514
donofrio has joined #ruby
code_zombie has joined #ruby
donofrio has quit [Ping timeout: 255 seconds]
donofrio has joined #ruby
houhoulis has joined #ruby
xrexeon has quit [Remote host closed the connection]
Swyper has joined #ruby
donofrio has quit [Ping timeout: 250 seconds]
Swyper has quit [Ping timeout: 255 seconds]
catbusters has quit [Quit: Connection closed for inactivity]
donofrio has joined #ruby
Swyper has joined #ruby
Swyper has quit [Remote host closed the connection]
donofrio has quit [Ping timeout: 250 seconds]
hiroaki has quit [Ping timeout: 268 seconds]
arescorpio has quit [Remote host closed the connection]
hiroaki has joined #ruby
cagomez has quit [Remote host closed the connection]
cagomez has joined #ruby
donofrio has joined #ruby
cagomez has quit [Ping timeout: 250 seconds]
renich has joined #ruby
BTRE has quit [Remote host closed the connection]
renich has quit [Quit: renich]
cd has quit [Quit: cd]
AJA4350 has quit [Remote host closed the connection]
al2o3-cr has quit [Quit: WeeChat 2.4]
al2o3-cr has joined #ruby
wolfshappen has quit [Ping timeout: 245 seconds]
wolfshappen has joined #ruby
braincrash has quit [Quit: bye bye]
braincrash has joined #ruby
Nicmavr has quit [Read error: Connection reset by peer]
Nicmavr has joined #ruby
cagomez has joined #ruby
Swyper has joined #ruby
Swyper has quit [Ping timeout: 245 seconds]
bruul has quit [Ping timeout: 245 seconds]
jobewan has joined #ruby
planigan has quit [Quit: leaving]
planigan has joined #ruby
_whitelogger has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
doomspork has joined #ruby
houhoulis has quit [Remote host closed the connection]
gix has quit [Ping timeout: 272 seconds]
doomspork has quit [Ping timeout: 245 seconds]
skyikot has quit [Remote host closed the connection]
cagomez has quit []
noAKA has joined #ruby
fluxAeon has quit [Ping timeout: 255 seconds]
fluxAeon has joined #ruby
orbyt_ has joined #ruby
<noAKA> Anyone have a second to help out with what I think is a scope problem? https://dpaste.de/FrUc. Method at line 37, description in inline commment.
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<baweaver> noAKA: I'd bet on some form of eval (instance, module, class)
<baweaver> If you made locals right above it I bet it works
apparition has quit [Quit: Bye]
<baweaver> loddbot = Cinch::Bot.new; loddbot.configure do ... end
<baweaver> Try that instead
<baweaver> Bingo: `instance_eval(&b) if block_given?`
<noAKA> Thanks
<noAKA> I'll give that a shot
<noAKA> baweaver: Worked! thanks a ton
noAKA has quit [Quit: leaving]
jobewan has quit [Quit: jobewan]
blackmesa1 has joined #ruby
blackmesa1 has quit [Ping timeout: 258 seconds]
laaron has quit [Remote host closed the connection]
rippa has joined #ruby
laaron has joined #ruby
arekushi has joined #ruby
dellavg__ has joined #ruby
KeyJoo has joined #ruby
reber has joined #ruby
mikecmpbll has quit [Quit: inabit. zz.]
conta has joined #ruby
ua has quit [Ping timeout: 246 seconds]
conta has quit [Ping timeout: 245 seconds]
hiroaki has quit [Ping timeout: 255 seconds]
Dbugger has joined #ruby
hiroaki has joined #ruby
ua has joined #ruby
adgtl has quit [Ping timeout: 246 seconds]
reber has quit [Remote host closed the connection]
blackmesa1 has joined #ruby
t0xik has joined #ruby
\void has quit [Quit: So long, and thanks for all the fish.]
sameerynho has joined #ruby
fluxAeon has quit [Read error: Connection reset by peer]
fluxAeon has joined #ruby
gix has joined #ruby
conta has joined #ruby
conta has quit [Ping timeout: 246 seconds]
wolfshappen has quit [Ping timeout: 250 seconds]
wolfshappen_ has joined #ruby
dhollinger has quit [Ping timeout: 268 seconds]
blackmesa1 has quit [Quit: WeeChat 2.3]
Fernando-Basso has joined #ruby
dhollinger has joined #ruby
dellavg__ has quit [Ping timeout: 244 seconds]
adgtl has joined #ruby
mikecmpbll has joined #ruby
xrexeon has joined #ruby
ricotuco has joined #ruby
ams__ has joined #ruby
mangold has quit [Ping timeout: 264 seconds]
clemens3_ has joined #ruby
conta has joined #ruby
conta has quit [Ping timeout: 250 seconds]
tdy has quit [Ping timeout: 250 seconds]
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #ruby
xrexeon has quit [Remote host closed the connection]
BTRE has joined #ruby
conta has joined #ruby
mikecmpbll has quit [Quit: inabit. zz.]
KeyJoo has quit [Quit: KeyJoo]
SCHAPiE has quit [Quit: ZNC - https://znc.in]
Inline has quit [Read error: Connection reset by peer]
Inline has joined #ruby
mikecmpbll has joined #ruby
mangold has joined #ruby
AJA4350 has joined #ruby
mangold has quit [Client Quit]
SCHAPiE has joined #ruby
Inline has quit [Quit: Leaving]
Inline has joined #ruby
volkov has joined #ruby
mangold has joined #ruby
lucasb has joined #ruby
conta1 has joined #ruby
conta1 has quit [Ping timeout: 244 seconds]
ams__ has quit [Quit: Connection closed for inactivity]
volkov has quit [Quit: volkov]
kent\n has quit [Ping timeout: 246 seconds]
mnemon has quit [Quit: leaving]
kent\n has joined #ruby
mnemon has joined #ruby
catbusters has joined #ruby
NeilCarvalho has joined #ruby
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #ruby
Inline has quit [Quit: Leaving]
Inline has joined #ruby
mangold has quit [Quit: This computer has gone to sleep]
ravenousmoose has joined #ruby
xco has joined #ruby
mangold has joined #ruby
zapata has quit [Ping timeout: 258 seconds]
manakanapa has quit [Quit: The Lounge - https://thelounge.chat]
Swyper has joined #ruby
zapata has joined #ruby
Swyper has quit [Remote host closed the connection]
manakanapa has joined #ruby
<xco> i was trying to help a friend learn Ruby with this simple excercise but I failed to expalin to him line 28 https://gist.github.com/xcobar/afde617a4abd23d2eae783c4403a51a6 we wrote this program together step-by-step but on line 28 he had initially written “else @points += 1” without “results[0] == results[1]”
<xco> i couldn’t answer his question why just “else @points += 1” didn’t work (returned 4 instead of 7) but i just knew he had to put “elsif results[0] == results[1]”
<xco> can anyone tell me why just “else @points += 1” didn’t work. i need this explanation for myself and for him :)
manakanapa1 has joined #ruby
manakanapa has quit [Ping timeout: 246 seconds]
barg has quit []
<mnemon> xco: I just tested it with else and it still returned 7
<xco> mnemon: thanks! so he must have messed something on his computer that i missed
<mnemon> yeah
<xco> 😬
<xco> mnemon: thanks a lot :)
<mnemon> np
code_zombie has quit [Quit: Leaving]
<phaul> @points += [1, 3, 0][results[0] <=> results[1]]
<phaul> but don't write code like this
<xco> phaul: what do you mean? I know myself to write it this way like you have but i’m helping a beginner out. he wouldn’t undestand this and it would be hard for me to explain <=> this to a complete noob that’s why i we wrote it the way we did
<xco> if it makes any sense
<phaul> it's unecesarrily trying to be clever sacrificing clarity for shortness
xrexeon has joined #ruby
mangold has quit [Quit: This computer has gone to sleep]
ravenousmoose has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
venmx has joined #ruby
mangold has joined #ruby
wolfshappen_ has quit [Ping timeout: 246 seconds]
wolfshappen has joined #ruby
venmx has quit [Quit: leaving]
conta has quit [Quit: conta]
phaul has quit [Quit: bye]
DTZUZO has quit [Read error: Connection reset by peer]
ravenousmoose has joined #ruby
doomspork has joined #ruby
Fernando-Basso has quit [Remote host closed the connection]
NeilCarvalho has quit [Ping timeout: 246 seconds]
conta has joined #ruby
conta has quit [Ping timeout: 268 seconds]
orbyt_ has joined #ruby
tdy has joined #ruby
gix has quit [Quit: Client exiting]
gix has joined #ruby
phaul has joined #ruby
hiroaki_ has joined #ruby
paraxial has quit [Quit: The Lounge - https://thelounge.chat]
hiroaki has quit [Ping timeout: 245 seconds]
paraxial has joined #ruby
houhoulis has joined #ruby
ravenousmoose has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
lucasb has quit [Quit: Connection closed for inactivity]
my1es has quit [Remote host closed the connection]
doomspork has quit [Ping timeout: 246 seconds]
Swyper has joined #ruby
xco has quit [Quit: xco]
dellavg__ has joined #ruby
hiroaki_ has quit [Ping timeout: 246 seconds]
al2o3-cr has quit [Quit: WeeChat 2.4]
danst has quit [Ping timeout: 250 seconds]
al2o3-cr has joined #ruby
<dmwit> I don't know how to Google this. If I've defined a [] method for my class, how do I call it from within another method of that same class?
<dmwit> [foo] seems like it would just create a one-element list...
doomspork has joined #ruby
hiroaki_ has joined #ruby
catbusters has quit [Quit: Connection closed for inactivity]
Swyper has quit [Remote host closed the connection]
ravenousmoose has joined #ruby
ravenousmoose has quit [Client Quit]
conta has joined #ruby
<dmwit> When I write `x = Enumerator.new {|y| y << 1; print 2; y << 2}`, then later I `x.each {|v| print v}`, the call to `y << 1` transfers control back from the original block into `x.each`. How the heck does that work?? Can I write my own class that behaves that way somehow?
<leftylink> the only way I found to call [] was self.[foo]
<leftylink> er, without the dot
<leftylink> self[foo], or I guess self.[](foo) would also work
<leftylink> given that you can do maybe_an_array&.[](foo) , seems logical that self.[](foo) would work
<dmwit> Okay, cool.
<dmwit> Didn't know about self, but it makes sense that something like that would exist.
conta has quit [Ping timeout: 245 seconds]
<leftylink> the passing of control used to invite some sort of discussion about https://ruby-doc.org/core-2.5.0/Continuation.html but nowadas I guess people prefer https://ruby-doc.org/core-2.5.0/Fiber.html . I haven't delved into them much
bga57 has joined #ruby
ravenousmoose has joined #ruby
hiroaki_ has quit [Ping timeout: 245 seconds]
ellcs has joined #ruby
reber has joined #ruby
doomspork has quit [Ping timeout: 245 seconds]
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
mikecmpbll has quit [Quit: inabit. zz.]
agent_white has quit [Quit: leaving]
tekk has quit [Quit: ZNC - http://znc.in]
cd has joined #ruby
agent_white has joined #ruby
c-c has joined #ruby
ellcs has quit [Ping timeout: 264 seconds]
Swyper has joined #ruby
ricotuco has quit [Quit: Leaving]
Swyper has quit [Ping timeout: 255 seconds]
xco has joined #ruby
ravenousmoose has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
xrexeon has quit [Ping timeout: 245 seconds]
xrexeon has joined #ruby
xrexeon has quit [Remote host closed the connection]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
orbyt_ has joined #ruby
clemens3_ has quit [Ping timeout: 246 seconds]
t0xik has quit [Quit: Connection closed for inactivity]
clemens3_ has joined #ruby
wolfshappen has quit [Ping timeout: 272 seconds]
wolfshappen_ has joined #ruby
reber has quit [Remote host closed the connection]
NightMonkey has quit [Quit: ZNC - http://znc.in]
Arahael has left #ruby ["WeeChat 2.0.1"]
tekk has joined #ruby
nowhere_man has quit [Ping timeout: 258 seconds]
dellavg__ has quit [Ping timeout: 245 seconds]
xco has quit [Quit: xco]
xco has joined #ruby
zapata has quit [Quit: WeeChat 2.3]
nowhere_man has joined #ruby
xco has quit [Quit: xco]
houhoulis has quit [Remote host closed the connection]
zapata has joined #ruby
al2o3-cr has quit [Quit: WeeChat 2.4]
nowhere_man has quit [Ping timeout: 258 seconds]
al2o3-cr has joined #ruby
cthulchu_ has joined #ruby
<c-c> I want to pass a block into a new, and into a method from there, into a method which yields. Whats the correct way to do this? Is it OK to bind the new proc into a var? like keep doing ablock = Proc.new if block_given?
<phaul> if you use yhe & syntax on the argument list it automatically binds it to an argument
<phaul> then you can assign it to any instance variable like everyting else.
catbusters has joined #ruby
<phaul> &>> class X; def initialize(&block); @x = block; end; def foo; @x.call; end; end; x = X.new { hello } ; x.foo
<rubydoc> # => undefined local variable or method `hello' for main:Object (NameError) (https://carc.in/#/r/6d0h)
<phaul> &>> class X; def initialize(&block); @x = block; end; def foo; @x.call; end; end; x = X.new { 'hello' } ; x.foo
<rubydoc> # => "hello" (https://carc.in/#/r/6d0i)
<c-c> Ahem, why didn't I realize the block can be bound to a class var
<c-c> Anyway, I was thinking that &block in an argument list was 10x slower than Proc.new - read something about it somewhere.
ellcs has joined #ruby
<phaul> It's probably slower than yield because then you don't have to proc-ify the block. But here the proc object is created either way. I don't beleive 10x but I don't have numbers. One would have to measure. But even then I would say don't optimize up front. Do your algorithm in a sane way and when it's slow profile it.
<c-c> true
<c-c> it may be 10x just for the case where the block is not ever run
<c-c> never nil.call
<c-c> - or something
sameerynho has quit [Ping timeout: 268 seconds]
<c-c> phaul: how would you pass the @x? Like say when instantiating another class with new in method foo?
<c-c> like &@x ?
<c-c> Or maybe: Aklas.new(foo) @x
<phaul> & on method declare "procifies" wheras on call "blockifies" back. so yes, that's how map(&method(:blah)) works
<rubydoc> parser error at position 0 around ` '
<c-c> erm, foo was a poor choice for unambiguity there on my part
<phaul> but I'm don't fully understand your example or what it's trying.
<phaul> I'm not sure I fully understand --- edited lines after I wrote it
<phaul> write a small paste or something, and if it doesn't work we can help
<c-c> &>> class Zero; def initialize; Proc.new.call if block_given?; end; end; class One; def initialize; @y = Proc.new if block_given?; Zero.new? @y; end;
<rubydoc> # => (https://carc.in/#/r/6d0j)
<c-c> wow it doesn't error
<c-c> &>> class Zero; def initialize; Proc.new.call if block_given?; end; end; class One; def initialize; @y = Proc.new if block_given?; Zero.new? @y; end; One.new { p 0 }
<rubydoc> # => (https://carc.in/#/r/6d0k)
<phaul> syntax errors are not reported back correctly by the bot
<phaul> click on the links
<c-c> Weird! so it works if: class Zero; def initialize; Proc.new.call if block_given?; end; end; class One; def initialize; @y = Proc.new if block_given?; Zero.new &@y; end; end; One.new { p 0 }
nowhere_man has joined #ruby
gix has quit [Ping timeout: 244 seconds]
ellcs has quit [Ping timeout: 268 seconds]
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #ruby
mangold has quit [Ping timeout: 264 seconds]
t0xik has joined #ruby