Class: BlocklyInterpreter::CoreBlocks::BooleanBlock

Inherits:
Block
  • Object
show all
Defined in:
lib/blockly_interpreter/core_blocks/boolean_block.rb

Defined Under Namespace

Modules: DSLMethods

Instance Attribute Summary

Attributes inherited from Block

#block_type, #comment, #comment_pinned, #fields, #is_shadow, #mutation, #next_block, #statements, #values, #x, #y

Instance Method Summary collapse

Methods inherited from Block

#each_block, #execute_statement, #has_comment?, #has_position?, #initialize, #to_xml, #to_xml_element

Constructor Details

This class inherits a constructor from BlocklyInterpreter::Block

Instance Method Details

#to_boolObject



4
5
6
# File 'lib/blockly_interpreter/core_blocks/boolean_block.rb', line 4

def to_bool
  fields['BOOL'] == 'TRUE'
end

#to_dslObject



12
13
14
# File 'lib/blockly_interpreter/core_blocks/boolean_block.rb', line 12

def to_dsl
  "logic_boolean #{to_bool.inspect}"
end

#value(execution_context) ⇒ Object



8
9
10
# File 'lib/blockly_interpreter/core_blocks/boolean_block.rb', line 8

def value(execution_context)
  to_bool
end