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(status = nil) ⇒ Object
Constructor Details
#initialize(project_attributes = {}) ⇒ Project
Returns a new instance of Project.
11 12 13 14 15 16 17 18 19 |
# 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 = { 'backlog' => [], 'in-progress' => [], 'completed' => [], 'accepted' => [] } 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
29 30 31 32 33 34 35 |
# File 'lib/sly/project.rb', line 29 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
50 51 52 |
# File 'lib/sly/project.rb', line 50 def backlog @items['backlog'] end |
#complete ⇒ Object
58 59 60 |
# File 'lib/sly/project.rb', line 58 def complete @items['completed'] end |
#current ⇒ Object
54 55 56 |
# File 'lib/sly/project.rb', line 54 def current @items['in-progress'] end |
#save! ⇒ Object
21 22 23 |
# File 'lib/sly/project.rb', line 21 def save! # Reserved for updating the API end |
#to_s ⇒ Object
25 26 27 |
# File 'lib/sly/project.rb', line 25 def to_s return "#{@id} - #{@name}" end |
#update(status = nil) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/sly/project.rb', line 37 def update(status = nil) load_state rescue nil begin download_child_items(status) save_state rescue Exception => e puts e. puts e.backtrace puts " Failed to connect to the Sprint.ly service, using last known values. ".colour(:white).background(:red) load_state end end |