Class: CooklangRb::Text
- Inherits:
-
Object
- Object
- CooklangRb::Text
- Includes:
- Steppable
- Defined in:
- lib/cooklang_rb/text.rb
Constant Summary collapse
- TAG_BOUNDARY =
/[@#~](?=[^\p{Zs}\s])|\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
Returns a new instance of Text.
27 28 29 |
# File 'lib/cooklang_rb/text.rb', line 27 def initialize(value) @value = value end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
9 10 11 |
# File 'lib/cooklang_rb/text.rb', line 9 def value @value end |
Class Method Details
.parse_from(buffer) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/cooklang_rb/text.rb', line 13 def self.parse_from(buffer) text = buffer.scan_until TAG_BOUNDARY if text text = text.chop buffer.pos -= 1 unless buffer.eos? else text = buffer.rest buffer.terminate end new text.chomp end |