class Cult::Artifact

I'd love to just call this “File”, but the ambiguity with ::File would make it a pain.

Attributes

path[R]
role[R]

Public Class Methods

all_for_role(project, role) { |new_file| ... } click to toggle source
# File lib/cult/artifact.rb, line 36
def self.all_for_role(project, role)
  Dir.glob(File.join(role.path, "files", "**/*")).map do |filename|
    next if File.directory?(filename)
    new(role, filename).tap do |new_file|
      yield new_file if block_given?
    end
  end.compact.to_named_array
end
collection_name() click to toggle source
# File lib/cult/artifact.rb, line 11
def self.collection_name
  "files"
end
new(role, path) click to toggle source
# File lib/cult/artifact.rb, line 24
def initialize(role, path)
  @role = role
  @path = path
end

Public Instance Methods

inspect() click to toggle source
# File lib/cult/artifact.rb, line 30
def inspect
  "\#<#{self.class.name} role:#{role&.name.inspect} name:#{name.inspect}>"
end
Also aliased as: to_s
relative_path() click to toggle source
# File lib/cult/artifact.rb, line 16
def relative_path
  name
end
to_s()
Alias for: inspect