Sha256: 196d5bf300495d64ecf794174b2bce10317d3211ca646a83363d6e9121ecbaa7

Contents?: true

Size: 290 Bytes

Versions: 27

Compression:

Stored size: 290 Bytes

Contents

module ISO3166
  class KwargStruct < Struct
    # Override the initialize to handle hashes of named parameters
    def initialize(*args)
      opts = args.last.is_a?(Hash) ? args.pop : {}
      super(*args)
      opts.each_pair do |k, v|
        send "#{k}=", v
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
countries-4.2.3 lib/countries/kwarg_struct.rb
countries-4.2.2 lib/countries/kwarg_struct.rb
countries-4.2.1 lib/countries/kwarg_struct.rb
countries-4.2.0 lib/countries/kwarg_struct.rb
countries-4.1.3 lib/countries/kwarg_struct.rb
countries-4.1.2 lib/countries/kwarg_struct.rb
countries-4.1.1 lib/countries/kwarg_struct.rb
countries-4.1.0 lib/countries/kwarg_struct.rb
countries-4.0.1 lib/countries/kwarg_struct.rb
countries-4.0.0 lib/countries/kwarg_struct.rb
countries-3.1.0 lib/countries/kwarg_struct.rb
countries-3.0.1 lib/countries/kwarg_struct.rb
countries-3.0.0 lib/countries/kwarg_struct.rb
countries-2.1.4 lib/countries/kwarg_struct.rb
countries-2.1.3 lib/countries/kwarg_struct.rb
countries-2.1.2 lib/countries/kwarg_struct.rb
countries-2.1.1 lib/countries/kwarg_struct.rb
countries-2.1.0 lib/countries/kwarg_struct.rb
countries-2.0.8 lib/countries/kwarg_struct.rb
countries-2.0.7 lib/countries/kwarg_struct.rb