Class: NoSE::Plans::UpdatePlanStep
- Defined in:
- lib/nose/plans/update.rb
Overview
A superclass for steps which modify indexes
Direct Known Subclasses
Instance Attribute Summary collapse
-
#index ⇒ Object
readonly
Returns the value of attribute index.
-
#state ⇒ Object
Returns the value of attribute state.
Attributes inherited from PlanStep
#children, #cost, #fields, #parent
Instance Method Summary collapse
-
#==(other) ⇒ Object
(also: #eql?)
Two insert steps are equal if they use the same index.
- #hash ⇒ Object
-
#initialize(index, type, state = nil) ⇒ UpdatePlanStep
constructor
A new instance of UpdatePlanStep.
-
#to_color ⇒ Object
:nocov:.
Methods inherited from PlanStep
#add_fields_from_index, #calculate_cost, inherited, #parent_index, #parent_steps
Methods included from Supertype
Constructor Details
#initialize(index, type, state = nil) ⇒ UpdatePlanStep
Returns a new instance of UpdatePlanStep.
10 11 12 13 14 15 16 17 18 |
# File 'lib/nose/plans/update.rb', line 10 def initialize(index, type, state = nil) super() @index = index @type = type return if state.nil? @state = state.dup @state.freeze end |
Instance Attribute Details
#index ⇒ Object (readonly)
Returns the value of attribute index.
7 8 9 |
# File 'lib/nose/plans/update.rb', line 7 def index @index end |
#state ⇒ Object
Returns the value of attribute state.
8 9 10 |
# File 'lib/nose/plans/update.rb', line 8 def state @state end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
Two insert steps are equal if they use the same index
27 28 29 30 |
# File 'lib/nose/plans/update.rb', line 27 def ==(other) other.instance_of?(self.class) && @index == other.index && \ @type == other.instance_variable_get(:@type) end |
#hash ⇒ Object
33 34 35 |
# File 'lib/nose/plans/update.rb', line 33 def hash [@index, @type].hash end |
#to_color ⇒ Object
:nocov:
21 22 23 |
# File 'lib/nose/plans/update.rb', line 21 def to_color "#{super} #{@index.to_color} * #{@state.cardinality}" end |