module WADL::ResourceContainer
A mixin for objects that contain resources. If you include this, be sure to alias :find_resource to :find_resource_autogenerated beforehand.
Public Instance Methods
finalize_creation()
click to toggle source
# File lib/wadl/resource_container.rb, line 47 def finalize_creation resources.each { |r| define_singleton(r, :id, :find_resource) define_singleton(r, :path, :find_resource_by_path) } if resources end
find_resource_by_path(path, auto_dereference = nil)
click to toggle source
# File lib/wadl/resource_container.rb, line 42 def find_resource_by_path(path, auto_dereference = nil) path = path.to_s find_resource(auto_dereference) { |r| r.path == path } end
resource(name_or_id)
click to toggle source
# File lib/wadl/resource_container.rb, line 37 def resource(name_or_id) name_or_id = name_or_id.to_s find_resource { |r| r.id == name_or_id || r.path == name_or_id } end