Class: Dragonfly::UrlAttributes
- Defined in:
- lib/dragonfly/url_attributes.rb
Overview
UrlAttributes is like a normal hash, but treats :name, :ext and :basename specially - updating ext/basename also updates the name
Constant Summary collapse
- SPECIAL_KEYS =
[:name, :basename, :ext]
Instance Method Summary collapse
Methods inherited from Hash
Instance Method Details
#name ⇒ Object
12 13 14 |
# File 'lib/dragonfly/url_attributes.rb', line 12 def name self[:name] end |
#name=(name) ⇒ Object
16 17 18 |
# File 'lib/dragonfly/url_attributes.rb', line 16 def name=(name) self[:name] = name end |
#slice(*keys) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/dragonfly/url_attributes.rb', line 20 def slice(*keys) keys.inject({}) do |hash, key| key = key.to_sym hash[key] = SPECIAL_KEYS.include?(key) ? send(key) : self[key] hash end end |