Class: TinyMCE::YamlManifest
- Inherits:
-
Object
- Object
- TinyMCE::YamlManifest
- Defined in:
- lib/tinymce/rails/asset_manifest.rb
Class Method Summary collapse
Instance Method Summary collapse
- #append(logical_path, file) ⇒ Object
- #dump(io = nil) ⇒ Object
- #each(pattern) ⇒ Object
-
#initialize(file) ⇒ YamlManifest
constructor
A new instance of YamlManifest.
- #remove(logical_path) ⇒ Object
- #remove_digest(logical_path) ⇒ Object
- #to_s ⇒ Object
- #write ⇒ Object
Constructor Details
#initialize(file) ⇒ YamlManifest
Returns a new instance of YamlManifest.
20 21 22 23 |
# File 'lib/tinymce/rails/asset_manifest.rb', line 20 def initialize(file) @file = file @manifest = YAML.load_file(file) end |
Class Method Details
.try(manifest_path) ⇒ Object
15 16 17 18 |
# File 'lib/tinymce/rails/asset_manifest.rb', line 15 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
25 26 27 |
# File 'lib/tinymce/rails/asset_manifest.rb', line 25 def append(logical_path, file) @manifest[logical_path] = logical_path end |
#dump(io = nil) ⇒ Object
50 51 52 |
# File 'lib/tinymce/rails/asset_manifest.rb', line 50 def dump(io=nil) YAML.dump(@manifest, io) end |
#each(pattern) ⇒ Object
40 41 42 43 44 |
# File 'lib/tinymce/rails/asset_manifest.rb', line 40 def each(pattern) @manifest.each_key do |asset| yield asset if asset =~ pattern end end |
#remove(logical_path) ⇒ Object
29 30 31 |
# File 'lib/tinymce/rails/asset_manifest.rb', line 29 def remove(logical_path) @manifest.delete(logical_path) end |
#remove_digest(logical_path) ⇒ Object
33 34 35 36 37 38 |
# File 'lib/tinymce/rails/asset_manifest.rb', line 33 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 ⇒ Object
46 47 48 |
# File 'lib/tinymce/rails/asset_manifest.rb', line 46 def to_s dump end |
#write ⇒ Object
54 55 56 |
# File 'lib/tinymce/rails/asset_manifest.rb', line 54 def write File.open(@file, "wb") { |f| dump(f) } end |