Class: Osheet::Xmlss::StyleSettings
- Inherits:
-
Object
- Object
- Osheet::Xmlss::StyleSettings
- Defined in:
- lib/osheet/xmlss/style_settings.rb
Instance Attribute Summary collapse
-
#styles ⇒ Object
readonly
Returns the value of attribute styles.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #[](setting) ⇒ Object
-
#initialize(styles) ⇒ StyleSettings
constructor
A new instance of StyleSettings.
-
#setting(s, &block) ⇒ Object
call the given block passing it the setting if that setting exists and is not empty.
Constructor Details
#initialize(styles) ⇒ StyleSettings
Returns a new instance of StyleSettings.
9 10 11 12 13 14 |
# File 'lib/osheet/xmlss/style_settings.rb', line 9 def initialize(styles) @styles = styles @value = @styles.inject({}) do |value, style| merged_settings(value, style_settings(style)) end end |
Instance Attribute Details
#styles ⇒ Object (readonly)
Returns the value of attribute styles.
7 8 9 |
# File 'lib/osheet/xmlss/style_settings.rb', line 7 def styles @styles end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
7 8 9 |
# File 'lib/osheet/xmlss/style_settings.rb', line 7 def value @value end |
Instance Method Details
#[](setting) ⇒ Object
16 |
# File 'lib/osheet/xmlss/style_settings.rb', line 16 def [](setting); @value[setting]; end |
#setting(s, &block) ⇒ Object
call the given block passing it the setting if that setting exists and is not empty
20 21 22 |
# File 'lib/osheet/xmlss/style_settings.rb', line 20 def setting(s, &block) block.call if self.value[s] && !self.value[s].empty? end |