Class: Peck::Rails::Controller::Status

Inherits:
Object
  • Object
show all
Defined in:
lib/peck_on_rails/controller.rb

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Status

Returns a new instance of Status.



94
95
96
# File 'lib/peck_on_rails/controller.rb', line 94

def initialize(response)
  @response = response
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



98
99
100
101
102
103
104
105
106
# File 'lib/peck_on_rails/controller.rb', line 98

def ==(other)
  case other
  when Numeric
    @response.status == other
  else
    code = Rack::Utils::SYMBOL_TO_STATUS_CODE[other]
    @response.status === code
  end
end

#inspectObject



110
111
112
# File 'lib/peck_on_rails/controller.rb', line 110

def inspect
  "#<Peck::Rails::Controller::Status:#{@response.status}>"
end