Class: BulletmarkRepairer::Marker

Inherits:
Object
  • Object
show all
Defined in:
lib/bulletmark_repairer/markers.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(notification, controller:, action:) ⇒ Marker

Returns a new instance of Marker.



33
34
35
36
37
38
39
40
41
42
# File 'lib/bulletmark_repairer/markers.rb', line 33

def initialize(notification, controller:, action:)
  @base_class = notification.instance_variable_get(:@base_class)
  @stacktraces = notification.instance_variable_get(:@callers)
  @associations = notification.instance_variable_get(:@associations)
  @controller = controller
  @action = action
  @retry = false
  @line_no = nil
  set_up
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



31
32
33
# File 'lib/bulletmark_repairer/markers.rb', line 31

def action
  @action
end

#associationsObject (readonly)

Returns the value of attribute associations.



31
32
33
# File 'lib/bulletmark_repairer/markers.rb', line 31

def associations
  @associations
end

#base_classObject (readonly)

Returns the value of attribute base_class.



31
32
33
# File 'lib/bulletmark_repairer/markers.rb', line 31

def base_class
  @base_class
end

#file_nameObject (readonly)

Returns the value of attribute file_name.



31
32
33
# File 'lib/bulletmark_repairer/markers.rb', line 31

def file_name
  @file_name
end

#indexObject (readonly)

Returns the value of attribute index.



31
32
33
# File 'lib/bulletmark_repairer/markers.rb', line 31

def index
  @index
end

#instance_variable_nameObject (readonly)

Returns the value of attribute instance_variable_name.



31
32
33
# File 'lib/bulletmark_repairer/markers.rb', line 31

def instance_variable_name
  @instance_variable_name
end

#line_noObject (readonly)

Returns the value of attribute line_no.



31
32
33
# File 'lib/bulletmark_repairer/markers.rb', line 31

def line_no
  @line_no
end

#retryObject (readonly)

Returns the value of attribute retry.



31
32
33
# File 'lib/bulletmark_repairer/markers.rb', line 31

def retry
  @retry
end

Instance Method Details

#add_association(notification) ⇒ Object



44
45
46
# File 'lib/bulletmark_repairer/markers.rb', line 44

def add_association(notification)
  @associations += notification.instance_variable_get(:@associations)
end

#n_plus_one_in_view?Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/bulletmark_repairer/markers.rb', line 53

def n_plus_one_in_view?
  @n_plus_one_in_view
end

#skip?Boolean

Returns:

  • (Boolean)


48
49
50
51
# File 'lib/bulletmark_repairer/markers.rb', line 48

def skip?
  log_patchable_files_not_be_found
  index.nil? || file_name.remove("#{Rails.root}/").in?(BulletmarkRepairer.config.skip_file_list)
end