havenwood changed the topic of #ruby to: Rules: https://ruby-community.com | Ruby 3.2.2, 3.1.4, 3.0.6, 3.3.0-preview1: https://www.ruby-lang.org | Paste 4+ lines to: https://gist.github.com | Books: https://t.ly/9ua4 | Logs: https://libera.irclog.whitequark.org/ruby/
moldorcoder7 has quit [Ping timeout: 268 seconds]
cherryramatis has quit [Quit: WeeChat 3.8]
Dooky has quit [Quit: Textual IRC Client: www.textualapp.com]
sickdyd has quit [Quit: WeeChat 3.8]
sickdyd has joined #ruby
crespire has joined #ruby
crespire1 has quit [Ping timeout: 256 seconds]
<Terminus> oof... rbst doesn't seem to support the `highlight` directive of rst. 🙁
caedmon has joined #ruby
<johnjaye> what's the most idiomatic ruby to copy stdin to stdout?
<johnjaye> i see this 'ARGF' thing mentioned a bit in results
caedmon has quit [Quit: caedmon]
caedmon1 has joined #ruby
<leftylink> well, ARGF would do more than what the question asks, since ARGF would make it be like unix cat(1), since it will also allow file names
caedmon1 has quit [Ping timeout: 264 seconds]
<johnjaye> yes i'm reading here it's a substitute for perl's diamond operator <>
<leftylink> if I were just copying stdin to stdout, I think I would just say `puts STDIN.read`
<johnjaye> i should probably figure out what that means in ruby
<johnjaye> oh wait do you use a different syntax for data fields?
<leftylink> I'm not sure what data fields means here
<johnjaye> like if Bob is an object how do you know Bob.foo refers to a function foo and not a data field foo
<johnjaye> because in ruby you can omit the () of function calls completely
<johnjaye> whereas in c/c++ land it's practically unheard of to do that for this reason
<leftylink> it's always a function. there are no cases where bob.foo can refer to an instance variable or anything other than a function
<johnjaye> is there a separate syntax in ruby
<leftylink> sure, instance variables have an @ in front. https://docs.ruby-lang.org/en/3.0/syntax/assignment_rdoc.html#label-Instance+Variables
<johnjaye> oh right.
<johnjaye> well i should probably work with them a little first then.
<johnjaye> are there any important reflection type things to know? i can check an objects methods with .methods()
<leftylink> I like Method#owner and Kernel#caller, but I see that I'm going off-topic since i didn't actually answer the question. Method#owner helps make sense of others' metaprogramming, and didn't have anything to do with reflection, so I failed to answer the question
<leftylink> so I guess Module#ancestors is the on-topic answer
crespire1 has joined #ruby
crespire has quit [Killed (NickServ (GHOST command used by crespire1!~crespire@user/crespire))]
Sankalp- has joined #ruby
Sankalp has quit [Ping timeout: 240 seconds]
Sankalp- is now known as Sankalp
<leftylink> hmm
<pandabot> Learned new fact rubynotation; 511 facts total
caedmon has joined #ruby
desnudopenguino1 has joined #ruby
desnudopenguino has quit [Ping timeout: 248 seconds]
desnudopenguino1 is now known as desnudopenguino
caedmon has quit [Ping timeout: 240 seconds]
ap4y has quit [Remote host closed the connection]
_ht has joined #ruby
grenierm has joined #ruby
caedmon has joined #ruby
caedmon has quit [Remote host closed the connection]
caedmon has joined #ruby
CrazyEddy has quit [Ping timeout: 248 seconds]
CrazyEddy has joined #ruby
caedmon has quit [Ping timeout: 256 seconds]
desnudopenguino1 has joined #ruby
caedmon has joined #ruby
desnudopenguino has quit [Ping timeout: 248 seconds]
desnudopenguino1 is now known as desnudopenguino
caedmon has quit [Ping timeout: 240 seconds]
caedmon has joined #ruby
jhass has quit [Ping timeout: 265 seconds]
jhass has joined #ruby
otisolsen70 has joined #ruby
ur5us has quit [Ping timeout: 240 seconds]
grenierm has quit [Quit: Client closed]
_ht has quit [Remote host closed the connection]
caedmon has quit [Read error: Connection reset by peer]
Linux_Kerio has joined #ruby
Linux_Kerio has quit [Ping timeout: 240 seconds]
grenierm has joined #ruby
teclator has joined #ruby
rvalue has quit [Ping timeout: 256 seconds]
rvalue has joined #ruby
ur5us has joined #ruby
swaggboi has quit [Ping timeout: 248 seconds]
swaggboi has joined #ruby
ur5us has quit [Ping timeout: 240 seconds]
grenierm has quit [Quit: Client closed]
infinityfye has joined #ruby
ur5us has joined #ruby
teclator has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
moldorcoder7 has joined #ruby
crespire1 has quit [Ping timeout: 248 seconds]
crespire1 has joined #ruby
teclator has joined #ruby
jvalleroy has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
TomyLobo has quit [Read error: Connection reset by peer]
jvalleroy has joined #ruby
BazzaBazaa has joined #ruby
<BazzaBazaa> Hi all, is there a way to test if a link exists on a html page with rspec?
Cork has joined #ruby
<isene> Hell! I fixed it. You can now paste onto the command line in rsh (https://github.com/isene/rsh)
<BazzaBazaa> wd
Sankalp has quit [Quit: ZNC 1.7.2+deb3 - https://znc.in]
<leftylink> well if it's a simple "does the substring exist" for rspec I would go with https://www.rubydoc.info/gems/rspec-expectations/RSpec%2FMatchers:include
<leftylink> but well if it needs to be able to deal with an arbitrarily complicated <a attr="val" attr="val" ref="tgt"> then dang
Sankalp has joined #ruby
Terminus has left #ruby [#ruby]
<BazzaBazaa> yeah, I'm hoping to test an autogenerated file. So after the html file is built I need to check that the correct links exist on the page.
<BazzaBazaa> test 1 is test the file is there, that passes, now I'm trying to work out how to test the content of the page that was generated
<isene> rsh is now a fairly functional shell. I'll be migrating from zsh in a couple of weeks (I think)
<isene> Done with less than 500 lines of code and in less than 20 hours. But it should prove a neat challenge to make all the features I want into it (basically replicating much of my zsh+antibody setup)
shokohsc2 has joined #ruby
shokohsc has quit [Ping timeout: 268 seconds]
shokohsc2 is now known as shokohsc
<BazzaBazaa> @isene you have a github link to the project?
<BazzaBazaa> thanks
BazzaBazaa has quit [Ping timeout: 245 seconds]
ur5us has quit [Ping timeout: 240 seconds]
BazzaBazaa has joined #ruby
<BazzaBazaa> can I use a require_relative call from inside an rspec test? I'm creating a page,then checking the content of the page
fercell has quit [Read error: Connection reset by peer]
BazzaBazaa has quit [Remote host closed the connection]
BazzaBazaa has joined #ruby
<BazzaBazaa> Hi, anyone knows about the require_all gem? Do I link it at the top of the code then reference the path in any tests I do?
<BazzaBazaa> so in an 'it' block I would reference the path?
<BazzaBazaa> for example top of file require 'require_all'
<BazzaBazaa> then reference the path at the top of the `it` block
<BazzaBazaa> for example: it 'can foobar' do ; require_all 'foo/folder'
<isene> How do I get the username "root" when a user has done `sudo -s` (as Etc.getlogin will only give the original user name)?
BazzaBazaa has quit [Remote host closed the connection]
BazzaBazaa has joined #ruby
BazzaBazaa has quit [Remote host closed the connection]
jess has quit []
donofrio has joined #ruby
<ccooke> isene: Generally you do not want to use Etc.getlogin for that - it's quite easy to fool (Check the docs for it)
<ccooke> Mechanically, what you want is to retrieve the EUID (Effective UID)
<ccooke> You can get that from Process.euid (That is: The effective UID of the currently-running process)
<ccooke> (And to get the name, something like Etc.getpwuid(Process.euid).name or the like
BazzaBazaa has joined #ruby
cek has joined #ruby
<cek> how do I obtain bearer token in oauth via ruby ?
<hexology> ruby newb here. does ruby have something like python where i can loop over lines of stdin without reading the entire thing into a string? `for line in sys.stdin: ...` -- python here will do its own internal buffering (as well as whatever the OS provides), but this can handle arbitrarily large or even infinite input streams. do i just loop with `gets`, or is there something nicer?
<llua> File.foreach
<hexology> so $stdin.foreach ?
<cek> print while gets
<hexology> i was just looking at https://docs.ruby-lang.org/en/3.2/IO.html#method-i-each_line as well
<hexology> oh, foreach is a class method and each_line is an instance method, is that right?
<cek> yes
<hexology> nice thank you :) $stdin.each_line { |line| puts "Input: #{line}" }
tomtmym has joined #ruby
tomtmym has joined #ruby
tomtmym has quit [Changing host]
BazzaBazaa has quit [Remote host closed the connection]
BazzaBazaa has joined #ruby
<cek> maybe use #each and chomp it, in ruby there are always several ways
<hexology> what would be the advantage of #each vs #each_line?
<cek> shorter
<hexology> heh
johnjaye has quit [Ping timeout: 248 seconds]
TomyWork has joined #ruby
<ox1eef_> pry-byebug
BazzaBazaa has quit [Ping timeout: 245 seconds]
caedmon has joined #ruby
BazzaBazaa has joined #ruby
infinity_fye has joined #ruby
sickdyd has quit [Ping timeout: 240 seconds]
infinityfye has quit [Killed (NickServ (GHOST command used by infinity_fye))]
infinity_fye is now known as infinityfye
johnjaye has joined #ruby
sickdyd has joined #ruby
sickdyd has quit [Ping timeout: 240 seconds]
BazzaBazaa has quit [Remote host closed the connection]
sickdyd has joined #ruby
sickdyd has quit [Ping timeout: 264 seconds]
teclator has quit [Ping timeout: 240 seconds]
_ht has joined #ruby
sickdyd has joined #ruby
cek has quit [Quit: Connection closed for inactivity]
mretka[p] has joined #ruby
caedmon has quit [Ping timeout: 240 seconds]
mretka[p] has left #ruby [#ruby]
temper57 has joined #ruby
mretka[p] has joined #ruby
sickdyd has quit [Ping timeout: 240 seconds]
mretka[p] has left #ruby [#ruby]
reset has quit [Quit: reset]
<isene> ccooke: Great. Thanks.
hightower2 has quit [Ping timeout: 240 seconds]
<johnjaye> hmm. why does str[0,-1] produce an empty string but str[0...-1] does not?
goldfish has joined #ruby
<leah2> because 0,-1 uses length -1
<johnjaye> i see
temper57 has quit [Ping timeout: 265 seconds]
lena64t has joined #ruby
Prodigy has joined #ruby
TomyWork has quit [Quit: Leaving]
sickdyd has joined #ruby
___nick___ has joined #ruby
___nick___ has quit [Client Quit]
___nick___ has joined #ruby
sickdyd has quit [Ping timeout: 268 seconds]
Sampersand has joined #ruby
sickdyd has joined #ruby
cek has joined #ruby
Prodigy has quit [Quit: WeeChat 3.8]
sickdyd has quit [Ping timeout: 240 seconds]
lena64t has quit [Ping timeout: 240 seconds]
lena64t has joined #ruby
_ht has quit [Remote host closed the connection]
___nick___ has quit [Ping timeout: 268 seconds]
Sampersand has quit [Quit: Client closed]
infinityfye has quit [Read error: Connection reset by peer]
bookworms has joined #ruby
tomtmym has quit [Quit: Gone.]
ur5us has joined #ruby
tempte90 has joined #ruby
brw has quit [Quit: The Lounge - https://thelounge.chat]
brw has joined #ruby
bookworms has left #ruby [Need to rub my bum along the carpet...]
sickdyd has joined #ruby
roadie has quit [Ping timeout: 248 seconds]
sickdyd has quit [Ping timeout: 265 seconds]
roadie has joined #ruby
otisolsen70 has quit [Quit: Leaving]
nmollerup has joined #ruby
ruby[bot] has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
Cache_Money has joined #ruby
shokohsc2 has joined #ruby
shokohsc has quit [Ping timeout: 256 seconds]
shokohsc2 is now known as shokohsc
tempte90 has quit [Ping timeout: 256 seconds]
sickdyd has joined #ruby
hightower2 has joined #ruby
sickdyd has quit [Ping timeout: 248 seconds]
johnjaye has quit [Ping timeout: 268 seconds]
johnjaye has joined #ruby
sickdyd has joined #ruby
CalculusCats has quit [Quit: Meow Meow Meow Meow Meow Meow Meow Meow]
CalculusCats has joined #ruby
ap4y has joined #ruby
ur5us has quit [Remote host closed the connection]
ur5us has joined #ruby
ur5us has quit [Remote host closed the connection]
ur5us has joined #ruby