Module: Widgeo::Model

Included in:
Continent, Territory
Defined in:
lib/widgeo/model.rb

Overview

Work with an entity

Instance Method Summary collapse

Instance Method Details

#initialize(properties) ⇒ Object

Set attributes on the instance



7
8
9
10
11
12
13
14
# File 'lib/widgeo/model.rb', line 7

def initialize(properties)
  properties.each do |name, value|
    # Raise an exception if we don't have a getter for the property
    raise UndefinedFieldError unless respond_to? name

    instance_variable_set(:"@#{name}", value)
  end
end