Class: Gumdrop::SpecialContentList
- Inherits:
-
ContentList
- Object
- Hash
- ContentList
- Gumdrop::SpecialContentList
- Defined in:
- lib/gumdrop/content.rb
Overview
Keeps a ref to content at full path and just the basename
Instance Method Summary collapse
- #add(content, uri = nil) ⇒ Object
-
#find(uri) ⇒ Object
Find isn’t fuzzy for Special Content.
-
#initialize(default_ext = false) ⇒ SpecialContentList
constructor
, *args).
- #remove(content) ⇒ Object
Methods inherited from ContentList
Methods inherited from Hash
#ends_with?, #starts_with?, #to_hash_object, #to_symbolized_hash
Constructor Details
#initialize(default_ext = false) ⇒ SpecialContentList
, *args)
222 223 224 225 |
# File 'lib/gumdrop/content.rb', line 222 def initialize(default_ext=false)#, *args) @ext= default_ext || ".html" # ??? super() end |
Instance Method Details
#add(content, uri = nil) ⇒ Object
227 228 229 230 231 232 233 |
# File 'lib/gumdrop/content.rb', line 227 def add(content, uri=nil) uri= content.uri if uri.nil? buri = File.basename uri self[uri]= content self[buri]= content content end |
#find(uri) ⇒ Object
Find isn’t fuzzy for Special Content. It looks for full uri or the uri’s basename, optionally tacking on @ext
243 244 245 246 247 248 249 |
# File 'lib/gumdrop/content.rb', line 243 def find(uri) _try_variations_of(uri) do |path| content= get path return [content] unless content.nil? end unless uri.nil? [] end |
#remove(content) ⇒ Object
235 236 237 238 239 |
# File 'lib/gumdrop/content.rb', line 235 def remove(content) uri = content.is_a? String ? content : content.uri self.delete uri self.delete File.basename uri end |