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



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

def block
  @block
end

#content_typeObject

Returns the value of attribute content_type

Returns:

  • (Object)

    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



54
55
56
57
58
# File 'lib/utopia/controller/respond.rb', line 54

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

#headersObject



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

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

#split(*args) ⇒ Object



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

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