Class: Hash
Overview
Constant Summary
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
#odba_id, #odba_name, #odba_persistent, #odba_prefetch
Instance Method Summary
collapse
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
179
180
181
|
# File 'lib/odba/stub.rb', line 179
def ==(stub)
self._odba_equal?(stub.odba_instance)
end
|
#_odba_equal? ⇒ Object
178
|
# File 'lib/odba/stub.rb', line 178
alias :_odba_equal? :==
|
#odba_collection ⇒ Object
567
568
569
|
# File 'lib/odba/persistable.rb', line 567
def odba_collection
self.to_a
end
|
#odba_cut_connection(remove_object) ⇒ Object
561
562
563
564
565
566
|
# File 'lib/odba/persistable.rb', line 561
def odba_cut_connection(remove_object)
super(remove_object)
delete_if { |key, val|
key.eql?(remove_object) || val.eql?(remove_object)
}
end
|
#odba_prefetch? ⇒ Boolean
570
571
572
573
574
575
|
# File 'lib/odba/persistable.rb', line 570
def odba_prefetch?
super || any? { |item|
item.respond_to?(:odba_prefetch?) \
&& item.odba_prefetch?
}
end
|
#odba_replace!(obj) ⇒ Object
576
577
578
579
|
# File 'lib/odba/persistable.rb', line 576
def odba_replace!(obj) super
replace(obj)
end
|
#odba_replace_persistables ⇒ Object
580
581
582
583
|
# File 'lib/odba/persistable.rb', line 580
def odba_replace_persistables
clear
super
end
|
#odba_restore(collection = []) ⇒ Object
584
585
586
587
588
|
# File 'lib/odba/persistable.rb', line 584
def odba_restore(collection=[])
collection.each { |key, val|
self[key] = val
}
end
|
#odba_stubize(obj, opts = {}) ⇒ Object
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
|
# File 'lib/odba/persistable.rb', line 608
def odba_stubize(obj, opts={}) return false if(frozen?)
super
if opts[:force]
dup = {}
each do |pair|
pair.odba_stubize(obj)
dup.store *pair
end
replace dup
true
else
false
end
end
|
#odba_target_ids ⇒ Object
623
624
625
626
627
628
629
630
631
632
633
634
|
# File 'lib/odba/persistable.rb', line 623
def odba_target_ids
ids = super
self.each { |key, value|
if(value.is_a?(ODBA::Persistable))
ids.push(value.odba_id)
end
if(key.is_a?(ODBA::Persistable))
ids.push(key.odba_id)
end
}
ids.uniq
end
|
#odba_unsaved?(snapshot_level = nil) ⇒ Boolean
589
590
591
592
593
594
|
# File 'lib/odba/persistable.rb', line 589
def odba_unsaved?(snapshot_level = nil)
super || (snapshot_level.nil? && any? { |key, val|
val.is_a?(ODBA::Persistable) && val.odba_unsaved? \
|| key.is_a?(ODBA::Persistable) && key.odba_unsaved?
})
end
|
#odba_unsaved_neighbors(snapshot_level = nil) ⇒ Object
595
596
597
598
599
600
601
602
603
604
605
606
607
|
# File 'lib/odba/persistable.rb', line 595
def odba_unsaved_neighbors(snapshot_level = nil)
unsaved = super
each { |pair|
pair.each { |item|
if(item.is_a?(ODBA::Persistable)\
&& item.odba_unsaved?(snapshot_level))
unsaved.push(item)
end
}
}
unsaved
end
|