Class: EmojiClockFetcher

Inherits:
Object
  • Object
show all
Defined in:
lib/emoji_clock/emoji_clock_fetcher.rb

Constant Summary collapse

EMOJI_CLOCK_CODE_POINT =
0x1F550

Instance Method Summary collapse

Constructor Details

#initialize(hour, minute) ⇒ EmojiClockFetcher

Returns a new instance of EmojiClockFetcher.



6
7
8
9
# File 'lib/emoji_clock/emoji_clock_fetcher.rb', line 6

def initialize(hour, minute)
  @hour = hour
  @minute = minute
end

Instance Method Details

#exact_fetchObject



16
17
18
# File 'lib/emoji_clock/emoji_clock_fetcher.rb', line 16

def exact_fetch
  fetch if [0, 30].include?(@minute)
end

#fetchObject



11
12
13
14
# File 'lib/emoji_clock/emoji_clock_fetcher.rb', line 11

def fetch
  code_point = EMOJI_CLOCK_CODE_POINT + hour_offset + minute_offset
  [code_point].pack('U')
end