Skip to content

Support for options with "special" names like `option :end`

Compare
Choose a tag to compare
@nepalez nepalez released this 05 Nov 10:10

In this version we switched from key arguments to serialized hash in the initializer:

option :begin
option :end

In previous versions this was translated to

def initialize(begin:, end:)
  @begin = begin # WTF?!
  @end   = end   # BOOM!
end

Now the assignment is implemented like this:

def initialize(**__options__)
  @begin = __options__.fetch(:begin)
  @end   = __options__.fetch(:end)
end

As a side effect of the change the initializer becomes tolerant to any unknown option if, and only if some option was set explicitly.

Methods tolerant_to_unknown_options and intolerant_to_unknown_options are deprecated and will be removed in the next version of the gem.