Class: Spritely::Options
- Inherits:
-
Struct
- Object
- Struct
- Spritely::Options
- Defined in:
- lib/spritely/options.rb
Overview
Provides a simpler method of querying a particular image’s options. Rather than each ‘Image` needing to know how to parse the keyword arguments passed into the `spritely-map` function, this simplifies and de-duplicates the passed option keys.
$application-sprite: spritely-map("application/*.png",
$arrow-repeat: true,
$arrow-spacing: 10px,
$another-image-position: right,
$spacing: 5px
);
The options passed in above will be easily accessible via an instance of this class.
['arrow'] => {repeat: true, spacing: 10}
['another-image'] => {position: 'right', spacing: 5}
Constant Summary collapse
- GLOBAL_OPTIONS =
['spacing', 'position']
Instance Attribute Summary collapse
-
#hash ⇒ Object
Returns the value of attribute hash.
Instance Method Summary collapse
Instance Attribute Details
#hash ⇒ Object
Returns the value of attribute hash
24 25 26 |
# File 'lib/spritely/options.rb', line 24 def hash @hash end |
Instance Method Details
#[](key) ⇒ Object
35 36 37 |
# File 'lib/spritely/options.rb', line 35 def [](key) [key.gsub('-', '_')] || end |
#cache_key ⇒ Object
27 28 29 |
# File 'lib/spritely/options.rb', line 27 def cache_key stripped_hash.to_s end |
#inspect ⇒ Object
31 32 33 |
# File 'lib/spritely/options.rb', line 31 def inspect "#<Spritely::Options global_options=#{} options=#{}>" end |