Class: ISO3166::KwargStruct

Inherits:
Struct
  • Object
show all
Defined in:
lib/countries/kwarg_struct.rb

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ KwargStruct

Override the initialize to handle hashes of named parameters



4
5
6
7
8
9
10
# File 'lib/countries/kwarg_struct.rb', line 4

def initialize(*args)
  opts = args.last.is_a?(Hash) ? args.pop : {}
  super(*args)
  opts.each_pair do |k, v|
    send "#{k}=", v
  end
end