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
#==(other) ⇒ Object
192
193
194
|
# File 'lib/odba/stub.rb', line 192
def ==(other)
_odba_equal?(other.odba_instance)
end
|
#_odba_equal? ⇒ Object
191
|
# File 'lib/odba/stub.rb', line 191
alias_method :_odba_equal?, :==
|
#odba_collection ⇒ Object
605
606
607
|
# File 'lib/odba/persistable.rb', line 605
def odba_collection
to_a
end
|
#odba_cut_connection(remove_object) ⇒ Object
598
599
600
601
602
603
|
# File 'lib/odba/persistable.rb', line 598
def odba_cut_connection(remove_object)
super
delete_if { |key, val|
key.eql?(remove_object) || val.eql?(remove_object)
}
end
|
#odba_prefetch? ⇒ Boolean
609
610
611
612
613
614
|
# File 'lib/odba/persistable.rb', line 609
def odba_prefetch?
super || any? { |item|
item.respond_to?(:odba_prefetch?) \
&& item.odba_prefetch?
}
end
|
#odba_replace!(obj) ⇒ Object
616
617
618
619
|
# File 'lib/odba/persistable.rb', line 616
def odba_replace!(obj) super
replace(obj)
end
|
#odba_replace_persistables ⇒ Object
621
622
623
624
|
# File 'lib/odba/persistable.rb', line 621
def odba_replace_persistables
clear
super
end
|
#odba_restore(collection = []) ⇒ Object
626
627
628
629
630
|
# File 'lib/odba/persistable.rb', line 626
def odba_restore(collection = [])
collection.each { |key, val|
self[key] = val
}
end
|
#odba_stubize(obj, opts = {}) ⇒ Object
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
|
# File 'lib/odba/persistable.rb', line 653
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
669
670
671
672
673
674
675
676
677
678
679
680
|
# File 'lib/odba/persistable.rb', line 669
def odba_target_ids
ids = super
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
632
633
634
635
636
637
|
# File 'lib/odba/persistable.rb', line 632
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
639
640
641
642
643
644
645
646
647
648
649
650
651
|
# File 'lib/odba/persistable.rb', line 639
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
|