Class: TinyMCE::Rails::YamlManifest

Inherits:
AssetManifest show all
Defined in:
lib/tinymce/rails/asset_manifest.rb

Instance Attribute Summary

Attributes inherited from AssetManifest

#file

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from AssetManifest

#asset_path, #each, load, #to_s

Constructor Details

#initialize(file) ⇒ YamlManifest

Returns a new instance of YamlManifest.



43
44
45
46
# File 'lib/tinymce/rails/asset_manifest.rb', line 43

def initialize(file)
  @file = file
  @manifest = YAML.load_file(file)
end

Class Method Details

.try(manifest_path) ⇒ Object



38
39
40
41
# File 'lib/tinymce/rails/asset_manifest.rb', line 38

def self.try(manifest_path)
  yaml_file = File.join(manifest_path, "manifest.yml")
  new(yaml_file) if File.exists?(yaml_file)
end

Instance Method Details

#append(logical_path, file) ⇒ Object



48
49
50
# File 'lib/tinymce/rails/asset_manifest.rb', line 48

def append(logical_path, file)
  assets[logical_path] = logical_path
end

#assetsObject



64
65
66
# File 'lib/tinymce/rails/asset_manifest.rb', line 64

def assets
  @manifest
end

#dump(io = nil) ⇒ Object



68
69
70
# File 'lib/tinymce/rails/asset_manifest.rb', line 68

def dump(io=nil)
  YAML.dump(@manifest, io)
end

#remove(logical_path) ⇒ Object



52
53
54
# File 'lib/tinymce/rails/asset_manifest.rb', line 52

def remove(logical_path)
  assets.delete(logical_path)
end

#remove_digest(logical_path) ⇒ Object



56
57
58
59
60
61
62
# File 'lib/tinymce/rails/asset_manifest.rb', line 56

def remove_digest(logical_path)
  asset_path(logical_path) do |digested, logical_path|
    assets[logical_path] = logical_path

    yield digested, logical_path if block_given?
  end
end

#writeObject



72
73
74
# File 'lib/tinymce/rails/asset_manifest.rb', line 72

def write
  File.open(@file, "wb") { |f| dump(f) }
end