Sha256: 4fc7fd829664b13185ad9265869df218bc8e818e30305034dec560981744d86b

Contents?: true

Size: 553 Bytes

Versions: 5

Compression:

Stored size: 553 Bytes

Contents

require 'riak/link'

module Ripple
  module Document
    # A Link that is tied to a particular document and tag.
    # The key is fetched from the document lazily when needed.
    class Link < Riak::Link
      attr_reader :document
      private :document

      def initialize(document, tag)
        @document = document
        super(document.class.bucket_name, nil, tag)
      end

      def key
        document.key
      end

      def hash
        document.hash
      end
    end

    def to_link(tag)
      Link.new(self, tag)
    end
  end
end

Version data entries

5 entries across 5 versions & 4 rubygems

Version Path
wyngle-ripple-0.1.0 lib/ripple/document/link.rb
better-ripple-1.0.0 lib/ripple/document/link.rb
ripple-1.0.0.beta2 lib/ripple/document/link.rb
seomoz-ripple-1.0.0.pre lib/ripple/document/link.rb
ripple-1.0.0.beta lib/ripple/document/link.rb