Sha256: 2dbbaf3b450a74ce745c85d461d9352fd4c8cac4732109b3b51369bbfc84c213

Contents?: true

Size: 920 Bytes

Versions: 1

Compression:

Stored size: 920 Bytes

Contents

module Hari
  class Node < Entity
    module Queries
      autoload :Relation, 'hari/node/queries/relation'
      autoload :Type,     'hari/node/queries/type'

      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
      delegate :string,     :string!,     to: :string_query

      private

      def set_query
        Keys::Set.new query_node
      end

      def sorted_set_query
        Keys::SortedSet.new query_node
      end

      def list_query
        Keys::List.new query_node
      end

      def string_query
        Keys::String.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.4 lib/hari/node/queries.rb