Class: DiamondLang::CommandChain
- Defined in:
- lib/diamond-lang/command_chain.rb
Instance Attribute Summary collapse
-
#commands ⇒ Object
readonly
Returns the value of attribute commands.
Instance Method Summary collapse
-
#initialize(parent) ⇒ CommandChain
constructor
A new instance of CommandChain.
- #method_missing(name, *args, &block) ⇒ Object
- #to_minecarts ⇒ Object
Constructor Details
#initialize(parent) ⇒ CommandChain
Returns a new instance of CommandChain.
6 7 8 9 |
# File 'lib/diamond-lang/command_chain.rb', line 6 def initialize(parent) @parent = parent @commands = [] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
10 11 12 |
# File 'lib/diamond-lang/command_chain.rb', line 10 def method_missing(name, *args, &block) @commands << Helpers::Command.new(name.to_s.downcase, args, &block) end |
Instance Attribute Details
#commands ⇒ Object (readonly)
Returns the value of attribute commands.
5 6 7 |
# File 'lib/diamond-lang/command_chain.rb', line 5 def commands @commands end |
Instance Method Details
#to_minecarts ⇒ Object
13 14 15 |
# File 'lib/diamond-lang/command_chain.rb', line 13 def to_minecarts self.commands.map{|command| command.to_minecart} end |