Sha256: 7fc09206039a640ff1490c499087326291cf75c9744530ab7c3ef321be6da6b2

Contents?: true

Size: 301 Bytes

Versions: 3

Compression:

Stored size: 301 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 : Hash.new
      super(*args)
      opts.each_pair do |k, v|
        self.send "#{k}=", v
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
countries-2.0.0.rc lib/countries/kwarg_struct.rb
countries-2.0.0.pre.4 lib/countries/kwarg_struct.rb
countries-2.0.0.pre.3 lib/countries/kwarg_struct.rb