Class: Bmg::Relation::InMemory

Inherits:
Object
  • Object
show all
Includes:
Bmg::Relation
Defined in:
lib/bmg/relation/in_memory.rb,
lib/bmg/relation/in_memory/mutable.rb

Direct Known Subclasses

Mutable

Defined Under Namespace

Classes: Mutable

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Bmg::Relation

#bind, #count, #debug, #delete, empty, #empty?, #insert, new, #one, #one_or_nil, #to_csv, #to_json, #to_xlsx, #update, #visit, #with_type, #with_type_attrlist, #with_typecheck, #without_typecheck, #y_by_x, #ys_by_x

Methods included from Algebra

#allbut, #autosummarize, #autowrap, #constants, #extend, #group, #image, #join, #left_join, #matching, #materialize, #minus, #not_matching, #page, #project, #rename, #restrict, #spied, #summarize, #transform, #ungroup, #union, #unspied, #unwrap

Methods included from Algebra::Shortcuts

#cross_product, #exclude, #image, #images, #join, #left_join, #matching, #not_matching, #prefix, #rxmatch, #suffix, #ungroup, #unwrap, #where

Constructor Details

#initialize(type, operand) ⇒ InMemory

Returns a new instance of InMemory.



6
7
8
9
# File 'lib/bmg/relation/in_memory.rb', line 6

def initialize(type, operand)
  @operand = operand
  @type = type
end

Instance Attribute Details

#operandObject (readonly)

Returns the value of attribute operand.



11
12
13
# File 'lib/bmg/relation/in_memory.rb', line 11

def operand
  @operand
end

#typeObject

Returns the value of attribute type.



10
11
12
# File 'lib/bmg/relation/in_memory.rb', line 10

def type
  @type
end

Instance Method Details

#_countObject



19
20
21
22
23
24
25
26
27
# File 'lib/bmg/relation/in_memory.rb', line 19

def _count
  if operand.respond_to?(:count)
    operand.count
  elsif operand.respond_to?(:size)
    operand.size
  else
    super
  end
end

#each(&bl) ⇒ Object



15
16
17
# File 'lib/bmg/relation/in_memory.rb', line 15

def each(&bl)
  @operand.each(&bl)
end

#inspectObject



37
38
39
# File 'lib/bmg/relation/in_memory.rb', line 37

def inspect
  "(in_memory #{operand.inspect})"
end

#to_astObject



29
30
31
# File 'lib/bmg/relation/in_memory.rb', line 29

def to_ast
  [ :in_memory, operand ]
end

#to_sObject



33
34
35
# File 'lib/bmg/relation/in_memory.rb', line 33

def to_s
  "(in_memory ...)"
end