Class: Middleman::Sprockets::ResourceStore
- Inherits:
-
Object
- Object
- Middleman::Sprockets::ResourceStore
- Includes:
- Contracts
- Defined in:
- lib/middleman-sprockets/resource_store.rb
Instance Attribute Summary collapse
-
#store ⇒ Object
readonly
Returns the value of attribute store.
Instance Method Summary collapse
- #add(resource) ⇒ Object
- #find_by_path(path) ⇒ Object
-
#initialize ⇒ ResourceStore
constructor
A new instance of ResourceStore.
- #matching_path?(path) ⇒ Boolean
- #paths ⇒ Object
- #resources ⇒ Object
Constructor Details
#initialize ⇒ ResourceStore
Returns a new instance of ResourceStore.
8 9 10 |
# File 'lib/middleman-sprockets/resource_store.rb', line 8 def initialize @store = {} end |
Instance Attribute Details
#store ⇒ Object (readonly)
Returns the value of attribute store.
6 7 8 |
# File 'lib/middleman-sprockets/resource_store.rb', line 6 def store @store end |
Instance Method Details
#add(resource) ⇒ Object
13 14 15 |
# File 'lib/middleman-sprockets/resource_store.rb', line 13 def add resource store[resource.file_descriptor.full_path] = resource end |
#find_by_path(path) ⇒ Object
33 34 35 36 |
# File 'lib/middleman-sprockets/resource_store.rb', line 33 def find_by_path path path = Pathname.new(path) unless path.is_a?(Pathname) store.fetch path, nil end |
#matching_path?(path) ⇒ Boolean
28 29 30 |
# File 'lib/middleman-sprockets/resource_store.rb', line 28 def matching_path? path paths.include?(path) end |
#paths ⇒ Object
23 24 25 |
# File 'lib/middleman-sprockets/resource_store.rb', line 23 def paths store.keys end |
#resources ⇒ Object
18 19 20 |
# File 'lib/middleman-sprockets/resource_store.rb', line 18 def resources store.values end |