Class: Standupguy::Report
- Inherits:
-
Object
- Object
- Standupguy::Report
- Includes:
- DataMethods
- Defined in:
- lib/Standupguy.rb
Overview
Generic methods for all types of report.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#current_standup ⇒ Object
Returns the value of attribute current_standup.
-
#date ⇒ Object
Returns the value of attribute date.
Instance Method Summary collapse
- #data(date = :all) ⇒ Object
-
#initialize(date = nil) ⇒ Report
constructor
A new instance of Report.
- #link ⇒ Object
- #template(file) ⇒ Object
Methods included from DataMethods
#date_key, #filename, #load_data, #write_data
Constructor Details
#initialize(date = nil) ⇒ Report
Returns a new instance of Report.
93 94 95 96 97 |
# File 'lib/Standupguy.rb', line 93 def initialize(date = nil) @current_standup = JSON.load(File.open(filename)) date ||= "ALL" @date = date == "ALL" ? :all : date_key(date) end |
Instance Attribute Details
#current_standup ⇒ Object
Returns the value of attribute current_standup.
91 92 93 |
# File 'lib/Standupguy.rb', line 91 def current_standup @current_standup end |
#date ⇒ Object
Returns the value of attribute date.
91 92 93 |
# File 'lib/Standupguy.rb', line 91 def date @date end |
Instance Method Details
#data(date = :all) ⇒ Object
109 110 111 112 113 |
# File 'lib/Standupguy.rb', line 109 def data(date = :all) scope = @current_standup scope = { date => @current_standup[date] } unless date == :all scope end |
#link ⇒ Object
99 100 101 |
# File 'lib/Standupguy.rb', line 99 def link "file:///#{file.path}" end |
#template(file) ⇒ Object
103 104 105 106 107 |
# File 'lib/Standupguy.rb', line 103 def template(file) spec = Gem::Specification.find_by_name("Standupguy") gem_root = spec.gem_dir File.read(File.join(gem_root, "lib", "Standupguy", file)) end |