Class: It::Interpolation
- Inherits:
-
Object
- Object
- It::Interpolation
- Defined in:
- lib/it/interpolation.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
Returns the value of attribute key.
-
#label ⇒ Object
Returns the value of attribute label.
-
#values ⇒ Object
Returns the value of attribute values.
Instance Method Summary collapse
-
#initialize(string, values) ⇒ Interpolation
constructor
A new instance of Interpolation.
- #process ⇒ Object
Constructor Details
#initialize(string, values) ⇒ Interpolation
Returns a new instance of Interpolation.
5 6 7 8 9 10 |
# File 'lib/it/interpolation.rb', line 5 def initialize(string, values) self.key, self.label = string[2..-2].split(':', 2) self.values = values convert_links end |
Instance Attribute Details
#key ⇒ Object
Returns the value of attribute key.
3 4 5 |
# File 'lib/it/interpolation.rb', line 3 def key @key end |
#label ⇒ Object
Returns the value of attribute label.
3 4 5 |
# File 'lib/it/interpolation.rb', line 3 def label @label end |
#values ⇒ Object
Returns the value of attribute values.
3 4 5 |
# File 'lib/it/interpolation.rb', line 3 def values @values end |
Instance Method Details
#process ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/it/interpolation.rb', line 12 def process check_input_values if label # Normal tags values[key].process(label.html_safe) elsif values[key].is_a?(It::Tag) # Empty tag values[key].process else # Normal interpolations, as I18n.t would do it. ERB::Util.h(values[key]) end end |