Class: Dropkiq::DropMethodInstanceSimulator

Inherits:
Object
  • Object
show all
Defined in:
lib/dropkiq/drop_method_instance_simulator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(drop_method, sample_drop = nil) ⇒ DropMethodInstanceSimulator

Returns a new instance of DropMethodInstanceSimulator.



6
7
8
9
# File 'lib/dropkiq/drop_method_instance_simulator.rb', line 6

def initialize(drop_method, sample_drop=nil)
  self.drop_method = drop_method.to_s
  self.sample_drop = sample_drop
end

Instance Attribute Details

#drop_methodObject

Returns the value of attribute drop_method.



3
4
5
# File 'lib/dropkiq/drop_method_instance_simulator.rb', line 3

def drop_method
  @drop_method
end

#dropkiq_typeObject

Returns the value of attribute dropkiq_type.



4
5
6
# File 'lib/dropkiq/drop_method_instance_simulator.rb', line 4

def dropkiq_type
  @dropkiq_type
end

#foreign_table_nameObject

Returns the value of attribute foreign_table_name.



4
5
6
# File 'lib/dropkiq/drop_method_instance_simulator.rb', line 4

def foreign_table_name
  @foreign_table_name
end

#sample_dropObject

Returns the value of attribute sample_drop.



3
4
5
# File 'lib/dropkiq/drop_method_instance_simulator.rb', line 3

def sample_drop
  @sample_drop
end

Instance Method Details

#classifyObject



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/dropkiq/drop_method_instance_simulator.rb', line 11

def classify
  value = begin
    sample_drop.try(drop_method)
  rescue
  end

  self.dropkiq_type = ruby_data_type_to_dropkiq_type(value)
  self.dropkiq_type ||= test_for_relationship(value)

  self
end