Class: Semlogr::Templates::PropertyToken
- Inherits:
-
Object
- Object
- Semlogr::Templates::PropertyToken
- Defined in:
- lib/semlogr/templates/property_token.rb
Instance Attribute Summary collapse
-
#property_name ⇒ Object
Returns the value of attribute property_name.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(raw_text, property_name) ⇒ PropertyToken
constructor
A new instance of PropertyToken.
- #render(output, properties) ⇒ Object
Constructor Details
#initialize(raw_text, property_name) ⇒ PropertyToken
Returns a new instance of PropertyToken.
8 9 10 11 |
# File 'lib/semlogr/templates/property_token.rb', line 8 def initialize(raw_text, property_name) @raw_text = raw_text @property_name = property_name end |
Instance Attribute Details
#property_name ⇒ Object
Returns the value of attribute property_name.
6 7 8 |
# File 'lib/semlogr/templates/property_token.rb', line 6 def property_name @property_name end |
Instance Method Details
#==(other) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/semlogr/templates/property_token.rb', line 23 def ==(other) return false unless other return false unless other.respond_to?(:property_name) @property_name == other.property_name end |
#eql?(other) ⇒ Boolean
30 31 32 |
# File 'lib/semlogr/templates/property_token.rb', line 30 def eql?(other) self == other end |
#hash ⇒ Object
34 35 36 |
# File 'lib/semlogr/templates/property_token.rb', line 34 def hash @property_name.hash end |
#render(output, properties) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/semlogr/templates/property_token.rb', line 13 def render(output, properties) if properties.key?(@property_name) property_value = properties[@property_name] Formatters::PropertyValueFormatter.format(output, property_value) else output << @raw_text end end |