Sha256: 3b2353668e9a5cd16d2510661c78912f6dc91bfa2f9d23d6772d5315174c8310

Contents?: true

Size: 811 Bytes

Versions: 3

Compression:

Stored size: 811 Bytes

Contents

class BlocklyInterpreter::CoreBlocks::ProceduresDefNoReturnBlock < BlocklyInterpreter::CoreBlocks::ProcedureBlock
  self.block_type = :procedures_defnoreturn

  def procedure_name
    fields['NAME']
  end

  def execute_statement(execution_context)
    execution_context.execute(statements['STACK'])
  end

  def to_dsl
    method_call_with_possible_block("procedures_defnoreturn", ([procedure_name] + arg_names).map(&:inspect).join(", "), statements['STACK'])
  end

  module DSLMethods
    def procedures_defnoreturn(name, *arg_names, &proc)
      block :procedures_defnoreturn do
        field :NAME, name

        arg_names.each do |arg_name|
          mutation_child :arg do |child|
            child['name'] = arg_name
          end
        end

        statement :STACK, &proc
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
blockly_interpreter-0.3.0 lib/blockly_interpreter/core_blocks/procedures_def_no_return_block.rb
blockly_interpreter-0.2.1 lib/blockly_interpreter/core_blocks/procedures_def_no_return_block.rb
blockly_interpreter-0.2.0 lib/blockly_interpreter/core_blocks/procedures_def_no_return_block.rb