Class: Spreadsheetkit::Font

Inherits:
Object
  • Object
show all
Defined in:
lib/spreadsheetkit/font.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(style, inline_style) ⇒ Font

Returns a new instance of Font.



6
7
8
9
# File 'lib/spreadsheetkit/font.rb', line 6

def initialize(style, inline_style)
  @style = style
  parse inline_style
end

Instance Attribute Details

#styleObject (readonly)

Returns the value of attribute style.



4
5
6
# File 'lib/spreadsheetkit/font.rb', line 4

def style
  @style
end

Instance Method Details

#parse(inline_style) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/spreadsheetkit/font.rb', line 11

def parse(inline_style)
  inline_style.each do |attr, value|
    case attr
    when 'font-size' then font_size(value)
    when 'font-style' then font_style(value)
    when 'font-weight' then font_weight(value)
    when 'text-decoration' then font_style(value)
    when 'text-shadow' then text_shadow(value)
    when 'vertical-align' then vertial_align(value)          
    end
  end
end