Class: KanbanTool::Task

Inherits:
Object
  • Object
show all
Defined in:
lib/kanbantool/task.rb

Constant Summary collapse

FIELDS =
%w{ id name description created_at updated_at archived_at assigned_user }

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.create_from_hash(hash) ⇒ Object



7
8
9
10
11
# File 'lib/kanbantool/task.rb', line 7

def self.create_from_hash(hash)
  task = self.new
  task.load!(hash)
  task
end

Instance Method Details

#load!(hash) ⇒ Object



13
14
15
# File 'lib/kanbantool/task.rb', line 13

def load!(hash)
  FIELDS.each { |f| instance_variable_set("@#{f}".to_sym, hash[f]) }
end