jmcgnh has quit [Read error: Connection reset by peer]
jmcgnh has joined #ruby
davispuh has joined #ruby
<havenwood>
apotheon: I've been enjoying Solargraph with my editor lately, which takes some prodding to get working with gems but it's pretty fun. What excited me is a demo Soutaro gave last week with Steep working alongside Ruby::Signature and an editor.
<bougyman>
it's a hack so that the shebang is /bin/sh but because of the way python's ''' string thing works, sh execs the thing as 'whatever python shows up in which'
<bougyman>
is there a similar hack for ruby that I just can't figure out?
<bougyman>
(other than then using python to exec some ruby)
<bougyman>
which would be too many layers of inception for me to handle.
<bougyman>
that is, bash execs it with python, then python ignores those two line.
<bougyman>
*lines.
postmodern has joined #ruby
wildtrees has quit [Quit: Leaving]
ianbrown78 has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ianbrown78 has quit [Ping timeout: 255 seconds]
gix has quit [Ping timeout: 256 seconds]
ianbrown78 has joined #ruby
_whitelogger has joined #ruby
ianbrown78 has quit [Ping timeout: 265 seconds]
ianbrown78 has joined #ruby
cnsvc has quit [Ping timeout: 240 seconds]
chalkmonster has quit [Ping timeout: 256 seconds]
ianbrown78 has quit [Ping timeout: 260 seconds]
chalkmonster has joined #ruby
ianbrown78 has joined #ruby
roadie has joined #ruby
<bougyman>
can even do `which mawk || which awk` there. Nice!
cnsvc has joined #ruby
szqdsegrhrdgdrg has joined #ruby
<bougyman>
found it in awk
<szqdsegrhrdgdrg>
hi
<szqdsegrhrdgdrg>
How to destroy an object ?
<bougyman>
an instance of an object?
<szqdsegrhrdgdrg>
an instance of a class
<bougyman>
just set all references to nil and when the gc runs it'll go away
<apotheon>
havenwood: interesting
<apotheon>
havenwood: I'll look up all that stuff.
<szqdsegrhrdgdrg>
I have the object "user" I want to completely destroy it
<bougyman>
what kind of object is it?
<bougyman>
I guess I need to know what you mean by destroy
<bougyman>
I assume you mean "remove from ram"
<szqdsegrhrdgdrg>
yes
<bougyman>
when it's not referenced anymore, it will be garbage collected.
pupsikov has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
gix has joined #ruby
TheBrayn has quit [Quit: poof]
dinfuehr has quit [Ping timeout: 256 seconds]
mre- has joined #ruby
dinfuehr has joined #ruby
TotalFail has joined #ruby
TotalFail is now known as T0talFa1l
dinfuehr has quit [Ping timeout: 240 seconds]
mre- has quit [Ping timeout: 260 seconds]
dinfuehr has joined #ruby
weird_error has quit [Quit: weird_error]
ldepandis has joined #ruby
dinfuehr has quit [Ping timeout: 255 seconds]
dinfuehr has joined #ruby
bvdw has quit [Quit: bvdw]
bvdw has joined #ruby
alfiemax has joined #ruby
pupsikov has joined #ruby
mre- has joined #ruby
troulouliou_div2 has joined #ruby
mre- has quit [Ping timeout: 260 seconds]
mre- has joined #ruby
kinduff has quit [Read error: Connection reset by peer]
kinduff has joined #ruby
Bounga has quit [Read error: Connection reset by peer]
TomyLobo2 has quit [Ping timeout: 256 seconds]
<TzilTzal>
Is there a good way to emulate enums in Ruby? (without Rails, preferably)
<adam12>
TzilTzal: What's your use case?
<TzilTzal>
That I'd like some value represented by a set of enums.
<TzilTzal>
)
alfiemax has quit [Remote host closed the connection]
<TzilTzal>
Some like a country, for instance.
<adam12>
TzilTzal: You could use a Set. It's not exactly an enum but Set is in stdlib and might get you close.
<havenwood>
TzilTzal: Show how you'll use it?
<TzilTzal>
havenwood: I'd just like a set of symbols (e.g. :usa, :canada, :uk, etc...). One class will have a attr_accessor called 'country' that should hold this enum/symbols.
<havenwood>
TzilTzal: And then you'll be checking for inclusion in the set, or other things?
<TzilTzal>
well, some logic might be based on the symbol.
Ven`` has joined #ruby
royal_screwup21 has quit [Remote host closed the connection]
<havenwood>
TzilTzal: Indexes don't matter for your usecase?
<TzilTzal>
Indices in the set?
RougeR has quit [Read error: Connection reset by peer]
<TzilTzal>
No.
RougeR has joined #ruby
booboy has joined #ruby
dionysus69 has joined #ruby
<havenwood>
TzilTzal: Are you adding to the list at runtime, or it's fixed?
<TzilTzal>
Fixed.
<havenwood>
TzilTzal: Array, Set or SortedSet (with or without rbtree/rbtree3) are all perfectly fine options.
<havenwood>
TzilTzal: Array will be slower to check inclusion once you get into the thousands of members.
<havenwood>
TzilTzal: I'd probably just use a frozen Array constant.
mre- has quit [Ping timeout: 265 seconds]
<havenwood>
TzilTzal: As you get into the millions of members, Array falls hopelessly behind, thousands of times slower.
<havenwood>
TzilTzal: With a few members, it just doesn't matter.
<havenwood>
TzilTzal: ~2,000x slower for 1M, ~1,000x slower for 10K, ~100x slower for 1K, ~4x slower for 100, about the same for 10.
<havenwood>
TzilTzal: TL;DR: If it's a big set, use Set or SortedSet. If it's a small one, Array is perfectly fine.
<havenwood>
TzilTzal: Freeze it and use a constant, in any case.
RougeR has quit [Read error: Connection reset by peer]
RougeR has joined #ruby
Macrobiotic has quit [Quit: Connection closed for inactivity]
s3nd1v0g1us has joined #ruby
ur5us has quit [Ping timeout: 256 seconds]
mheld has joined #ruby
hutch has joined #ruby
pupsikov has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
hutch has quit [Ping timeout: 272 seconds]
pupsikov has joined #ruby
ur5us has joined #ruby
<leitz>
havenwood, the market, and the privacy, are one thing. However, it sets a terrible precedent; that an entity can dictate what those outside it's jurisdiction must do. If someone from Cali gives away their private info, that's on them.
<leitz>
They have the ability to not have their info shared; don't give it to anyone.
<havenwood>
leitz: There are tons of things you can't bargain away, due to a legal minimum. Privacy is now one of them. It only didn't used to be because it wasn't *possible* to violate it so egregiously.
<havenwood>
leitz: We should probably continue discussion in #ruby-offtopic, since Ruby isn't involved here.
<leitz>
Hehe, yeah. I'm going to step away from the computer, it's been a plbbght day.
<leitz>
I did get my Ruby updated, though. So it's a win.
<havenwood>
leitz: Nice!
<leitz>
Actually, an actual Ruby question for the masters in the house.
* leitz
eyes havenwood and adam12, amoungst others.
<leitz>
Some time back I did a short term mentoring thing. I'm thinking of doing it again, this time with a small Ruby project. The target is people who have some Ruby skill, but not a lot of project experience.
renich has joined #ruby
<leitz>
There are a couple of ways you (plural) could help. 1. Review my project and let me know what's done in "bad practice". I don't want others to learn that.
<havenwood>
1. Happy to review and give feedback.
<leitz>
2. Be available when folks ask questions. That's something you already do well, and it's really helpful.
<leitz>
And in full disclosure, I'm using mentoring to push myself to get better. I've been an Apprentice for a couple of decades, in a few languages. It's time to get better, and deeper, at one thing.
<havenwood>
2. If the questions are here, happy to answer. I can't commit to other channels. Maybe have a bot that proxies questions for folk to answer here?
<leitz>
havenwood, nyah. I'll send folks here. They can look things up if they want, but here has a high signal to noise ratio.
<havenwood>
leitz: I like the idea of learning while helping answer questions. That seems to be a good way to learn.
<havenwood>
leitz: Use something more descriptive than single char variables like `o` if you can.
<havenwood>
leitz: Capitalization seems suspect, but I guess that works for your roles?
<leitz>
I tend to use Hash.new as an easy "grep" pattern to look for things. The shell gets iffy with special characters. :)
<havenwood>
leitz: The grepping difficulty is worth the increased speed and readability.
<havenwood>
leitz: It's not that hard to grep for {}.
<havenwood>
leitz: Also, why are you grep'n {}.
<havenwood>
leitz: Use {}.
<leitz>
On multi-line {}, that's because I use vim. It helps me make sure I balance them.
<havenwood>
leitz: It's folly to use Hash.new for empty hashes or anything other than providing arguments or a block to Hash.new.
<havenwood>
leitz: Ruby itself uses the Hash literal, every major library uses the Hash literal. It's a performance hit every time you create a Hash to do it like you do.
<havenwood>
leitz: You can provide an `into: opts` keyword argument to #parse!
<havenwood>
leitz: The simplify your parser to: options.on '-r', '--role=ROLE', 'Role for the character'
<havenwood>
(no block)
mre- has quit [Ping timeout: 265 seconds]
phaul has quit [Ping timeout: 260 seconds]
<havenwood>
leitz: You can drop the Hash literal here, and use a "naked Hash."