class XMigra::AccessArtifactCollection

Public Class Methods

new(path, options={}) click to toggle source
# File lib/xmigra/access_artifact_collection.rb, line 7
def initialize(path, options={})
  @items = Hash.new
  db_specifics = options[:db_specifics]
  filename_metavariable = options[:filename_metavariable]
  filename_metavariable = filename_metavariable.dup.freeze if filename_metavariable
  
  XMigra.each_access_artifact(path) do |artifact|
    artifact.extend(db_specifics) if db_specifics
    artifact.filename_metavariable = filename_metavariable
    
    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

Public Instance Methods

[](name) click to toggle source
# File lib/xmigra/access_artifact_collection.rb, line 32
def [](name)
  @items[name]
end
at_path(fpath) click to toggle source
# File lib/xmigra/access_artifact_collection.rb, line 40
def at_path(fpath)
  fpath = File.expand_path(fpath)
  return find {|i| i.file_path == fpath}
end
each(&block) click to toggle source
# File lib/xmigra/access_artifact_collection.rb, line 45
def each(&block); @items.each_value(&block); end
Also aliased as: tsort_each_node
each_definition_sql() { |definition_sql| ... } click to toggle source
# File lib/xmigra/access_artifact_collection.rb, line 57
def each_definition_sql
  tsort_each do |artifact|
    yield artifact.definition_sql
  end
end
names() click to toggle source
# File lib/xmigra/access_artifact_collection.rb, line 36
def names
  @items.keys
end
tsort_each_child(node) { |items| ... } click to toggle source
# 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
tsort_each_node(&block)
Alias for: each