lib/pmp/link.rb in pmp-0.5.0 vs lib/pmp/link.rb in pmp-0.5.1

- old
+ new

@@ -25,14 +25,18 @@ attr_accessor :params def initialize(link={}, parent=nil) super() - self.parent = parent || link.delete('parent') || PMP::CollectionDocument.new + self.parent = parent || link.delete('parent') self.params = link.delete('params') || {} # puts "params: #{params.inspect}" parse_attributes(link) [:href, :href_template, :method].each{|m| self.send("#{m}=", nil) unless respond_to?(m)} + end + + def parent + @parent ||= PMP::CollectionDocument.new end def where(params={}) self.class.new(attributes_map.merge({'params'=>params}), parent) end