Class: RailsBestPractices::Core::Method

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_best_practices/core/methods.rb

Overview

Method info includes class name, method name, access control, file, line_number, used.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(class_name, method_name, access_control, meta) ⇒ Method

Returns a new instance of Method.



156
157
158
159
160
161
162
163
# File 'lib/rails_best_practices/core/methods.rb', line 156

def initialize(class_name, method_name, access_control, meta)
  @class_name = class_name
  @method_name = method_name
  @file = meta['file']
  @line_number = meta['line_number']
  @access_control = access_control
  @used = false
end

Instance Attribute Details

#access_controlObject (readonly)

Returns the value of attribute access_control.



154
155
156
# File 'lib/rails_best_practices/core/methods.rb', line 154

def access_control
  @access_control
end

#class_nameObject (readonly)

Returns the value of attribute class_name.



154
155
156
# File 'lib/rails_best_practices/core/methods.rb', line 154

def class_name
  @class_name
end

#fileObject (readonly)

Returns the value of attribute file.



154
155
156
# File 'lib/rails_best_practices/core/methods.rb', line 154

def file
  @file
end

#line_numberObject (readonly)

Returns the value of attribute line_number.



154
155
156
# File 'lib/rails_best_practices/core/methods.rb', line 154

def line_number
  @line_number
end

#method_nameObject (readonly)

Returns the value of attribute method_name.



154
155
156
# File 'lib/rails_best_practices/core/methods.rb', line 154

def method_name
  @method_name
end

#usedObject (readonly)

Returns the value of attribute used.



154
155
156
# File 'lib/rails_best_practices/core/methods.rb', line 154

def used
  @used
end

Instance Method Details

#mark_usedObject

Mark the method as used.



166
167
168
# File 'lib/rails_best_practices/core/methods.rb', line 166

def mark_used
  @used = true
end

#publicizeObject

Mark the method as public



171
172
173
# File 'lib/rails_best_practices/core/methods.rb', line 171

def publicize
  @access_control = 'public'
end