Class: XMigra::AccessArtifactCollection
- Includes:
- Enumerable, TSort
- Defined in:
- lib/xmigra/access_artifact_collection.rb
Instance Method Summary collapse
- #[](name) ⇒ Object
- #at_path(fpath) ⇒ Object
- #each(&block) ⇒ Object (also: #tsort_each_node)
- #each_definition_sql ⇒ Object
-
#initialize(path, options = {}) ⇒ AccessArtifactCollection
constructor
A new instance of AccessArtifactCollection.
- #names ⇒ Object
- #tsort_each_child(node) ⇒ Object
Constructor Details
#initialize(path, options = {}) ⇒ AccessArtifactCollection
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/xmigra/access_artifact_collection.rb', line 7 def initialize(path, ={}) @items = Hash.new db_specifics = [:db_specifics] = [:filename_metavariable] = .dup.freeze if XMigra.each_access_artifact(path) do |artifact| artifact.extend(db_specifics) if db_specifics artifact. = if Plugin.active next unless Plugin.active.include_access_artifact?(artifact) Plugin.active.amend_access_artifact(artifact) end @items[artifact.name] = artifact end if Plugin.active Plugin.active.each_additional_access_artifact(db_specifics) do |artifact| @items[artifact.name] = artifact end end end |
Instance Method Details
#[](name) ⇒ Object
32 33 34 |
# File 'lib/xmigra/access_artifact_collection.rb', line 32 def [](name) @items[name] end |
#at_path(fpath) ⇒ Object
40 41 42 43 |
# File 'lib/xmigra/access_artifact_collection.rb', line 40 def at_path(fpath) fpath = File.(fpath) return find {|i| i.file_path == fpath} end |
#each(&block) ⇒ Object Also known as: tsort_each_node
45 |
# File 'lib/xmigra/access_artifact_collection.rb', line 45 def each(&block); @items.each_value(&block); end |
#each_definition_sql ⇒ Object
57 58 59 60 61 |
# File 'lib/xmigra/access_artifact_collection.rb', line 57 def each_definition_sql tsort_each do |artifact| yield artifact.definition_sql end end |
#names ⇒ Object
36 37 38 |
# File 'lib/xmigra/access_artifact_collection.rb', line 36 def names @items.keys end |
#tsort_each_child(node) ⇒ Object
48 49 50 51 52 |
# File 'lib/xmigra/access_artifact_collection.rb', line 48 def tsort_each_child(node) node.depends_on.each do |child| yield @items[child] end end |