Class: L10nizer::TextNode

Inherits:
BasicNode show all
Defined in:
lib/l10nizer/node.rb

Instance Method Summary collapse

Methods inherited from BasicNode

#evaluated?, #initialize, #string?

Constructor Details

This class inherits a constructor from L10nizer::BasicNode

Instance Method Details

#l10nObject



41
42
43
44
# File 'lib/l10nizer/node.rb', line 41

def l10n
  _, text = vars_and_text
  text ? {key => text} : {}
end

#to_sObject



46
47
48
49
50
51
52
53
54
55
56
# File 'lib/l10nizer/node.rb', line 46

def to_s
  vars, _ = vars_and_text
  return super unless vars

  params = ['"' + key + '"']
  vars.each_with_index do |v, i|
    params << %{#{variable_name(i)}: (#{v})}
  end

  %{<%= t(#{params * ", "}) %>}
end