adam12 changed the topic of #ruby to: Rules: https://ruby-community.com | Ruby 3.0.2, 2.7.4, 2.6.8: https://www.ruby-lang.org | Paste 4+ lines to: https://gist.github.com | Books: https://goo.gl/wpGhoQ
nemesit has quit [Ping timeout: 272 seconds]
gcd has quit [Remote host closed the connection]
wei1 has quit [Ping timeout: 256 seconds]
shokohsc has quit [Read error: Connection reset by peer]
shokohsc has joined #ruby
lunarkitty has joined #ruby
Oxfuxxx has quit [Read error: Connection reset by peer]
Oxfuxxx has joined #ruby
ur5us has quit [Ping timeout: 250 seconds]
ur5us has joined #ruby
xall has quit [Quit: Client closed]
vaillancourtmax has joined #ruby
gggp_ has joined #ruby
gggp_ has quit [Read error: Connection reset by peer]
gggp_ has joined #ruby
kaivai has quit [Quit: ZNC - https://znc.in]
kaivai has joined #ruby
lucf117 has quit [Ping timeout: 265 seconds]
pwnd_sfw has quit [Read error: Connection reset by peer]
pwnd_sfw has joined #ruby
lucf117 has joined #ruby
lucf117 has quit [Ping timeout: 272 seconds]
simao has quit [Quit: WeeChat 3.1]
Rounin has joined #ruby
neshpion has quit [Quit: neshpion]
vaillancourtmax has quit [Ping timeout: 240 seconds]
ua_ has quit [Excess Flood]
ua_ has joined #ruby
ur5us has quit [Ping timeout: 240 seconds]
gr33n7007h has quit [Quit: WeeChat 3.2]
_ht has joined #ruby
teclator has joined #ruby
lad has quit [Ping timeout: 240 seconds]
gggp_ is now known as gggp
yxhuvud has quit [Read error: Connection reset by peer]
yxhuvud has joined #ruby
lzap7 has joined #ruby
lzap7 is now known as lzap
gggp has quit [Read error: Connection reset by peer]
gggp has joined #ruby
drincruz_ has joined #ruby
Edward123 is now known as EdwardIII
drincruz_ has quit [Ping timeout: 265 seconds]
lunarkitty has quit [Quit: Connection closed for inactivity]
gggp has quit [Read error: Connection reset by peer]
fossdd has quit [Ping timeout: 240 seconds]
lunarkitty has joined #ruby
fossdd has joined #ruby
mrkz_c has quit [Quit: Connection closed for inactivity]
fossdd has quit [Ping timeout: 240 seconds]
fossdd has joined #ruby
gggp has joined #ruby
gggp has quit [Read error: Connection reset by peer]
fossdd has quit [Remote host closed the connection]
gggp has joined #ruby
gggp_ has joined #ruby
gggp has quit [Ping timeout: 265 seconds]
ur5us has joined #ruby
gggp_ has quit [Read error: Connection reset by peer]
ur5us has quit [Ping timeout: 272 seconds]
gggp has joined #ruby
gggp_ has joined #ruby
gggp has quit [Ping timeout: 258 seconds]
Oxfuxxx_ has joined #ruby
Oxfuxxx has quit [Ping timeout: 265 seconds]
drincruz_ has joined #ruby
gggp__ has joined #ruby
gggp_ has quit [Ping timeout: 272 seconds]
gggp has joined #ruby
gggp__ has quit [Ping timeout: 256 seconds]
gcd has joined #ruby
drincruz_ has quit [Ping timeout: 240 seconds]
Oxfuxxx has joined #ruby
Oxfuxxx has quit [Read error: Connection reset by peer]
lunarkitty has quit [Quit: Connection closed for inactivity]
Oxfuxxx_ has quit [Ping timeout: 258 seconds]
gggp_ has joined #ruby
Oxfuxxx has joined #ruby
TomyWork has joined #ruby
gggp has quit [Ping timeout: 272 seconds]
Oxfuxxx_ has joined #ruby
goepsilongo has quit [Quit: Konversation terminated!]
Oxfuxxx has quit [Ping timeout: 252 seconds]
drincruz_ has joined #ruby
Oxfuxxx_ has quit [Read error: Connection reset by peer]
Oxfuxxx has joined #ruby
Oxfuxxx_ has joined #ruby
Oxfuxxx has quit [Ping timeout: 272 seconds]
Oxfuxxx_ has quit [Read error: Connection reset by peer]
Oxfuxxx has joined #ruby
Oxfuxxx_ has joined #ruby
Oxfuxxx has quit [Ping timeout: 258 seconds]
Melantha has joined #ruby
gggp_ has quit [Read error: Connection reset by peer]
gggp has joined #ruby
wei1 has joined #ruby
qk1z has quit [Ping timeout: 265 seconds]
gggp_ has joined #ruby
gggp has quit [Ping timeout: 258 seconds]
gggp_ has quit [Read error: Connection reset by peer]
gggp_ has joined #ruby
crankharder has joined #ruby
Oxfuxxx_ has quit [Ping timeout: 272 seconds]
Oxfuxxx has joined #ruby
horribleprogram has joined #ruby
<horribleprogram> guys
<horribleprogram> new to Ruby
<horribleprogram> require "foo"
<horribleprogram> can someone take me through the sort of PATH this searches
<horribleprogram> also is there different sorts of "strings" such as "./foo" "/foo" etc?
<horribleprogram> also what is require "zlib" for example
<horribleprogram> is zlib a file that gets parsed and turned into a "module" object or some shit and all the top-level declarations are now part of the global scope of the file using that module
<horribleprogram> im familiar with both Python and the many JS import systems
<horribleprogram> so if y'all can explain how ruby imports things or link to a good resource I'd love that
<horribleprogram> s/how ruby imports things/how ruby imports things analogous to either python or JS/
<leah2> horribleprogram: look at $LOAD_PATH
<leah2> it tries that in order, and looks for foo.rb or foo.so (or foo.dll on windows maybe)
<leah2> as . is usually not in $LOAD_PATH, require "./foo" will do something else yes
<leah2> there is also require_relative
<leah2> the other thing to know is $LOADED_FEATURES, where require stores what it loaded
<leah2> and wont load it again if you require again
<leah2> and there is no module system else, it just loads the file in global scope
<horribleprogram> leah2: like an #include ?
<leah2> pretty much
<leah2> except for local variables
Oxfuxxx has quit [Read error: Connection reset by peer]
<horribleprogram> ahh kk
<leah2> but namespacing is done via module/class statements
<horribleprogram> yeah
<leah2> it does not need to correlate with file names (but is good to do ofc)
<horribleprogram> I notice that the stdlib has a good convention
<horribleprogram> "foo.rb" has a Foo class or w/e that namespaces all the top-level stuff
<leah2> not always, e.g. require 'strscan' adds StringScanner
<horribleprogram> ahh
<leah2> but that's legacy i guess :)
<horribleprogram> well I guess u can provide some sort of wrapper
<leah2> (also it's a gem now)
<horribleprogram> idk if require is a statement or expression... but u probably don't even need to use it
<horribleprogram> what's a GEM?
<horribleprogram> gem
<leah2> require is just a method
<leah2> gem is the packaging system of ruby
<leah2> like python pip or so
<horribleprogram> u don't use function call invocations tho
<horribleprogram> ahh kk
<leah2> you dont need () in ruby
<leah2> puts "foo" is also just a method call
<horribleprogram> AHHH
<leah2> :)
<horribleprogram> is there any difference
<horribleprogram> in terms of precedence
<leah2> yes
<horribleprogram> puts "foo".blah or puts("foo").blah
<horribleprogram> kk
<leah2> exactly
<leah2> the former calls .blah on "foo"
<horribleprogram> makes sense
<leah2> also with blocks it's different
<leah2> foo a, b, c do .. end
<leah2> is the same as foo(a,b,c) { .. }
<horribleprogram> kk last noob question
<horribleprogram> this absolute value syntax
<horribleprogram> |x|
<leah2> block arguments, yes
<horribleprogram> okay what's this
Oxfuxxx has joined #ruby
<leah2> lambda { |x| x*2 } in python would be lambda x: x*2
<leah2> so if you call it, it binds the value to the block argument
<leah2> lambda { |x| x*2 }.call(3) #=> 6
<horribleprogram> neat
<leah2> and you can pass one block to each method invocation
<leah2> so lambda is not a keyword either, but a method :D
<leah2> 3.times { |i| puts i }
<leah2> syntax looks a bit weird at first, but it's a cool feature imo
<horribleprogram> I see what it does I think
<horribleprogram> assuming 3.times does what I think it does
<leah2> it calls the block three times
<leah2> and passes the number of the run
<leah2> ["foo", "bar", "baz"].each { |x| puts x }
<leah2> that's how you do iteration in ruby
<horribleprogram> yeah like JS
<leah2> right
<horribleprogram> ur passing lambdas to methods
<leah2> except js always passes index
<leah2> in ruby you can use .each_with_index { |x,i| ... }
Oxfuxxx_ has joined #ruby
<horribleprogram> ahh
Oxfuxxx has quit [Ping timeout: 252 seconds]
<horribleprogram> ruby -r zlib -e "puts Zlib::Inflate.inflate(STDIN.read)
<horribleprogram> this is what I needed to do
<horribleprogram> lol
<horribleprogram> ARGF.read(65536) ?
<leah2> ARGF is a magic file handle that uses the files passed as arguments, or stdin
<leah2> i used this tool twice in the last 7 years :D
<horribleprogram> Git uses DEFLATE
<leah2> yeah
<horribleprogram> oh i see
<leah2> its like <> in perl, roughly
<horribleprogram> never used perl
<leah2> then disregard what i said :D
<horribleprogram> it's actually an incredibly stupid class or w/e it is
<leah2> it's a constant refering to a special IO thingy
<horribleprogram> STDIN is a constant?
<leah2> yes
<horribleprogram> as well?
<horribleprogram> kk but they are constant... classes no?
<horribleprogram> like unmodifiable objects
<leah2> >> STDIN
<leah2> => #<IO:<STDIN>>
<leah2> >> STDIN.class
<leah2> => IO
<leah2> they are instances of IO
<horribleprogram> kk
<horribleprogram> >> ARGF
<leah2> so you can .read etc
<leah2> yeah ARGF is a bit special :D
<horribleprogram> lol
<horribleprogram> yeah cuz I have an irb open
<horribleprogram> and the output of just the raw ARGF made no sense
<leah2> >> ARGF.class.ancestors
<leah2> => [ARGF.class, Enumerable, Object, PP::ObjectMixin, Kernel, BasicObject]
<horribleprogram> kk
<leah2> it's an instance of a class that has no name
<horribleprogram> also uk python right
<leah2> not very common
<horribleprogram> there's __repr__ and __str__
<leah2> a bit, yes
<horribleprogram> kk
<leah2> yes
<leah2> .inspect and .to_s i think
<horribleprogram> ty
<horribleprogram> output of irb is .to_s ?
<leah2> i think it's .inspect
<horribleprogram> kk
<horribleprogram> ur really nice and helpful btw tysm
<horribleprogram> I'ma stop harassing u and read the manual
<leah2> yw :)
<horribleprogram> LOL tysm tho
<horribleprogram> :)
<horribleprogram> take care
horribleprogram has left #ruby [#ruby]
gggp_ is now known as gggp
wei1 has quit [Ping timeout: 276 seconds]
vaillancourtmax has joined #ruby
nemesit has joined #ruby
jetchisel has joined #ruby
Tempesta has quit [Quit: See ya!]
Tempesta has joined #ruby
wei1 has joined #ruby
gggp_ has joined #ruby
gggp has quit [Ping timeout: 258 seconds]
gggp__ has joined #ruby
cahoots has joined #ruby
<cahoots> is there any function in the ruby standard library for doing a sliding window? e.g., [1, 2, 3, 4] -> [[1, 2], [2, 3], [3, 4]]
<leah2> .each_cons(2)
<cahoots> leah2, ty
gggp_ has quit [Ping timeout: 265 seconds]
teclator has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
vaillancourtmax has quit [Ping timeout: 256 seconds]
cahoots has quit [Ping timeout: 276 seconds]
wei1 has quit [Ping timeout: 265 seconds]
vaillancourtmax has joined #ruby
cahoots has joined #ruby
cahoots has quit [Ping timeout: 265 seconds]
wei1 has joined #ruby
cahoots has joined #ruby
orbyt has joined #ruby
cahoots has quit [Ping timeout: 252 seconds]
cahoots has joined #ruby
cahoots has quit [Ping timeout: 272 seconds]
cahoots has joined #ruby
cahoots has quit [Ping timeout: 256 seconds]
Synthead has joined #ruby
lad has joined #ruby
gggp__ is now known as gggp
ua_ has quit [Ping timeout: 258 seconds]
Synthbread has joined #ruby
Synthead has quit [Ping timeout: 272 seconds]
kapil has quit [Quit: ZNC 1.7.5+deb4 - https://znc.in]
ur5us has joined #ruby
kapil has joined #ruby
Synthmead has joined #ruby
Synthbread has quit [Ping timeout: 272 seconds]
vaillancourtmax has quit [Ping timeout: 265 seconds]
ur5us_ has joined #ruby
ur5us has quit [Read error: Connection reset by peer]
Synthmead has quit [Quit: Leaving]
crankharder has quit [Ping timeout: 240 seconds]
vaillancourtmax has joined #ruby
cahoots has joined #ruby
gggp has quit [Ping timeout: 272 seconds]
ur5us_ has quit [Ping timeout: 245 seconds]
crankharder has joined #ruby
vaillancourtmax has quit [Ping timeout: 272 seconds]
crankharder has quit [Ping timeout: 272 seconds]
TomyWork has quit [Quit: Leaving]
crankharder has joined #ruby
crankharder has quit [Ping timeout: 265 seconds]
crankharder has joined #ruby
ua_ has joined #ruby
_whitelogger has joined #ruby
vaillancourtmax has joined #ruby
_ht has quit [Remote host closed the connection]
crankharder has quit [Ping timeout: 250 seconds]
ua_ has quit [Ping timeout: 272 seconds]
ur5us_ has joined #ruby
vaillancourtmax has quit [Remote host closed the connection]
vaillancourtmax has joined #ruby
crankharder has joined #ruby
vaillancourtmax has quit [Ping timeout: 272 seconds]
crankharder has quit [Ping timeout: 250 seconds]
Guest94 has joined #ruby
Guest94 has quit [Client Quit]
crankharder has joined #ruby
crankharder has quit [Ping timeout: 240 seconds]
jetchisel has quit [Ping timeout: 272 seconds]
orbyt has quit [Quit: Textual IRC Client: www.textualapp.com]
neshpion has joined #ruby
crankharder has joined #ruby
cahoots has quit [Quit: leaving]
crankharder has quit [Ping timeout: 258 seconds]
orbyt has joined #ruby
wei1 has quit [Ping timeout: 258 seconds]
vaillancourtmax has joined #ruby
lunarkitty has joined #ruby
drincruz has joined #ruby
crankharder has joined #ruby
drincruz_ has quit [Ping timeout: 272 seconds]
va5c0 has joined #ruby
va5c0 has quit [Client Quit]
va5c0 has joined #ruby
wei1 has joined #ruby
drincruz_ has joined #ruby
orbyt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mrkz_c has joined #ruby
drincruz has quit [Ping timeout: 265 seconds]
pwnd_sfw has quit [Quit: Ping timeout (120 seconds)]
pwnd_sfw has joined #ruby
drincruz_ has quit [Ping timeout: 258 seconds]
wei1 has quit [Ping timeout: 265 seconds]
ua_ has joined #ruby
perrierjouet has quit [Quit: WeeChat 3.2]
wei1 has joined #ruby
va5c0 has quit [Quit: WeeChat 3.2]