Upgraded my Jekyll-based blog from Ruby 1.9.3 to 2.7.0 with just one minor dependency update 😮

If you want OptionParser to parse date arguments, you have to require "optparse/date" 🤨

I guess you could also do

private
attr_reader :blah

but I kind of like the more explicit style in this case.

Show thread

Anyone do

attr_reader :blah
private :blah

? Just occurred to me as a way to avoid `@blah` inside the class but also avoid exposing instance variables to the world.

I've updated the eligibility requirements for getting a free commercial license to DragonRuby Game Toolkit. The income eligibility has been relaxed. And I've added a bullet point for teachers, mentors, parents. You can read it all at dragonruby.org

Please boost <3

Ruby Easter egg 

Also I ran into an 'Easter egg' almost immediately... try pressing tab after `RubyVM` 😜 I guess they are trying to avoid exposing some internal Ruby guts in the auto-complete.

Show thread

Noooooo... Ruby! Why?! 😭

2.5.1 :001 > a = [1, 2, 3]
=> [1, 2, 3]
2.5.1 :002 > a [2]
=> 3
2.5.1 :003 > a [2] = 4
=> 4
2.5.1 :004 > a[2]
=> 4

(Note space before brackets)

RubyGems 3 released! blog.rubygems.org/2018/12/19/3

looks like Ruby 2.6 on Christmas is landing with RubyGems 3 and Bundler 2

Exciting!

Random Ruby performance tip: if you are using anything more complicated than strings/symbols for hash keys, you may want to consider caching their hash values (override the Object#hash method to do so).

I wrote up a blog post about how I found some easily-addressed performance issues in RubyParser: blog.presidentbeef.com/blog/20

Thanks to @zenspider as always for the great gem!

I need to remember this for writing weird Ruby:

def x a
yield a
end

x -> do
"hi"
end do |y|
puts y[]
end

git config --global diff.algorithm patience

Ahhhhh that's so much better.

Actually going to use REXML. Wish me luck. 👷

Show more
Ruby.social

A Mastodon instance for Rubyists & friends