Class: Gobstones::Lang::Commands::CommandBlock
- Inherits:
-
Object
- Object
- Gobstones::Lang::Commands::CommandBlock
- Includes:
- EqualityDefinition
- Defined in:
- lib/gobstones/lang/commands/command_block.rb
Instance Attribute Summary collapse
-
#commands ⇒ Object
readonly
Returns the value of attribute commands.
Class Method Summary collapse
Instance Method Summary collapse
- #empty? ⇒ Boolean
- #equality_attributes ⇒ Object
- #evaluate(context) ⇒ Object
-
#initialize(commands) ⇒ CommandBlock
constructor
A new instance of CommandBlock.
Methods included from EqualityDefinition
Constructor Details
#initialize(commands) ⇒ CommandBlock
Returns a new instance of CommandBlock.
19 20 21 |
# File 'lib/gobstones/lang/commands/command_block.rb', line 19 def initialize(commands) @commands = commands end |
Instance Attribute Details
#commands ⇒ Object (readonly)
Returns the value of attribute commands.
9 10 11 |
# File 'lib/gobstones/lang/commands/command_block.rb', line 9 def commands @commands end |
Class Method Details
.empty ⇒ Object
11 12 13 |
# File 'lib/gobstones/lang/commands/command_block.rb', line 11 def self.empty new([]) end |
.with_just(a_command) ⇒ Object
15 16 17 |
# File 'lib/gobstones/lang/commands/command_block.rb', line 15 def self.with_just(a_command) new([a_command]) end |
Instance Method Details
#empty? ⇒ Boolean
27 28 29 |
# File 'lib/gobstones/lang/commands/command_block.rb', line 27 def empty? commands.empty? end |
#equality_attributes ⇒ Object
23 24 25 |
# File 'lib/gobstones/lang/commands/command_block.rb', line 23 def equality_attributes %i[commands] end |
#evaluate(context) ⇒ Object
31 32 33 |
# File 'lib/gobstones/lang/commands/command_block.rb', line 31 def evaluate(context) commands.each { |command| command.evaluate(context) } end |