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.



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

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

Class Method Details

.try(manifest_path) ⇒ Object



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

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

Instance Method Details

#append(logical_path, file) ⇒ Object



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

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

#assetsObject



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

def assets
  @manifest
end

#dump(io = nil) ⇒ Object



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

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

#remove(logical_path) ⇒ Object



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

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

#remove_digest(logical_path) ⇒ Object



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

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



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

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