Class: Interscript::Node::Rule::Run

Inherits:
Interscript::Node::Rule show all
Defined in:
lib/interscript/node/rule/run.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(stage, reverse_run: nil) ⇒ Run

Returns a new instance of Run.



3
4
5
6
# File 'lib/interscript/node/rule/run.rb', line 3

def initialize stage, reverse_run: nil
  @stage = stage
  @reverse_run = reverse_run
end

Instance Attribute Details

#reverse_runObject

Returns the value of attribute reverse_run.



2
3
4
# File 'lib/interscript/node/rule/run.rb', line 2

def reverse_run
  @reverse_run
end

#stageObject

Returns the value of attribute stage.



2
3
4
# File 'lib/interscript/node/rule/run.rb', line 2

def stage
  @stage
end

Instance Method Details

#==(other) ⇒ Object



19
20
21
# File 'lib/interscript/node/rule/run.rb', line 19

def ==(other)
  super && self.stage == other.stage
end

#inspectObject



23
24
25
26
27
# File 'lib/interscript/node/rule/run.rb', line 23

def inspect
  out = "run #{@stage.inspect}"
  out += ", reverse_run: #{@reverse_run.inspect}" unless reverse_run.nil?
  out
end

#reverseObject



13
14
15
16
17
# File 'lib/interscript/node/rule/run.rb', line 13

def reverse
  Interscript::Node::Rule::Run.new(stage,
    reverse_run: reverse_run.nil? ? nil : !reverse_run
  )
end

#to_hashObject



8
9
10
11
# File 'lib/interscript/node/rule/run.rb', line 8

def to_hash
  { :class => self.class.to_s,
    :stage => self.stage.to_hash }
end