Sha256: a13a60fae4f5a6ee3f59fa729d5e92e60350d233e161242dbeda259163c0d434
Contents?: true
Size: 1.37 KB
Versions: 3
Compression:
Stored size: 1.37 KB
Contents
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 adapter :memory schema_class Memory::Schema 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rom-core-4.1.2 | lib/rom/memory/relation.rb |
rom-core-4.1.1 | lib/rom/memory/relation.rb |
rom-core-4.1.0 | lib/rom/memory/relation.rb |