Class: Weesked::Day
- Inherits:
-
Object
- Object
- Weesked::Day
- Defined in:
- lib/weesked/day.rb
Instance Attribute Summary collapse
-
#day ⇒ Object
readonly
Returns the value of attribute day.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(day, steps = []) ⇒ Day
constructor
A new instance of Day.
- #steps ⇒ Object
Constructor Details
#initialize(day, steps = []) ⇒ Day
Returns a new instance of Day.
10 11 12 13 14 15 16 17 18 |
# File 'lib/weesked/day.rb', line 10 def initialize(day, steps=[]) @steps = steps @day = if day.kind_of?(Integer) Weesked.availiable_days.fetch(day.to_i).to_sym else raise WrongDay unless Weesked.availiable_days.include?(day.to_s) day.to_sym end end |
Instance Attribute Details
#day ⇒ Object (readonly)
Returns the value of attribute day.
4 5 6 |
# File 'lib/weesked/day.rb', line 4 def day @day end |
Class Method Details
.build(date) ⇒ Object
6 7 8 |
# File 'lib/weesked/day.rb', line 6 def self.build date DayBuilder.new(date).run end |
Instance Method Details
#steps ⇒ Object
20 21 22 23 |
# File 'lib/weesked/day.rb', line 20 def steps steps = (Array(@steps)- ['', nil]).map(&:to_i) Weesked.availiable_steps&steps end |