Module: OpenStates::Model

Included in:
Bill, Committee, District, Event, Legislator
Defined in:
lib/openstates/model.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



3
4
5
# File 'lib/openstates/model.rb', line 3

def self.included(base)
  base.extend ClassMethods
end

Instance Method Details

#populate_from_hash!(hash) ⇒ Object



51
52
53
54
55
56
57
58
59
60
61
# File 'lib/openstates/model.rb', line 51

def populate_from_hash!(hash)
  return unless hash

  hash.each do |key, value|
    next if value.nil?

    set_attr_method = "#{key}="

    __send__(set_attr_method, value) if respond_to?(set_attr_method)
  end
end