module WADL::XMLRepresentation
A module mixed in to REXML documents to make them representations in the WADL sense.
Public Instance Methods
each_by_param(param_name) { |e| ... }
click to toggle source
Yields up each XML element for the given Param object.
# File lib/wadl/xml_representation.rb, line 52 def each_by_param(param_name) REXML::XPath.each(self, lookup_param(param_name).path) { |e| yield e } end
get_by_param(param_name)
click to toggle source
Returns an XML element for the given Param object.
# File lib/wadl/xml_representation.rb, line 57 def get_by_param(param_name) REXML::XPath.first(self, lookup_param(param_name).path) end
lookup_param(name)
click to toggle source
# File lib/wadl/xml_representation.rb, line 42 def lookup_param(name) param = @params.find { |p| p.name == name } raise ArgumentError, "No such param #{name}" unless param raise ArgumentError, "Param #{name} has no path!" unless param.path param end
representation_of(format)
click to toggle source
# File lib/wadl/xml_representation.rb, line 38 def representation_of(format) @params = format.params end