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
<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).
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_>
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…]