Class: I18nChecker::Locale::TextProcessor
- Inherits:
-
Parser::AST::Processor
- Object
- Parser::AST::Processor
- I18nChecker::Locale::TextProcessor
- Defined in:
- lib/i18n_checker/locale/text_processor.rb
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#locale_texts ⇒ Object
readonly
Returns the value of attribute locale_texts.
Instance Method Summary collapse
-
#initialize(file:, locale_texts: []) ⇒ TextProcessor
constructor
A new instance of TextProcessor.
- #on_send(node) ⇒ Object
Constructor Details
#initialize(file:, locale_texts: []) ⇒ TextProcessor
Returns a new instance of TextProcessor.
9 10 11 12 |
# File 'lib/i18n_checker/locale/text_processor.rb', line 9 def initialize(file:, locale_texts: []) @file = file @locale_texts = locale_texts end |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
7 8 9 |
# File 'lib/i18n_checker/locale/text_processor.rb', line 7 def file @file end |
#locale_texts ⇒ Object (readonly)
Returns the value of attribute locale_texts.
7 8 9 |
# File 'lib/i18n_checker/locale/text_processor.rb', line 7 def locale_texts @locale_texts end |
Instance Method Details
#on_send(node) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/i18n_checker/locale/text_processor.rb', line 14 def on_send(node) _, method_name, *arg_nodes = *node return super(node) unless method_name == :t arg_node = arg_nodes.first locale_texts << I18nChecker::Locale::Text.new( file: file, line: arg_node.loc.line, column: arg_node.loc.column + 1, text: arg_node.children.first, ) super(node) end |