Class: Railsdav::Renderer::ResponseCollector
- Inherits:
-
Object
- Object
- Railsdav::Renderer::ResponseCollector
- Defined in:
- lib/railsdav/renderer/response_collector.rb
Instance Attribute Summary collapse
-
#controller ⇒ Object
writeonly
Sets the attribute controller.
Instance Method Summary collapse
-
#initialize(controller, request_format) ⇒ ResponseCollector
constructor
A new instance of ResponseCollector.
-
#method_missing(name, *args) ⇒ Object
responds to calls like html, xml, json by ignoring them.
- #resource ⇒ Object
- #webdav ⇒ Object
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
8 9 10 |
# File 'lib/railsdav/renderer/response_collector.rb', line 8 def controller=(value) @controller = value end |
Instance Method Details
#resource ⇒ Object
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.) end |
#webdav ⇒ Object
29 30 31 32 33 |
# File 'lib/railsdav/renderer/response_collector.rb', line 29 def webdav if block_given? yield @selector end end |