Class: NoSE::Plans::InsertPlanStep

Inherits:
UpdatePlanStep show all
Defined in:
lib/nose/plans/update.rb

Overview

A step which inserts data into a given index

Instance Attribute Summary collapse

Attributes inherited from UpdatePlanStep

#index, #state

Attributes inherited from PlanStep

#children, #cost, #parent, #state

Instance Method Summary collapse

Methods inherited from UpdatePlanStep

#==, #hash, #to_color

Methods inherited from PlanStep

#add_fields_from_index, #calculate_cost, inherited, #parent_index, #parent_steps, #to_color

Methods included from Supertype

included

Constructor Details

#initialize(index, state = nil, fields = Set.new) ⇒ InsertPlanStep

Returns a new instance of InsertPlanStep.



42
43
44
45
46
47
48
49
50
# File 'lib/nose/plans/update.rb', line 42

def initialize(index, state = nil, fields = Set.new)
  super index, :insert, state
  @fields = if fields.empty?
              index.all_fields
            else
              fields.to_set & index.all_fields
            end
  @fields += index.hash_fields + index.order_fields.to_set
end

Instance Attribute Details

#fieldsObject (readonly)

Returns the value of attribute fields.



40
41
42
# File 'lib/nose/plans/update.rb', line 40

def fields
  @fields
end