class RuboCop::Cop::Rails::HttpStatus::NumericStyleChecker
Constants
- DEFAULT_MSG
- MSG
- PERMITTED_STATUS
Attributes
node[R]
Public Class Methods
new(node)
click to toggle source
# File lib/rubocop/cop/rails/http_status.rb, line 136 def initialize(node) @node = node end
Public Instance Methods
message()
click to toggle source
# File lib/rubocop/cop/rails/http_status.rb, line 144 def message format(MSG, prefer: preferred_style, current: symbol.inspect) end
offensive?()
click to toggle source
# File lib/rubocop/cop/rails/http_status.rb, line 140 def offensive? !node.int_type? && !permitted_symbol? end
preferred_style()
click to toggle source
# File lib/rubocop/cop/rails/http_status.rb, line 148 def preferred_style number.to_s end
Private Instance Methods
number()
click to toggle source
# File lib/rubocop/cop/rails/http_status.rb, line 154 def number ::Rack::Utils::SYMBOL_TO_STATUS_CODE[symbol] end
permitted_symbol?()
click to toggle source
# File lib/rubocop/cop/rails/http_status.rb, line 162 def permitted_symbol? node.sym_type? && PERMITTED_STATUS.include?(node.value) end
symbol()
click to toggle source
# File lib/rubocop/cop/rails/http_status.rb, line 158 def symbol node.value end