Class: Osheet::Xmlss::StyleSettings

Inherits:
Object
  • Object
show all
Defined in:
lib/osheet/xmlss/style_settings.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#stylesObject (readonly)

Returns the value of attribute styles.



7
8
9
# File 'lib/osheet/xmlss/style_settings.rb', line 7

def styles
  @styles
end

#valueObject (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