Class: BlocklyInterpreter::CoreBlocks::ForEachBlock::DSLMethods::ForEachBlockBuilder

Inherits:
DSL::BlockBuilder
  • Object
show all
Defined in:
lib/blockly_interpreter/core_blocks/for_each_block.rb

Instance Attribute Summary

Attributes inherited from DSL::BlockBuilder

#block_type, #comment, #comment_pinned, #fields, #is_shadow, #mutation_attrs, #mutation_child_procs, #statements, #values, #x, #y

Instance Method Summary collapse

Methods inherited from DSL::BlockBuilder

#build_subblock, #comment_to_xml, #field, #field_to_xml, #mutation_attr, #mutation_child, #mutations_to_xml, #set_comment, #set_position!, #shadow!, #statement, #subblock_to_xml, #tag_name, #to_xml, #value

Constructor Details

#initialize(block_type, var_name) ⇒ ForEachBlockBuilder

Returns a new instance of ForEachBlockBuilder.



22
23
24
25
# File 'lib/blockly_interpreter/core_blocks/for_each_block.rb', line 22

def initialize(block_type, var_name)
  super(block_type)
  field :VAR, var_name
end

Instance Method Details

#action(&proc) ⇒ Object



31
32
33
# File 'lib/blockly_interpreter/core_blocks/for_each_block.rb', line 31

def action(&proc)
  statement "DO", &proc
end

#list(&proc) ⇒ Object



27
28
29
# File 'lib/blockly_interpreter/core_blocks/for_each_block.rb', line 27

def list(&proc)
  value "LIST", &proc
end