Class: Dropkiq::DropMethodAnalyzer

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(drop_class_analyzer, drop_method) ⇒ DropMethodAnalyzer

Returns a new instance of DropMethodAnalyzer.



8
9
10
11
# File 'lib/dropkiq/drop_method_analyzer.rb', line 8

def initialize(drop_class_analyzer, drop_method)
  self.drop_class_analyzer = drop_class_analyzer
  self.drop_method = drop_method
end

Instance Attribute Details

#drop_class_analyzerObject

Returns the value of attribute drop_class_analyzer.



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

def drop_class_analyzer
  @drop_class_analyzer
end

#drop_methodObject

Returns the value of attribute drop_method.



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

def drop_method
  @drop_method
end

#dropkiq_typeObject

Returns the value of attribute dropkiq_type.



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

def dropkiq_type
  @dropkiq_type
end

#foreign_table_nameObject

Returns the value of attribute foreign_table_name.



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

def foreign_table_name
  @foreign_table_name
end

Instance Method Details

#analyzeObject



13
14
15
16
17
18
19
# File 'lib/dropkiq/drop_method_analyzer.rb', line 13

def analyze
  self.dropkiq_type = if is_relationship?
    relationship_to_dropkiq_type_classifier
  elsif is_column?
    column_to_dropkiq_type_classifier
  end
end

#to_paramObject



21
22
23
24
25
26
27
28
29
30
# File 'lib/dropkiq/drop_method_analyzer.rb', line 21

def to_param
  return {} if dropkiq_type.blank?

  {
    "#{drop_method}" => {
      "type"               => dropkiq_type,
      "foreign_table_name" => foreign_table_name
    }
  }
end