Class: EmojiClock
- Inherits:
-
Object
- Object
- EmojiClock
- Extended by:
- ClockVariety
- Defined in:
- lib/emoji_clock.rb,
lib/emoji_clock/version.rb
Constant Summary collapse
- VERSION =
"1.0.0"
Constants included from ClockVariety
ClockVariety::ALARM_CLOCK, ClockVariety::EMOJI_CLOCK_CODE_POINT, ClockVariety::HOUR_GLASS_DONE, ClockVariety::HOUR_GLASS_UNDONE, ClockVariety::MANTELPIECE_CLOCK, ClockVariety::STOP_WATCH_CLOCK, ClockVariety::TIMER_CLOCK, ClockVariety::WATCH_CLOCK
Instance Attribute Summary collapse
-
#hour ⇒ Object
readonly
Returns the value of attribute hour.
-
#minute ⇒ Object
readonly
Returns the value of attribute minute.
Class Method Summary collapse
Instance Method Summary collapse
- #fetch_emoji ⇒ Object
- #fetch_exact_emoji ⇒ Object
- #fetcher ⇒ Object
-
#initialize(hour, minute) ⇒ EmojiClock
constructor
A new instance of EmojiClock.
Methods included from ClockVariety
alarm, hourglass_done, hourglass_undone, mantelpiece, stop_watch, timer, watch
Constructor Details
#initialize(hour, minute) ⇒ EmojiClock
Returns a new instance of EmojiClock.
12 13 14 15 |
# File 'lib/emoji_clock.rb', line 12 def initialize(hour, minute) @hour = hour @minute = minute end |
Instance Attribute Details
#hour ⇒ Object (readonly)
Returns the value of attribute hour.
9 10 11 |
# File 'lib/emoji_clock.rb', line 9 def hour @hour end |
#minute ⇒ Object (readonly)
Returns the value of attribute minute.
9 10 11 |
# File 'lib/emoji_clock.rb', line 9 def minute @minute end |
Class Method Details
.at(*args, exact: false) ⇒ Object
29 30 31 32 33 34 |
# File 'lib/emoji_clock.rb', line 29 def self.at(*args, exact: false) time = TimeParser.parse(*args) clock = new(time.hour, time.min) exact ? clock.fetch_exact_emoji : clock.fetch_emoji end |
.now(exact: false) ⇒ Object
25 26 27 |
# File 'lib/emoji_clock.rb', line 25 def self.now(exact: false) at(Time.now, exact: exact) end |
Instance Method Details
#fetch_emoji ⇒ Object
17 18 19 |
# File 'lib/emoji_clock.rb', line 17 def fetch_emoji fetcher.fetch end |
#fetch_exact_emoji ⇒ Object
21 22 23 |
# File 'lib/emoji_clock.rb', line 21 def fetch_exact_emoji fetcher.exact_fetch end |
#fetcher ⇒ Object
36 37 38 |
# File 'lib/emoji_clock.rb', line 36 def fetcher @fetcher ||= EmojiClockFetcher.new(hour, minute) end |