Class: Scribble::Block

Inherits:
Method
  • Object
show all
Includes:
Support::Context
Defined in:
lib/scribble/block.rb

Direct Known Subclasses

Methods::If, Methods::Layout, Methods::Times

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Support::Context

#converter, #evaluate, #format, included, #registers, #render, #render_format, #render_without_conversion, #require_conversion?, #resolve_variable, #set_variable, #template, #variables

Methods inherited from Method

eql?, implement, #initialize, insert, max_arity, min_arity, register, setup, split?

Constructor Details

This class inherits a constructor from Scribble::Method

Class Method Details

.block?Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/scribble/block.rb', line 5

def self.block?
  true
end

Instance Method Details

#nodesObject



9
10
11
# File 'lib/scribble/block.rb', line 9

def nodes
  @nodes || @call.nodes
end

#split_nodesObject



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/scribble/block.rb', line 13

def split_nodes
  nodes.take_while.with_index do |node, index|
    if node.split?
      @nodes = nodes.drop index + 1
      node.evaluate self, allow_split: true, allow_block: false
      false
    else
      true
    end
  end
end