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

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

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Status

Returns a new instance of Status.



144
145
146
# File 'lib/peck_on_rails.rb', line 144

def initialize(response)
  @response = response
end

Instance Method Details

#==(other) ⇒ Object



148
149
150
151
152
153
154
155
156
# File 'lib/peck_on_rails.rb', line 148

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

#inspectObject



158
159
160
# File 'lib/peck_on_rails.rb', line 158

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