Class: Gitomator::ServiceProvider::HostingLocal::ModelObject
- Inherits:
-
Object
- Object
- Gitomator::ServiceProvider::HostingLocal::ModelObject
- 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
-
#initialize(hash) ⇒ ModelObject
constructor
A new instance of ModelObject.
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 |