Module: MethodCallNode
- Includes:
- TextNode
- Defined in:
- lib/core/method_call_node.rb
Instance Method Summary collapse
Methods included from TextNode
#amount_of_ending_whitespace, #amount_of_starting_whitespace, #contains_alpha_characters?, #has_leading_or_trailing_whitespace?, #has_variables?, #html?, #remove_leading_and_trailing_whitespace, #strip_whitespace?, #text?, #top_level?, #white_space?
Methods included from NodeProcessing
Methods included from BaseNode
#shatter?, #shattered_node_list
Instance Method Details
#extract_text(text_extractor, node_tree, surrounding_nodes = nil) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/core/method_call_node.rb', line 4 def extract_text( text_extractor, node_tree, surrounding_nodes = nil ) text_string = '' self.elements.each do |node| if( node.is_a?( TextNode ) ) # If this method call is part of a string, then translate it # as a method call otherwise just translate it is regular text if( surrounding_nodes.nil? || !surrounded_by_text?( surrounding_nodes ) ) translated_node = text_extractor.translate_text( node.text_value ) else translated_node = text_extractor.translate_method_call_text( node.text_value ) end text_string << "(#{translated_node.text_value})" else text_string << node.text_value end end if( surrounding_nodes.nil? ) node_tree << HerbNonTextNode.new( text_string ) elsif( surrounded_by_text? (surrounding_nodes) ) text_extractor.add_variable( generate_i18n_key( text_extractor, node_tree ).to_s, text_string.strip ) else node_tree << HerbNonTextNode.new( "<%= #{text_string.strip} %>" ) end end |
#node_name ⇒ Object
33 34 35 |
# File 'lib/core/method_call_node.rb', line 33 def node_name "method_call_node" end |