Class: Stamp::Emitters::String
- Inherits:
-
Object
- Object
- Stamp::Emitters::String
- Defined in:
- lib/stamp/emitters/string.rb
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #<<(emitter) ⇒ Object
- #field ⇒ Object
- #format(target) ⇒ Object
-
#initialize(value) ⇒ String
constructor
A new instance of String.
-
#strftime_directive ⇒ Object
Literal text, with % escaped so strftime passes it through verbatim.
Constructor Details
#initialize(value) ⇒ String
Returns a new instance of String.
6 7 8 |
# File 'lib/stamp/emitters/string.rb', line 6 def initialize(value) @value = value end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
4 5 6 |
# File 'lib/stamp/emitters/string.rb', line 4 def value @value end |
Instance Method Details
#<<(emitter) ⇒ Object
14 15 16 |
# File 'lib/stamp/emitters/string.rb', line 14 def <<(emitter) value << emitter.value end |
#field ⇒ Object
24 25 26 |
# File 'lib/stamp/emitters/string.rb', line 24 def field nil end |
#format(target) ⇒ Object
10 11 12 |
# File 'lib/stamp/emitters/string.rb', line 10 def format(target) value end |
#strftime_directive ⇒ Object
Literal text, with % escaped so strftime passes it through verbatim.
19 20 21 22 |
# File 'lib/stamp/emitters/string.rb', line 19 def strftime_directive # value can be nil (unmatched optional capture groups become tokens) value.to_s.gsub("%", "%%") end |