Class: TableSync::Publishing::Helpers::Objects

Inherits:
Object
  • Object
show all
Defined in:
lib/table_sync/publishing/helpers/objects.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object_class:, original_attributes:, event:) ⇒ Objects

Returns a new instance of Objects.



7
8
9
10
11
# File 'lib/table_sync/publishing/helpers/objects.rb', line 7

def initialize(object_class:, original_attributes:, event:)
  @event               = TableSync::Event.new(event)
  @object_class        = object_class.constantize
  @original_attributes = Array.wrap(original_attributes)
end

Instance Attribute Details

#eventObject (readonly)

Returns the value of attribute event.



5
6
7
# File 'lib/table_sync/publishing/helpers/objects.rb', line 5

def event
  @event
end

#object_classObject (readonly)

Returns the value of attribute object_class.



5
6
7
# File 'lib/table_sync/publishing/helpers/objects.rb', line 5

def object_class
  @object_class
end

#original_attributesObject (readonly)

Returns the value of attribute original_attributes.



5
6
7
# File 'lib/table_sync/publishing/helpers/objects.rb', line 5

def original_attributes
  @original_attributes
end

Instance Method Details

#construct_listObject



13
14
15
16
17
18
19
# File 'lib/table_sync/publishing/helpers/objects.rb', line 13

def construct_list
  if event.destroy?
    init_objects
  else
    without_empty_objects(find_objects)
  end
end