Class: DTRCore::Instruction
- Inherits:
-
Object
- Object
- DTRCore::Instruction
- Defined in:
- lib/dtr_core/instruction.rb
Overview
Instruction class
Instance Attribute Summary collapse
-
#assign ⇒ Object
readonly
Returns the value of attribute assign.
-
#inputs ⇒ Object
readonly
Returns the value of attribute inputs.
-
#instruction ⇒ Object
readonly
Returns the value of attribute instruction.
-
#scope ⇒ Object
readonly
Returns the value of attribute scope.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(instruction, inputs, assign, scope) ⇒ Instruction
constructor
A new instance of Instruction.
- #to_json(*_args) ⇒ Object
- #to_s ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(instruction, inputs, assign, scope) ⇒ Instruction
Returns a new instance of Instruction.
8 9 10 11 12 13 |
# File 'lib/dtr_core/instruction.rb', line 8 def initialize(instruction, inputs, assign, scope) @instruction = instruction @inputs = inputs @assign = assign @scope = scope end |
Instance Attribute Details
#assign ⇒ Object (readonly)
Returns the value of attribute assign.
6 7 8 |
# File 'lib/dtr_core/instruction.rb', line 6 def assign @assign end |
#inputs ⇒ Object (readonly)
Returns the value of attribute inputs.
6 7 8 |
# File 'lib/dtr_core/instruction.rb', line 6 def inputs @inputs end |
#instruction ⇒ Object (readonly)
Returns the value of attribute instruction.
6 7 8 |
# File 'lib/dtr_core/instruction.rb', line 6 def instruction @instruction end |
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
6 7 8 |
# File 'lib/dtr_core/instruction.rb', line 6 def scope @scope end |
Instance Method Details
#==(other) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/dtr_core/instruction.rb', line 15 def ==(other) instruction == other.instruction && inputs == other.inputs && assign == other.assign && scope == other.scope end |
#to_json(*_args) ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/dtr_core/instruction.rb', line 28 def to_json(*_args) { instruction:, inputs:, assign:, scope: }.to_json end |
#to_s ⇒ Object
22 23 24 25 26 |
# File 'lib/dtr_core/instruction.rb', line 22 def to_s "{ instruction: #{instruction}, " \ "input: (#{inputs&.join(', ')}), " \ "assign: #{assign}, scope: #{scope} }" end |
#valid? ⇒ Boolean
37 38 39 |
# File 'lib/dtr_core/instruction.rb', line 37 def valid? DTRCore::InstructionValidator.new(self).valid? end |