Class: Cogger::Formatters::Transformers::Emoji
- Inherits:
-
Object
- Object
- Cogger::Formatters::Transformers::Emoji
- Defined in:
- lib/cogger/formatters/transformers/emoji.rb
Overview
Transforms target into emoji.
Constant Summary collapse
- KEY =
"emoji"
Instance Method Summary collapse
- #call(target, directive, level) ⇒ Object
-
#initialize(key = KEY, key_transformer: Key, registry: Cogger) ⇒ Emoji
constructor
A new instance of Emoji.
Constructor Details
#initialize(key = KEY, key_transformer: Key, registry: Cogger) ⇒ Emoji
Returns a new instance of Emoji.
10 11 12 13 14 |
# File 'lib/cogger/formatters/transformers/emoji.rb', line 10 def initialize key = KEY, key_transformer: Key, registry: Cogger @key = key @key_transformer = key_transformer @registry = registry end |
Instance Method Details
#call(target, directive, level) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/cogger/formatters/transformers/emoji.rb', line 16 def call target, directive, level return target unless target == key key = key_transformer.call directive, level registry.aliases.key?(key) ? registry.get_emoji(key) : target end |