Class: StrokeDB::Document::MetaModulesCollector
- Defined in:
- lib/strokedb/document.rb
Instance Method Summary collapse
- #at_top_level?(mod) ⇒ Boolean
- #collect! ⇒ Object
- #has_defined_constant_for_meta?(mod, metadoc) ⇒ Boolean
- #has_meta_definition?(mod, metadoc) ⇒ Boolean
-
#initialize(store, subject) ⇒ MetaModulesCollector
constructor
A new instance of MetaModulesCollector.
- #lookup_version_for_meta(meta) ⇒ Object
- #resolve_module_name(uuid) ⇒ Object
- #top_level_meta?(mod, doc) ⇒ Boolean
Constructor Details
#initialize(store, subject) ⇒ MetaModulesCollector
Returns a new instance of MetaModulesCollector.
680 681 682 683 |
# File 'lib/strokedb/document.rb', line 680 def initialize(store, subject) @store = store @subject = subject end |
Instance Method Details
#at_top_level?(mod) ⇒ Boolean
697 698 699 |
# File 'lib/strokedb/document.rb', line 697 def at_top_level?(mod) mod == Module || mod.nil? end |
#collect! ⇒ Object
701 702 703 704 705 706 707 708 709 710 711 712 713 714 |
# File 'lib/strokedb/document.rb', line 701 def collect! = [] case @subject when VERSIONREF, DOCREF << resolve_module_name($1) when Array = @subject.map { |subj| subj = MetaModulesCollector.new(@store, subj).collect! }.flatten when Document << @subject[:name] end end |
#has_defined_constant_for_meta?(mod, metadoc) ⇒ Boolean
724 725 726 |
# File 'lib/strokedb/document.rb', line 724 def (mod, ) (mod, ) || (mod, ) end |
#has_meta_definition?(mod, metadoc) ⇒ Boolean
732 733 734 |
# File 'lib/strokedb/document.rb', line 732 def (mod, ) (mod && mod.constants.include?([:name])) end |
#lookup_version_for_meta(meta) ⇒ Object
716 717 718 719 720 721 722 |
# File 'lib/strokedb/document.rb', line 716 def () version = case when VERSIONREF then $2 else nil end version end |
#resolve_module_name(uuid) ⇒ Object
685 686 687 688 689 690 691 692 693 694 695 |
# File 'lib/strokedb/document.rb', line 685 def resolve_module_name(uuid) if = @store.find(uuid, self.(@subject)) mod = Module.find_by_nsurl([:nsurl]) if self.(mod, ) at_top_level?(mod) ? "::#{[:name]}" : "#{mod.name}::#{[:name]}" else Meta.resolve_uuid_name([:nsurl], [:name]) end end end |