Class: Sly::Project
Instance Attribute Summary collapse
-
#admin ⇒ Object
Returns the value of attribute admin.
-
#archived ⇒ Object
Returns the value of attribute archived.
-
#id ⇒ Object
Returns the value of attribute id.
-
#items ⇒ Object
Returns the value of attribute items.
-
#name ⇒ Object
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
- #backlog ⇒ Object
- #complete ⇒ Object
- #current ⇒ Object
-
#initialize(project_attributes = {}) ⇒ Project
constructor
A new instance of Project.
- #save! ⇒ Object
- #to_s ⇒ Object
- #update ⇒ Object
Constructor Details
#initialize(project_attributes = {}) ⇒ Project
Returns a new instance of Project.
11 12 13 14 15 16 17 |
# File 'lib/sly/project.rb', line 11 def initialize(project_attributes = {}) @id = project_attributes["id"] @name = project_attributes["name"] @archived = project_attributes["archived"] @admin = project_attributes["admin"] @items = [] end |
Instance Attribute Details
#admin ⇒ Object
Returns the value of attribute admin.
9 10 11 |
# File 'lib/sly/project.rb', line 9 def admin @admin end |
#archived ⇒ Object
Returns the value of attribute archived.
9 10 11 |
# File 'lib/sly/project.rb', line 9 def archived @archived end |
#id ⇒ Object
Returns the value of attribute id.
9 10 11 |
# File 'lib/sly/project.rb', line 9 def id @id end |
#items ⇒ Object
Returns the value of attribute items.
9 10 11 |
# File 'lib/sly/project.rb', line 9 def items @items end |
#name ⇒ Object
Returns the value of attribute name.
9 10 11 |
# File 'lib/sly/project.rb', line 9 def name @name end |
Class Method Details
.load(file) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/sly/project.rb', line 27 def self.load(file) begin YAML::load(File.open(file)) rescue Exception => e raise "Unable to locate project file #{file}" end end |
Instance Method Details
#backlog ⇒ Object
45 46 47 |
# File 'lib/sly/project.rb', line 45 def backlog @items.select { |item| item.status == "backlog" } end |
#complete ⇒ Object
53 54 55 |
# File 'lib/sly/project.rb', line 53 def complete @items.select { |item| item.status == "complete" } end |
#current ⇒ Object
49 50 51 |
# File 'lib/sly/project.rb', line 49 def current @items.select { |item| item.status == "in-progress" } end |
#save! ⇒ Object
19 20 21 |
# File 'lib/sly/project.rb', line 19 def save! # Reserved for updating the API end |
#to_s ⇒ Object
23 24 25 |
# File 'lib/sly/project.rb', line 23 def to_s return "#{@id} - #{@name}" end |
#update ⇒ Object
35 36 37 38 39 40 41 42 43 |
# File 'lib/sly/project.rb', line 35 def update begin download_child_items save_child_items rescue Exception puts " Failed to connect to the Sprint.ly service, using last known values. ".colour(:white).background(:red) load_child_items end end |