Class: HerbStringVariable

Inherits:
Treetop::Runtime::SyntaxNode
  • Object
show all
Includes:
TextNode
Defined in:
lib/nodes/herb_string_variable.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

#flatten

Methods included from BaseNode

#shatter?, #shattered_node_list

Instance Method Details

#extract_text(text_extractor, node_tree) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/nodes/herb_string_variable.rb', line 8

def extract_text( text_extractor, node_tree )
  pluralize = find_pluralize_node(variable)
  
  # if this variable is a pluralize node, then don't treat it like a
  # variable but like a pluralize
  unless( pluralize.nil? )
    variable_name = I18nKey.new( pluralize.repetition.text_value, get_key_hash(text_extractor, node_tree) ).to_s      
    text_extractor.pluralize( pluralize, variable_name )
  else
    text_extractor.add_variable( I18nKey.new( self.variable.text_value, get_key_hash(text_extractor, node_tree) ).to_s , self.variable.text_value )    
  end
  
end

#node_nameObject



4
5
6
# File 'lib/nodes/herb_string_variable.rb', line 4

def node_name
  "herb_string_variable"
end