Sha256: 64d7f6edfead26043b6a882ee1a9469d663dbab6e1403a237b73462d381d1de2
Contents?: true
Size: 1.97 KB
Versions: 1
Compression:
Stored size: 1.97 KB
Contents
# frozen_string_literal: true require "rom/relation" require "rom/memory/types" require "rom/memory/schema" module ROM module Memory # Relation subclass for memory adapter # # @example # class Users < ROM::Relation[:memory] # end # # @api public class Relation < ROM::Relation include Enumerable include Memory config.component.adapter = :memory config.schema.constant = Memory::Schema # @!method take(amount) # @param (see Dataset#take) # @return [Relation] # @see Dataset#take # # @!method join(*args) # @param (see Dataset#take) # @return [Relation] # @see Dataset#join # # @!method restrict(criteria = nil) # @param (see Dataset#restrict) # @return [Relation] # @see Dataset#restrict # # @!method order(*fields) # @param (see Dataset#order) # @return [Relation] # @see Dataset#order forward :take, :join, :restrict, :order # Project a relation with provided attribute names # # @param [*Array] names A list with attribute names # # @return [Memory::Relation] # # @api public def project(*names) schema.project(*names).(self) end # Rename attributes in a relation # # @api public def rename(mapping) schema.rename(mapping).(self) end # 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rom-6.0.0.alpha1 | lib/rom/memory/relation.rb |