Class: Cutaneous::Compiler::Block
- Inherits:
-
Object
- Object
- Cutaneous::Compiler::Block
- Defined in:
- lib/cutaneous/compiler.rb
Overview
A single named block of template expressions
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name) ⇒ Block
constructor
A new instance of Block.
- #push(expression) ⇒ Object (also: #<<)
- #to_script ⇒ Object
Constructor Details
#initialize(name) ⇒ Block
Returns a new instance of Block.
9 10 11 12 |
# File 'lib/cutaneous/compiler.rb', line 9 def initialize(name) @name = name @expressions = [] end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/cutaneous/compiler.rb', line 7 def name @name end |
Instance Method Details
#push(expression) ⇒ Object Also known as: <<
14 15 16 |
# File 'lib/cutaneous/compiler.rb', line 14 def push(expression) @expressions << expression end |
#to_script ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/cutaneous/compiler.rb', line 20 def to_script script = "" @expressions.each do |expression| script << expression.to_script end script end |