Module: Praxis::Controller

Extended by:
ActiveSupport::Concern
Includes:
Callbacks
Defined in:
lib/praxis/controller.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#definitionObject



42
43
44
# File 'lib/praxis/controller.rb', line 42

def definition
  self.class.definition
end

#initialize(request, response = Responses::Ok.new) ⇒ Object



33
34
35
36
# File 'lib/praxis/controller.rb', line 33

def initialize(request, response = Responses::Ok.new)
  @request = request
  @response = response
end

#inspectObject



38
39
40
# File 'lib/praxis/controller.rb', line 38

def inspect
  "#<#{self.class}##{object_id} @request=#{@request.inspect}>"
end

#media_typeObject



46
47
48
49
50
51
52
# File 'lib/praxis/controller.rb', line 46

def media_type
  if (response_definition = request.action.responses[response.name])
    response_definition.media_type
  else
    definition.media_type
  end
end