Class: Context::DSL::Block

Inherits:
Object
  • Object
show all
Defined in:
lib/mashfeed/dsl.rb

Overview

block statement super class

Direct Known Subclasses

FlowBlock, PluginBlock

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context_dsl, parent_block, *args) ⇒ Block

Returns a new instance of Block.



20
21
22
# File 'lib/mashfeed/dsl.rb', line 20

def initialize(context_dsl, parent_block, *args)
  @context_dsl, @parent_block, @child_statements = context_dsl, parent_block, []
end

Instance Attribute Details

#child_statementsObject

Returns the value of attribute child_statements.



18
19
20
# File 'lib/mashfeed/dsl.rb', line 18

def child_statements
  @child_statements
end

#context_dslObject

Returns the value of attribute context_dsl.



18
19
20
# File 'lib/mashfeed/dsl.rb', line 18

def context_dsl
  @context_dsl
end

#parent_blockObject

Returns the value of attribute parent_block.



18
19
20
# File 'lib/mashfeed/dsl.rb', line 18

def parent_block
  @parent_block
end

Instance Method Details

#execute(recipe) ⇒ Object



24
25
26
27
28
29
30
# File 'lib/mashfeed/dsl.rb', line 24

def execute(recipe)
  before_execute(recipe) if respond_to?(:before_execute)
  recipe.call unless recipe.nil?
  statement = self.to_statement
  after_execute(statement) if respond_to?(:after_execute)
  statement
end

#to_statementObject



32
33
34
# File 'lib/mashfeed/dsl.rb', line 32

def to_statement
  raise "Need override"
end