Class: SimpleEmoji::Index
- Inherits:
-
Object
- Object
- SimpleEmoji::Index
- Includes:
- ActionView::Helpers::TagHelper
- Defined in:
- lib/simple_emoji.rb
Instance Attribute Summary collapse
-
#emoji_list ⇒ Object
readonly
Returns the value of attribute emoji_list.
Instance Method Summary collapse
-
#initialize(emoji_list = nil) ⇒ Index
constructor
A new instance of Index.
Constructor Details
#initialize(emoji_list = nil) ⇒ Index
Returns a new instance of Index.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/simple_emoji.rb', line 11 def initialize(emoji_list = nil) emoji_list ||= begin emoji_json = File.read(emoji_list_file) JSON.parse(emoji_json) end @emoji_list = emoji_list emoji_list.each do |emoji_type, emoji_type_lists| emoji_type_lists.each do |key, value| self.class.send(:define_method, "#{key}") do content_tag(:span, value, { class: "emoji-#{key}" }, false) end end end end |
Instance Attribute Details
#emoji_list ⇒ Object (readonly)
Returns the value of attribute emoji_list.
9 10 11 |
# File 'lib/simple_emoji.rb', line 9 def emoji_list @emoji_list end |