Class: Draisine::Partition

Inherits:
Struct
  • Object
show all
Defined in:
lib/draisine/partitioner.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model_class, *args) ⇒ Partition

Returns a new instance of Partition.



3
4
5
6
# File 'lib/draisine/partitioner.rb', line 3

def initialize(model_class, *args)
  model_class = model_class.constantize if model_class.is_a?(String)
  super(model_class, *args)
end

Instance Attribute Details

#deleted_idsObject

Returns the value of attribute deleted_ids

Returns:

  • (Object)

    the current value of deleted_ids



2
3
4
# File 'lib/draisine/partitioner.rb', line 2

def deleted_ids
  @deleted_ids
end

#end_dateObject

Returns the value of attribute end_date

Returns:

  • (Object)

    the current value of end_date



2
3
4
# File 'lib/draisine/partitioner.rb', line 2

def end_date
  @end_date
end

#model_classObject

Returns the value of attribute model_class

Returns:

  • (Object)

    the current value of model_class



2
3
4
# File 'lib/draisine/partitioner.rb', line 2

def model_class
  @model_class
end

#start_dateObject

Returns the value of attribute start_date

Returns:

  • (Object)

    the current value of start_date



2
3
4
# File 'lib/draisine/partitioner.rb', line 2

def start_date
  @start_date
end

#unpersisted_idsObject

Returns the value of attribute unpersisted_ids

Returns:

  • (Object)

    the current value of unpersisted_ids



2
3
4
# File 'lib/draisine/partitioner.rb', line 2

def unpersisted_ids
  @unpersisted_ids
end

#updated_idsObject

Returns the value of attribute updated_ids

Returns:

  • (Object)

    the current value of updated_ids



2
3
4
# File 'lib/draisine/partitioner.rb', line 2

def updated_ids
  @updated_ids
end

Class Method Details

.from_json(fields) ⇒ Object



13
14
15
# File 'lib/draisine/partitioner.rb', line 13

def self.from_json(fields)
  new(*fields)
end

Instance Method Details

#as_jsonObject



8
9
10
11
# File 'lib/draisine/partitioner.rb', line 8

def as_json(*)
  model_class, *fields = to_a
  [model_class.name, *fields].as_json
end