Class: Prune::PObjects::PStream
- Defined in:
- lib/prune/p_objects/p_stream.rb
Instance Method Summary collapse
-
#<<(text) ⇒ Object
Add content.
-
#initialize ⇒ PStream
constructor
Initialize.
-
#length ⇒ Object
Length of the content.
-
#to_s ⇒ Object
Convert content to string.
Methods inherited from Base
#indent!, #outdent!, #space, #value_to_s
Constructor Details
#initialize ⇒ PStream
Initialize.
7 8 9 |
# File 'lib/prune/p_objects/p_stream.rb', line 7 def initialize @stream = [] end |
Instance Method Details
#<<(text) ⇒ Object
Add content.
12 13 14 15 |
# File 'lib/prune/p_objects/p_stream.rb', line 12 def <<(text) raise PStreamTypeError unless text.instance_of?(String) @stream << text end |
#length ⇒ Object
Length of the content.
18 19 20 |
# File 'lib/prune/p_objects/p_stream.rb', line 18 def length self.to_s.size end |
#to_s ⇒ Object
Convert content to string.
23 24 25 |
# File 'lib/prune/p_objects/p_stream.rb', line 23 def to_s ["stream", @stream, "endstream"].flatten.join(LF) end |