Class: ThousandIsland::StyleHash
- Inherits:
-
Hash
- Object
- Hash
- ThousandIsland::StyleHash
- Defined in:
- lib/thousand_island/utilities/style_hash.rb
Overview
A subclass of Hash, automatically adds keys that mirror other keys to allow for a couple of small differences in the Prawn options hashes:
:font_style = :style
:styles = :style and puts it into an Array
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#initialize(style = {}) ⇒ StyleHash
constructor
A new instance of StyleHash.
Constructor Details
#initialize(style = {}) ⇒ StyleHash
Returns a new instance of StyleHash.
7 8 9 10 |
# File 'lib/thousand_island/utilities/style_hash.rb', line 7 def initialize(style={}) super() self.merge!(style) end |
Instance Method Details
#[](key) ⇒ Object
12 13 14 15 16 |
# File 'lib/thousand_island/utilities/style_hash.rb', line 12 def [](key) return self[:size] if key == :font_size return [self[:style]] if key == :styles super end |