Class: Utopia::Trenni::Buffer
Instance Attribute Summary collapse
-
#parts ⇒ Object
readonly
Returns the value of attribute parts.
Instance Method Summary collapse
- #code ⇒ Object
- #expression(text) ⇒ Object
-
#initialize ⇒ Buffer
constructor
A new instance of Buffer.
- #output(text) ⇒ Object
- #text(text) ⇒ Object
Constructor Details
#initialize ⇒ Buffer
Returns a new instance of Buffer.
28 29 30 |
# File 'lib/utopia/trenni.rb', line 28 def initialize @parts = [] end |
Instance Attribute Details
#parts ⇒ Object (readonly)
Returns the value of attribute parts.
32 33 34 |
# File 'lib/utopia/trenni.rb', line 32 def parts @parts end |
Instance Method Details
#code ⇒ Object
48 49 50 51 52 |
# File 'lib/utopia/trenni.rb', line 48 def code parts = ["#{OUT} = [] ; "] + @parts + ["#{OUT}.join"] code = parts.join end |
#expression(text) ⇒ Object
40 41 42 |
# File 'lib/utopia/trenni.rb', line 40 def expression(text) @parts << "#{text} ; " end |