Class: TimeCrunch::TimeCard
- Inherits:
-
Object
- Object
- TimeCrunch::TimeCard
- Defined in:
- lib/time_crunch/time_card.rb
Instance Attribute Summary collapse
-
#employee ⇒ Object
readonly
Returns the value of attribute employee.
-
#time_entries ⇒ Object
Returns the value of attribute time_entries.
Instance Method Summary collapse
-
#initialize(time_entries) ⇒ TimeCard
constructor
A new instance of TimeCard.
- #total ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(time_entries) ⇒ TimeCard
Returns a new instance of TimeCard.
6 7 8 9 10 |
# File 'lib/time_crunch/time_card.rb', line 6 def initialize(time_entries) raise 'All time entries must belong to same employee' unless time_entries.uniq(&:employee).one? @employee = time_entries.first.employee @time_entries = time_entries.sort end |
Instance Attribute Details
#employee ⇒ Object (readonly)
Returns the value of attribute employee.
4 5 6 |
# File 'lib/time_crunch/time_card.rb', line 4 def employee @employee end |
#time_entries ⇒ Object
Returns the value of attribute time_entries.
3 4 5 |
# File 'lib/time_crunch/time_card.rb', line 3 def time_entries @time_entries end |
Instance Method Details
#total ⇒ Object
16 17 18 |
# File 'lib/time_crunch/time_card.rb', line 16 def total # TODO end |
#valid? ⇒ Boolean
12 13 14 |
# File 'lib/time_crunch/time_card.rb', line 12 def valid? # TODO end |