Class: Checklister::Github::ProjectDecorator

Inherits:
Object
  • Object
show all
Defined in:
lib/checklister/github/project.rb

Instance Method Summary collapse

Constructor Details

#initialize(object) ⇒ ProjectDecorator

Returns a new instance of ProjectDecorator.



4
5
6
7
8
# File 'lib/checklister/github/project.rb', line 4

def initialize(object)
  @object = Checklister::Sanitizer.symbolize JSON.parse(object)
rescue TypeError
  @object = Checklister::Sanitizer.symbolize object
end

Instance Method Details

#descriptionObject



18
19
20
# File 'lib/checklister/github/project.rb', line 18

def description
  @object[:description]
end

#idObject



10
11
12
# File 'lib/checklister/github/project.rb', line 10

def id
  @object[:id]
end

#nameObject



14
15
16
# File 'lib/checklister/github/project.rb', line 14

def name
  @object[:full_name]
end

#to_hashObject



22
23
24
# File 'lib/checklister/github/project.rb', line 22

def to_hash
  { id: id, name: name, description: description }
end