Sha256: 0cac8837ed51b1fcf2f6ebc4ce08104430ec5d2d4bd8567012f9fd3a9a41476e

Contents?: true

Size: 835 Bytes

Versions: 1

Compression:

Stored size: 835 Bytes

Contents

require 'hari/node/queries/list'
require 'hari/node/queries/set'
require 'hari/node/queries/sorted_set'
require 'hari/node/queries/relation'

module Hari
  class Node < Entity
    module Queries

      delegate :in, :out, to: :relation_query

      delegate :set,        :set!,        to: :set_query
      delegate :sorted_set, :sorted_set!, to: :sorted_set_query
      delegate :list,       :list!,       to: :list_query

      private

      def set_query
        Queries::Set.new query_node
      end

      def sorted_set_query
        Queries::SortedSet.new query_node
      end

      def list_query
        Queries::List.new query_node
      end

      def relation_query
        Queries::Relation::Start.new query_node
      end

      def query_node
        self.kind_of?(Hari::Node) ? self : nil
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hari-0.0.3 lib/hari/node/queries.rb