Class: RailsBestPractices::Core::Error
- Inherits:
-
Object
- Object
- RailsBestPractices::Core::Error
- Defined in:
- lib/rails_best_practices/core/error.rb
Overview
Error is the violation to rails best practice.
it indicates the filenname, line number and error message for the violation.
Instance Attribute Summary collapse
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
-
#line_number ⇒ Object
readonly
Returns the value of attribute line_number.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(filename, line_number, message, url = nil) ⇒ Error
constructor
A new instance of Error.
- #to_s ⇒ Object
Constructor Details
#initialize(filename, line_number, message, url = nil) ⇒ Error
Returns a new instance of Error.
10 11 12 13 14 15 |
# File 'lib/rails_best_practices/core/error.rb', line 10 def initialize(filename, line_number, , url = nil) @filename = filename @line_number = line_number @message = @url = url end |
Instance Attribute Details
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
8 9 10 |
# File 'lib/rails_best_practices/core/error.rb', line 8 def filename @filename end |
#line_number ⇒ Object (readonly)
Returns the value of attribute line_number.
8 9 10 |
# File 'lib/rails_best_practices/core/error.rb', line 8 def line_number @line_number end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
8 9 10 |
# File 'lib/rails_best_practices/core/error.rb', line 8 def @message end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
8 9 10 |
# File 'lib/rails_best_practices/core/error.rb', line 8 def url @url end |
Instance Method Details
#to_s ⇒ Object
17 18 19 |
# File 'lib/rails_best_practices/core/error.rb', line 17 def to_s "#{@filename}:#{@line_number} - #{@message}" end |