Class: CooklangRb::Text
- Inherits:
-
Object
- Object
- CooklangRb::Text
- Includes:
- Steppable
- Defined in:
- lib/cooklang_rb/text.rb
Constant Summary collapse
- TAGS =
/[@#~]|\n/
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(value) ⇒ Text
constructor
A new instance of Text.
Methods included from Steppable
Constructor Details
#initialize(value) ⇒ Text
18 19 20 |
# File 'lib/cooklang_rb/text.rb', line 18 def initialize(value) @value = value end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
7 8 9 |
# File 'lib/cooklang_rb/text.rb', line 7 def value @value end |
Class Method Details
.parse_from(buffer) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/cooklang_rb/text.rb', line 11 def self.parse_from(buffer) text = buffer.scan_until TAGS text = text&.sub(TAGS, "") || buffer.rest buffer.pos = buffer.pos - 1 unless buffer.eos? new text.chomp end |