Class: Railsdav::Renderer::ResponseCollector

Inherits:
Object
  • Object
show all
Defined in:
lib/railsdav/renderer/response_collector.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(controller, request_format) ⇒ ResponseCollector

Returns a new instance of ResponseCollector.



13
14
15
16
# File 'lib/railsdav/renderer/response_collector.rb', line 13

def initialize(controller, request_format)
  @controller, @request_format = controller, request_format
  @selector = ResponseTypeSelector.new(controller, request_format)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object

responds to calls like html, xml, json by ignoring them



25
26
27
# File 'lib/railsdav/renderer/response_collector.rb', line 25

def method_missing(name, *args)
  super unless Mime::EXTENSION_LOOKUP[name.to_s] or name == :any
end

Instance Attribute Details

#controller=(value) ⇒ Object (writeonly)

Sets the attribute controller

Parameters:

  • value

    the value to set the attribute controller to.



8
9
10
# File 'lib/railsdav/renderer/response_collector.rb', line 8

def controller=(value)
  @controller = value
end

Instance Method Details

#resourceObject



18
19
20
21
22
# File 'lib/railsdav/renderer/response_collector.rb', line 18

def resource

  request_path = URI(@controller.request.url).path
  @resource ||= Renderer::ResourceDescriptor.new(request_path, @selector.resource_options)
end

#webdavObject



29
30
31
32
33
# File 'lib/railsdav/renderer/response_collector.rb', line 29

def webdav
  if block_given?
    yield @selector
  end
end