Class: Biz::WeekTime::Abstract
- Inherits:
-
Object
- Object
- Biz::WeekTime::Abstract
- Extended by:
- Forwardable
- Includes:
- AbstractType, Comparable, Memoizable
- Defined in:
- lib/biz/week_time/abstract.rb
Instance Attribute Summary collapse
-
#week_minute ⇒ Object
readonly
Returns the value of attribute week_minute.
Class Method Summary collapse
Instance Method Summary collapse
- #coerce(other) ⇒ Object
-
#initialize(week_minute) ⇒ Abstract
constructor
A new instance of Abstract.
- #wday_symbol ⇒ Object
Constructor Details
#initialize(week_minute) ⇒ Abstract
Returns a new instance of Abstract.
21 22 23 |
# File 'lib/biz/week_time/abstract.rb', line 21 def initialize(week_minute) @week_minute = Integer(week_minute) end |
Instance Attribute Details
#week_minute ⇒ Object (readonly)
Returns the value of attribute week_minute.
19 20 21 |
# File 'lib/biz/week_time/abstract.rb', line 19 def week_minute @week_minute end |
Class Method Details
.from_time(time) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/biz/week_time/abstract.rb', line 11 def self.from_time(time) new( time.wday * Time::MINUTES_IN_DAY + time.hour * Time::MINUTES_IN_HOUR + time.min ) end |
Instance Method Details
#coerce(other) ⇒ Object
29 30 31 |
# File 'lib/biz/week_time/abstract.rb', line 29 def coerce(other) [self.class.new(other), self] end |
#wday_symbol ⇒ Object
25 26 27 |
# File 'lib/biz/week_time/abstract.rb', line 25 def wday_symbol day_of_week.symbol end |