Sha256: f2b8d15ad8498ff52efc6e96f933b80fdfd805224c2e6d5736dd695c04440559

Contents?: true

Size: 885 Bytes

Versions: 11

Compression:

Stored size: 885 Bytes

Contents

module ROM
  module Memory
    # Relation subclass for memory adapter
    #
    # @example
    #   class Users < ROM::Relation[:memory]
    #   end
    #
    # @api public
    class Relation < ROM::Relation
      include Enumerable

      adapter :memory

      forward :take, :join, :project, :restrict, :order

      # Insert tuples into the relation
      #
      # @example
      #   users.insert(name: 'Jane')
      #
      # @return [Relation]
      #
      # @api public
      def insert(*args)
        dataset.insert(*args)
        self
      end
      alias_method :<<, :insert

      # Delete tuples from the relation
      #
      # @example
      #   users.insert(name: 'Jane')
      #   users.delete(name: 'Jane')
      #
      # @return [Relation]
      #
      # @api public
      def delete(*args)
        dataset.delete(*args)
        self
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
rom-1.0.0 lib/rom/memory/relation.rb
rom-1.0.0.rc1 lib/rom/memory/relation.rb
rom-1.0.0.beta2 lib/rom/memory/relation.rb
rom-1.0.0.beta1 lib/rom/memory/relation.rb
rom-0.9.1 lib/rom/memory/relation.rb
rom-0.9.0 lib/rom/memory/relation.rb
rom-0.9.0.rc1 lib/rom/memory/relation.rb
rom-0.9.0.beta1 lib/rom/memory/relation.rb
rom-0.8.1 lib/rom/memory/relation.rb
rom-0.8.0 lib/rom/memory/relation.rb
rom-0.7.1 lib/rom/memory/relation.rb