havenwood changed the topic of #ruby to: Ruby 3.2.2, 3.1.4, 3.3.0-preview1: https://www.ruby-lang.org | Rules: https://ruby-community.com | Logs: https://libera.irclog.whitequark.org/ruby
goldfish has quit [Remote host closed the connection]
ur5us has quit [Ping timeout: 272 seconds]
diagnostics0 has joined #ruby
MarvelousWololo has quit [Ping timeout: 264 seconds]
ur5us has joined #ruby
caedmon has quit [Quit: caedmon]
caedmon has joined #ruby
diagnostics0 has quit [Ping timeout: 272 seconds]
TomyLobo2 has quit [Read error: Connection reset by peer]
caedmon has quit [Ping timeout: 264 seconds]
keypresser86_ has quit []
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
caedmon has joined #ruby
c10l64 has joined #ruby
c10l6 has quit [Ping timeout: 264 seconds]
c10l64 is now known as c10l6
caedmon has quit [Ping timeout: 246 seconds]
octobear has quit [Ping timeout: 240 seconds]
caedmon has joined #ruby
caedmon has quit [Ping timeout: 245 seconds]
Linux_Kerio has joined #ruby
ur5us has quit [Quit: Leaving]
caedmon has joined #ruby
Guest39 has joined #ruby
<Guest39> hi
reset has quit [Quit: reset]
_ht has joined #ruby
octobear has joined #ruby
Guest39 has quit [Quit: Client closed]
weaksauce has quit [Ping timeout: 246 seconds]
weaksauce has joined #ruby
caedmon has quit [Ping timeout: 272 seconds]
orgasm has joined #ruby
Norway4 has joined #ruby
orgasm has quit [Ping timeout: 272 seconds]
casser has joined #ruby
Norway4 has quit [Ping timeout: 272 seconds]
casser has quit [Ping timeout: 245 seconds]
grenierm has joined #ruby
oktober_ has joined #ruby
octobear has quit [Ping timeout: 245 seconds]
_ht has quit [Quit: _ht]
MarvelousWololo has joined #ruby
MarvelousWololo has quit [Read error: Connection reset by peer]
oktober_ is now known as octobear
MarvelousWololo has joined #ruby
MarvelousWololo has quit [Read error: Connection reset by peer]
rvalue has quit [Ping timeout: 246 seconds]
sam113101 has quit [Ping timeout: 245 seconds]
sam113101 has joined #ruby
teclator has joined #ruby
infinityfye has joined #ruby
rvalue has joined #ruby
tomtmym has joined #ruby
tomtmym has joined #ruby
tomtmym has quit [Changing host]
Linux_Kerio has quit [Ping timeout: 272 seconds]
TomyWork has joined #ruby
mark22k has quit [Quit: The Lounge - https://thelounge.chat]
mark22k has joined #ruby
gh0st6 has joined #ruby
duderonomy has quit [Quit: Textual IRC Client: www.textualapp.com]
rvalue has quit [Ping timeout: 246 seconds]
jvalleroy has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
nmollerup has quit [Ping timeout: 258 seconds]
jvalleroy has joined #ruby
rvalue has joined #ruby
crespire has quit [Killed (NickServ (GHOST command used by crespire1))]
crespire1 has joined #ruby
Thanzex has joined #ruby
nmollerup has joined #ruby
nmollerup has quit [Remote host closed the connection]
nmollerup has joined #ruby
nmollerup has quit [Remote host closed the connection]
grenierm has quit [Ping timeout: 246 seconds]
shokohsc53 has joined #ruby
shokohsc5 has quit [Ping timeout: 272 seconds]
shokohsc53 is now known as shokohsc5
Sankalp- has joined #ruby
Sankalp has quit [Ping timeout: 264 seconds]
Sankalp- is now known as Sankalp
mexen has joined #ruby
rvalue has quit [Ping timeout: 245 seconds]
rvalue has joined #ruby
placen has joined #ruby
gh0st6 has quit [Quit: Connection closed for inactivity]
moron has joined #ruby
placen has quit [Ping timeout: 272 seconds]
widene has joined #ruby
moron has quit [Ping timeout: 245 seconds]
moron has joined #ruby
widene has quit [Ping timeout: 272 seconds]
moron has quit [Ping timeout: 272 seconds]
<isene> I did a thorough overhaul of my ruby curses extension (https://github.com/isene/Ruby-Curses-Class-Extension). Feedback is very welcome. Now - how do I make this extension "includable" in the best way?
<isene> ... as a gem that is
reset has joined #ruby
user23 has joined #ruby
user23_ has joined #ruby
user23 has quit [Ping timeout: 246 seconds]
user23_ has quit [Remote host closed the connection]
<ox1eef_> How do you make a gem?
Linux_Kerio has joined #ruby
<aesthetikx> ox1eef_ check out 'man bundle gem'
mexen has quit [Quit: Connection closed for inactivity]
<ox1eef_> Sorry for the confusion - I was asking isene if that was his question.
<aesthetikx> Oh I was like, I've seen you around here before, I figured you'd know that haha
<ox1eef_> xD
rvalue has quit [Ping timeout: 272 seconds]
rvalue has joined #ruby
<isene> I know how to make gems 🤗
<isene> My question; is there anything I need to do/add to make it so that when someone does 'require' my curses extension it will actually extend the Curses::Window module?
caedmon has joined #ruby
MarvelousWololo has joined #ruby
<ox1eef_> If Curses::Window belongs to another project, then require "mygem/core_ext/curses/window" is a common approach to opt into monkey patches.
pi2 is now known as johnjaye
polishdub has joined #ruby
passbe has quit [Quit: bye...]
passbe has joined #ruby
eddof13 has joined #ruby
eddof13 has quit [Client Quit]
nmollerup has joined #ruby
eddof13 has joined #ruby
octobear has quit [Remote host closed the connection]
<johnjaye> can you do arbitrary operator stuff in ruby?
<johnjaye> i'm looking at this code and it says prompt.start_with?('t8') then and it says prompt[/t8 ... /]
<johnjaye> or is [] overloaded by default for strings to do something
<adam12> johnjaye: you can overload []
<adam12> or rather, define it.
<johnjaye> ok
<adam12> (it's not necessarily an overload)
<johnjaye> well it is applying it to strings
<adam12> johnjaye: Yes, that is true.
<adam12> It's just another method tho.
<johnjaye> holy crap you can call string[regexp]
<johnjaye> amazing
<adam12> Ruby does some magic to make prompt[value] into prompt.send(:[], value).
<johnjaye> it returns the matched substring or nil
<johnjaye> oh this is some kind of trick
<adam12> You can pass match indexes to it too
<johnjaye> well, it's a very nice one if so
<adam12> string[/regexp/, match]
<adam12> Which is nice.
<johnjaye> matching like subexpressions?
<adam12> johnjaye: Regex capture groups
<adam12> >> "Adam (adam12)"[/\w+ \((.+)\)/, 1]
<ruby[bot]> adam12: # => (https://carc.in/#/r/fh54)
<adam12> (that would have matched and returned adam12)
<johnjaye> i see
<johnjaye> >> "abcd"[\(a\)\(b\),2]
<ruby[bot]> johnjaye: # => (https://carc.in/#/r/fh55)
<johnjaye> hmm, i can't load that for some reaosn
<adam12> I escaped the parens since it was in the string but you wouldn't have to.
<adam12> "abcd"[/(a)(b)/,2]
<adam12> carc.in seems broken
<johnjaye> oh i see, i get the right answer now
<johnjaye> is prompt.send(:[],value) the more regular syntax?
kenichi_ is now known as kenichi
<johnjaye> by the way, unrelated, but why does ruby define a constant as starting with a capital letter
kenichi has quit [Changing host]
kenichi has joined #ruby
<johnjaye> as opposed to all caps. like CONSTANT
<johnjaye> in the code i've seen so far people usually don't put their constants like Constant123
<adam12> johnjaye: Well, everything in Ruby is essentially a message to an object (the root of OO), but Ruby adds some syntatic sugar over some common expressions.
<adam12> I wouldn't reach for prompt.send(:[], value) if I could use prompt[value], but you can see how Ruby behind the scenes does the translation for us. Which is essentially, send [] method to prompt with value as an argument.
<johnjaye> oh, the : is denoting it's an operator?
<adam12> It's a symbol.
<adam12> It's just the method name as a symbol.
<johnjaye> oh so it's escaping it
<johnjaye> so it doesn't interpret it as []
<adam12> Ruby generally uses camelcase for classes and screaming case for constants.
<adam12> But you can use either/or mixmatched if you want. Ruby won't stop you.
<johnjaye> ok. because at the irb if I say Var = 2 it then warns me if i change it
<johnjaye> but in code it's always VAR or STR
<adam12> But it helps to anchor the language in a way to make it easier to understand. If I look at CONSTANT_123 it's likely not an initializable/includable object from the Module ancestor tree.
<adam12> Well yes, constants are defined differently, and you shoudln't redefine constants.
<adam12> so saying Var = 2 is setting a constant, then you go back and change it, making it not a constant in it's simplest form (something that doesn't change).
FetidToot has quit [Quit: The Lounge - https://thelounge.chat]
FetidToot has joined #ruby
dionysus69 has joined #ruby
_ht has joined #ruby
Manouchehri____ has quit []
teclator has quit [Ping timeout: 252 seconds]
Manouchehri has joined #ruby
xuochi has joined #ruby
caedmon has quit [Ping timeout: 272 seconds]
caedmon has joined #ruby
caedmon has quit [Ping timeout: 240 seconds]
graywolf has joined #ruby
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
eddof13 has joined #ruby
duderonomy has joined #ruby
goldfish has joined #ruby
___nick___ has joined #ruby
caedmon has joined #ruby
caedmon has quit [Ping timeout: 245 seconds]
graywolf has quit [Quit: WeeChat 4.0.0]
user23 has joined #ruby
___nick___ has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
___nick___ has joined #ruby
___nick___ has quit [Client Quit]
___nick___ has joined #ruby
xuochi has quit [Quit: leaving]
user23 has quit [Ping timeout: 246 seconds]
dionysus69 has quit [Quit: dionysus69]
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rvalue has quit [Ping timeout: 250 seconds]
infinityfye has quit [Quit: Leaving]
reset has quit [Quit: reset]
rvalue has joined #ruby
caedmon has joined #ruby
caedmon has quit [Ping timeout: 240 seconds]
John_Ivan__ has quit [Quit: Disrupting the dragon's slumber one time too often shall eventually bestow upon all an empirical and indiscriminate conflagration that will last for all goddamn eternity.]
<adam12> ox1eef_: Your Rack issue about Rack::Etag... are you using Rack::Files/Rack::Static with that
<adam12> I'm kind of surprised that Rack::Static and Rack::ETag don't seem to work together, but maybe they never were supposed to.
<ox1eef_> adam12: Negative. I wrote my own rack app to servie the static files.
<adam12> I wonder if this is the same issue. I'm assuming Rack::File::Iterator is an enumerable of some sort.
<ox1eef_> If the body implements #to_path, I believe Rack takes care of serving the response body.
<adam12> Hmm. It does, and Rack doesn't.
<adam12> (ruby) body.to_path
<adam12> "/app/public/builds/web.css"
<adam12> false
<adam12> (ruby) etag_body?(body)
<adam12> (inside the ETag #call method)
<adam12> Annoying. Oh well. Maybe debug this later.
<ox1eef_> Is the etag not being sent ?
<adam12> Not on anything served from Rack::Static (Rack::Files)
<adam12> I get it on anything served via app as a plain string
TomyWork has quit [Remote host closed the connection]
<ox1eef_> The body must implement to_ary - and Enumerator does not impllement that method. So you must call to_a, and then the etag should be sent.
<ox1eef_> I got the impresion it is not really designed for static files, but dynamic web requests (eg Rails)
<ox1eef_> Another issue I had with it is that it will not really cache the response. It goes through the same codepath and includes the entire response body. So I did this: https://gist.github.com/0x1eef/38dcf9b1fa1352dba5fc8fa4d532e415
_ht has quit [Quit: _ht]
___nick___ has quit [Ping timeout: 272 seconds]
<ox1eef_> It also uses a weak etag - so the checksum is based on partial content rather than a strict checksum of the entire body. Another thing to be conscious of.
keypresser86 has joined #ruby
<adam12> ox1eef_: Ah, good to know. Thanks.
<ox1eef_> I considered not using it at one point, and rolling my own. But it is good enough for my use-case.
dnadev2 has joined #ruby
dnadev2 has quit [Ping timeout: 272 seconds]
shokohsc50 has joined #ruby
shokohsc5 has quit [Ping timeout: 272 seconds]
shokohsc50 is now known as shokohsc5
John_Ivan has joined #ruby
tomtmym has quit [Quit: Gone.]
goldfish has quit [Read error: Connection reset by peer]
goldfish has joined #ruby
gr33n7007h has quit [Ping timeout: 272 seconds]
gr33n7007h has joined #ruby
gr33n7007h has quit [Ping timeout: 272 seconds]
gr33n7007h has joined #ruby
ruby[bot] has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
hrberg has quit [Ping timeout: 245 seconds]
hrberg has joined #ruby
eddof13 has joined #ruby
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Braill24 has joined #ruby
MarvelousWololo has quit [Ping timeout: 264 seconds]
Linux_Kerio has quit [Ping timeout: 246 seconds]
diagnostics0 has joined #ruby
goldfish has quit [Ping timeout: 245 seconds]
diagnostics0 has quit [Ping timeout: 272 seconds]
eddof13 has joined #ruby
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
eddof13 has joined #ruby