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

#blockObject

Returns the value of attribute block

Returns:

  • (Object)

    the current value of block



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

def block
  @block
end

#content_typeObject

Returns the value of attribute content_type

Returns:

  • (Object)

    the current value of content_type



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

def content_type
  @content_type
end

Instance Method Details

#call(context, response, media_range) ⇒ Object



56
57
58
59
60
# File 'lib/utopia/controller/respond.rb', line 56

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

#headersObject



48
49
50
# File 'lib/utopia/controller/respond.rb', line 48

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

#split(*args) ⇒ Object



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

def split(*args)
	self.content_type.split(*args)
end