Class: Utopia::Controller::Respond::Converter::Callback

Inherits:
Struct
  • Object
show all
Defined in:
lib/utopia/controller/respond.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#block ⇒ Object

Returns the value of attribute block

Returns:

  • the current value of block



45
46
47
# File 'lib/utopia/controller/respond.rb', line 45

def block
  @block
end

#content_type ⇒ Object

Returns the value of attribute content_type

Returns:

  • the current value of content_type



45
46
47
# File 'lib/utopia/controller/respond.rb', line 45

def content_type
  @content_type
end

Instance Method Details

#call(context, response, media_range) ⇒ Object



50
51
52
53
54
# File 'lib/utopia/controller/respond.rb', line 50

def call(context, response, media_range)
  Converter.update_response(response, headers) do |content|
    context.instance_exec(content, media_range, &block)
  end
end

#headers ⇒ Object



46
47
48
# File 'lib/utopia/controller/respond.rb', line 46

def headers
  {HTTP::CONTENT_TYPE => self.content_type}
end