Class: SlimKeyfy::Transformer::ControllerTransformer
- Inherits:
-
BaseTransformer
- Object
- BaseTransformer
- SlimKeyfy::Transformer::ControllerTransformer
- Defined in:
- lib/slimkeyfy/transformer/controller_transformer.rb
Constant Summary collapse
- TAGS =
/(text|notice|message|alert|raise|subject|flash\[:[a-z]+\])/
- CONNECTING_SYMBOLS =
/\s*(:|=>?)?\s*/
- REGEX =
/(?<tag>#{TAGS}#{CONNECTING_SYMBOLS})(?<translation>#{STRING})/
Constants inherited from BaseTransformer
BaseTransformer::STRING, BaseTransformer::STRING_WITHOUT_QUOTES, BaseTransformer::TRANSLATED
Instance Method Summary collapse
Methods inherited from BaseTransformer
#initialize, #match_string, #matches_string?, #nil_elem, #should_not_be_processed?, #slim?, #update_hashes
Constructor Details
This class inherits a constructor from SlimKeyfy::Transformer::BaseTransformer
Instance Method Details
#controller? ⇒ Boolean
17 18 19 |
# File 'lib/slimkeyfy/transformer/controller_transformer.rb', line 17 def controller? true end |
#transform ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/slimkeyfy/transformer/controller_transformer.rb', line 6 def transform m = @word.line.match(REGEX) if m != nil then translation = match_string(m[:translation]) translation_key = update_hashes(translation) localized = @word.line.gsub(m[:translation], translation_key) return [localized, @word.translations] end nil_elem end |