Class: Gitomator::ServiceProvider::HostingLocal::ModelObject

Inherits:
Object
  • Object
show all
Defined in:
lib/gitomator/service_provider/hosting_local.rb

Overview

A small wrapper that takes a hash, and create an attr_accessor for each hash key. This is a temporary implementation, until we create proper model objects (e.g. HostedRepo, Team, PullRequest, etc.)

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ ModelObject

Returns a new instance of ModelObject.



20
21
22
23
24
25
26
# File 'lib/gitomator/service_provider/hosting_local.rb', line 20

def initialize(hash)
  hash.each do |key, value|
    setter = "#{key}="
    self.class.send(:attr_accessor, key) if !respond_to?(setter)
    send setter, value
  end
end