Class: Array

Inherits:
Object show all
Includes:
ODBA::Persistable
Defined in:
lib/odba/stub.rb,
lib/odba/persistable.rb

Overview

:nodoc: all

Constant Summary

Constants included from ODBA::Persistable

ODBA::Persistable::Exact, ODBA::Persistable::Find, ODBA::Persistable::ODBA_EXCLUDE_VARS, ODBA::Persistable::ODBA_INDEXABLE, ODBA::Persistable::ODBA_PREDEFINE_EXCLUDE_VARS, ODBA::Persistable::ODBA_PREDEFINE_SERIALIZABLE, ODBA::Persistable::ODBA_PREFETCH, ODBA::Persistable::ODBA_SERIALIZABLE

Instance Attribute Summary

Attributes included from ODBA::Persistable

#odba_id, #odba_name, #odba_persistent, #odba_prefetch

Instance Method Summary collapse

Methods included from ODBA::Persistable

append_features, #dup, #eql?, #odba_add_observer, #odba_delete, #odba_delete_observer, #odba_delete_observers, #odba_dup, #odba_exclude_vars, #odba_indexable?, #odba_isolated_dump, #odba_isolated_store, #odba_isolated_stub, #odba_isolated_twin, #odba_notify_observers, #odba_observers, #odba_potentials, #odba_replace_stubs, #odba_serializables, #odba_snapshot, #odba_store, #odba_store_unsaved, #odba_take_snapshot, sanitize

Instance Method Details

#&(stub) ⇒ Object



141
142
143
# File 'lib/odba/stub.rb', line 141

def &(stub)
	self._odba_amp(stub.odba_instance)
end

#+(stub) ⇒ Object



145
146
147
# File 'lib/odba/stub.rb', line 145

def +(stub)
	self._odba_plus(stub.odba_instance)
end

#-(stub) ⇒ Object



149
150
151
# File 'lib/odba/stub.rb', line 149

def -(stub)
	self._odba_minus(stub.odba_instance)
end

#<=>(stub) ⇒ Object



153
154
155
# File 'lib/odba/stub.rb', line 153

def <=>(stub)
	self._odba_weight(stub.odba_instance)
end

#==(stub) ⇒ Object



157
158
159
# File 'lib/odba/stub.rb', line 157

def ==(stub)
	self._odba_equal?(stub.odba_instance)
end

#_odba_ampObject



140
# File 'lib/odba/stub.rb', line 140

alias :_odba_amp :&

#_odba_equal?Object



156
# File 'lib/odba/stub.rb', line 156

alias :_odba_equal? :==

#_odba_minusObject



148
# File 'lib/odba/stub.rb', line 148

alias :_odba_minus :-

#_odba_plusObject



144
# File 'lib/odba/stub.rb', line 144

alias :_odba_plus :+

#_odba_unionObject



160
# File 'lib/odba/stub.rb', line 160

alias :_odba_union :|

#_odba_weightObject



152
# File 'lib/odba/stub.rb', line 152

alias :_odba_weight :<=>

#odba_collectionObject



482
483
484
485
486
487
488
# File 'lib/odba/persistable.rb', line 482

def odba_collection
	coll = []
	each_with_index { |item, index|
		coll.push([index, item])	
	}
	coll
end

#odba_cut_connection(remove_object) ⇒ Object



489
490
491
492
# File 'lib/odba/persistable.rb', line 489

def odba_cut_connection(remove_object)
	super(remove_object)
	delete_if { |val| val.eql?(remove_object) }
end

#odba_prefetch?Boolean

Returns:

  • (Boolean)


493
494
495
496
497
498
# File 'lib/odba/persistable.rb', line 493

def odba_prefetch?
	super || any? { |item| 
		item.respond_to?(:odba_prefetch?) \
			&& item.odba_prefetch? 
	}
end

#odba_replace!(obj) ⇒ Object

:nodoc:



499
500
501
502
# File 'lib/odba/persistable.rb', line 499

def odba_replace!(obj) # :nodoc:
  super
  replace(obj)
end

#odba_replace_persistablesObject



503
504
505
506
# File 'lib/odba/persistable.rb', line 503

def odba_replace_persistables
	clear
	super
end

#odba_restore(collection = []) ⇒ Object



507
508
509
510
511
# File 'lib/odba/persistable.rb', line 507

def odba_restore(collection=[])
	collection.each { |key, val| 
		self[key] = val
	}
end

#odba_stubize(obj, opts = {}) ⇒ Object

:nodoc:



528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
# File 'lib/odba/persistable.rb', line 528

def odba_stubize(obj, opts={}) # :nodoc:
  return false if(frozen?)
  super
  if opts[:force]
    id = obj.odba_id
    collect! do |item|
      if item.is_a?(ODBA::Persistable) \
        && !item.is_a?(ODBA::Stub) && item.odba_id == id
        ODBA::Stub.new(id, self, obj)
      else
        item
      end
    end
    true
  else
    false
  end
end

#odba_target_idsObject



546
547
548
549
550
551
552
553
554
# File 'lib/odba/persistable.rb', line 546

def odba_target_ids
	ids = super
	self.each { |value|
		if(value.is_a?(ODBA::Persistable))
			ids.push(value.odba_id)
		end
	}
	ids.uniq
end

#odba_unsaved?(snapshot_level = nil) ⇒ Boolean

Returns:

  • (Boolean)


523
524
525
526
527
# File 'lib/odba/persistable.rb', line 523

def odba_unsaved?(snapshot_level = nil)
	super || (snapshot_level.nil? && any? { |val|
		val.is_a?(ODBA::Persistable) && val.odba_unsaved?
	} )
end

#odba_unsaved_neighbors(snapshot_level = nil) ⇒ Object



512
513
514
515
516
517
518
519
520
521
522
# File 'lib/odba/persistable.rb', line 512

def odba_unsaved_neighbors(snapshot_level = nil)
	unsaved = super
	each { |item|
		#odba_extend_enumerable(item)
		if(item.is_a?(ODBA::Persistable) \
			&& item.odba_unsaved?(snapshot_level))
			unsaved.push(item)
		end
	}
	unsaved
end

#|(stub) ⇒ Object



161
162
163
# File 'lib/odba/stub.rb', line 161

def |(stub)
	self._odba_union(stub.odba_instance)
end