Class: Emojidex::Service::HistoryItem
- Inherits:
-
Object
- Object
- Emojidex::Service::HistoryItem
- Defined in:
- lib/emojidex/service/user/history_item.rb
Instance Attribute Summary collapse
-
#emoji_code ⇒ Object
Returns the value of attribute emoji_code.
-
#last_used ⇒ Object
Returns the value of attribute last_used.
-
#times_used ⇒ Object
Returns the value of attribute times_used.
Instance Method Summary collapse
-
#initialize(emoji_code, times_used, last_used) ⇒ HistoryItem
constructor
A new instance of HistoryItem.
- #to_json(*a) ⇒ Object
Constructor Details
#initialize(emoji_code, times_used, last_used) ⇒ HistoryItem
Returns a new instance of HistoryItem.
8 9 10 11 12 |
# File 'lib/emojidex/service/user/history_item.rb', line 8 def initialize(emoji_code, times_used, last_used) @emoji_code = emoji_code @times_used = times_used @last_used = Time.parse last_used end |
Instance Attribute Details
#emoji_code ⇒ Object
Returns the value of attribute emoji_code.
6 7 8 |
# File 'lib/emojidex/service/user/history_item.rb', line 6 def emoji_code @emoji_code end |
#last_used ⇒ Object
Returns the value of attribute last_used.
6 7 8 |
# File 'lib/emojidex/service/user/history_item.rb', line 6 def last_used @last_used end |
#times_used ⇒ Object
Returns the value of attribute times_used.
6 7 8 |
# File 'lib/emojidex/service/user/history_item.rb', line 6 def times_used @times_used end |
Instance Method Details
#to_json(*a) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/emojidex/service/user/history_item.rb', line 14 def to_json(*a) { emoji_code: @emoji_code, times_used: @times_used, last_used: @last_used.iso8601 }.to_json(*a) end |