class Osheet::WorkbookElement::StyleSet

Public Class Methods

new() click to toggle source

this class is an Array with some helper methods. I want to push styles into the set using the ‘<<’ operator, only allow Osheet::Style objs to be pushed, and then be able to reference a particular set of styles using a style class.

Calls superclass method
# File lib/osheet/workbook_element.rb, line 171
def initialize
  super
end

Public Instance Methods

<<(value) click to toggle source
Calls superclass method
# File lib/osheet/workbook_element.rb, line 175
def <<(value)
  super if verify(value)
end
for(style_class=nil) click to toggle source

return the style set for the style class

# File lib/osheet/workbook_element.rb, line 180
def for(style_class=nil)
  style_class.nil? ? self : self.select{|s| s.match?(style_class)}
end

Private Instance Methods

verify(style) click to toggle source

verify the style, otherwise ArgumentError it up

# File lib/osheet/workbook_element.rb, line 187
def verify(style)
  if style.kind_of?(Style)
    true
  else
    raise ArgumentError, 'you can only push Osheet::Style objs to the style set'
  end
end