class YamlManifest

Public Class Methods

new(file) click to toggle source
# File lib/baidu_umeditor_rails/asset_manifest.rb, line 19
def initialize(file)
  @file = file
  @manifest = YAML.load_file(file)
end
try(manifest_path) click to toggle source
# File lib/baidu_umeditor_rails/asset_manifest.rb, line 14
def self.try(manifest_path)
  yaml_file = File.join(manifest_path, "manifest.yml")
  new(yaml_file) if File.exists?(yaml_file)
end

Public Instance Methods

append(logical_path, file) click to toggle source
# File lib/baidu_umeditor_rails/asset_manifest.rb, line 24
def append(logical_path, file)
  @manifest[logical_path] = logical_path
end
dump(io=nil) click to toggle source
# File lib/baidu_umeditor_rails/asset_manifest.rb, line 49
def dump(io=nil)
  YAML.dump(@manifest, io)
end
each(pattern) { |asset| ... } click to toggle source
# File lib/baidu_umeditor_rails/asset_manifest.rb, line 39
def each(pattern)
  @manifest.each_key do |asset|
    yield asset if asset =~ pattern
  end
end
remove(logical_path) click to toggle source
# File lib/baidu_umeditor_rails/asset_manifest.rb, line 28
def remove(logical_path)
  @manifest.delete(logical_path)
end
remove_digest(logical_path) { |digested, logical_path| ... } click to toggle source
# File lib/baidu_umeditor_rails/asset_manifest.rb, line 32
def remove_digest(logical_path)
  if digested = @manifest[logical_path]
    @manifest[logical_path] = logical_path
    yield digested, logical_path if block_given?
  end
end
to_s() click to toggle source
# File lib/baidu_umeditor_rails/asset_manifest.rb, line 45
def to_s
  dump
end
write() click to toggle source
# File lib/baidu_umeditor_rails/asset_manifest.rb, line 53
def write
  File.open(@file, "wb") { |f| dump(f) }
end