Module: HashWrapper

Included in:
ISO10383, ISO3166, ISO4217
Defined in:
lib/divISOr/hash_wrapper.rb

Class Method Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



14
15
16
17
# File 'lib/divISOr/hash_wrapper.rb', line 14

def method_missing(method, *args, &block)
  super unless self.class::FIELDS.include?(method)
  data[method].to_s
end

Class Method Details

.included(base) ⇒ Object



2
3
4
# File 'lib/divISOr/hash_wrapper.rb', line 2

def self.included(base)
  base.send(:attr_reader,:data)
end

Instance Method Details

#==(object) ⇒ Object



10
11
12
# File 'lib/divISOr/hash_wrapper.rb', line 10

def ==(object)
  @data == object.data
end

#initialize(data) ⇒ Object



6
7
8
# File 'lib/divISOr/hash_wrapper.rb', line 6

def initialize(data)
  @data = data
end