Class: Standupguy::Report

Inherits:
Object
  • Object
show all
Includes:
DataMethods
Defined in:
lib/Standupguy.rb

Overview

Generic methods for all types of report.

Direct Known Subclasses

HTMLReport, TextReport

Instance Attribute Summary collapse

Instance Method Summary collapse

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_standupObject

Returns the value of attribute current_standup.



91
92
93
# File 'lib/Standupguy.rb', line 91

def current_standup
  @current_standup
end

#dateObject

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


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