Class: Bade::MixinCallNode
- Inherits:
-
MixinCommonNode
- Object
- Node
- MixinCommonNode
- Bade::MixinCallNode
- Defined in:
- lib/bade/node/mixin_node.rb
Instance Attribute Summary collapse
-
#blocks ⇒ Object
readonly
Returns the value of attribute blocks.
-
#default_block ⇒ Object
readonly
Returns the value of attribute default_block.
Attributes inherited from MixinCommonNode
Attributes inherited from Node
#childrens, #data, #escaped, #lineno, #parent, #type
Instance Method Summary collapse
- #<<(node) ⇒ Object
- #allowed_parameter_types ⇒ Object
-
#initialize(*args) ⇒ MixinCallNode
constructor
A new instance of MixinCallNode.
Methods inherited from Node
create, register_type, registered_types
Constructor Details
#initialize(*args) ⇒ MixinCallNode
Returns a new instance of MixinCallNode.
38 39 40 41 42 |
# File 'lib/bade/node/mixin_node.rb', line 38 def initialize(*args) super @blocks = [] end |
Instance Attribute Details
#blocks ⇒ Object (readonly)
Returns the value of attribute blocks.
34 35 36 |
# File 'lib/bade/node/mixin_node.rb', line 34 def blocks @blocks end |
#default_block ⇒ Object (readonly)
Returns the value of attribute default_block.
36 37 38 |
# File 'lib/bade/node/mixin_node.rb', line 36 def default_block @default_block end |
Instance Method Details
#<<(node) ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/bade/node/mixin_node.rb', line 48 def << (node) if allowed_parameter_types.include?(node.type) node.parent = self @params << node elsif node.type == :mixin_block node.parent = self @blocks << node else if @default_block.nil? if node.type == :newline # skip newlines at start return self end @default_block = Node.create(:mixin_block, self) end @default_block << node end end |
#allowed_parameter_types ⇒ Object
44 45 46 |
# File 'lib/bade/node/mixin_node.rb', line 44 def allowed_parameter_types [:mixin_param, :mixin_key_param] end |