Class: AxlsxEnhanced::Helpers::Styles::StyleCollection
- Inherits:
-
Object
- Object
- AxlsxEnhanced::Helpers::Styles::StyleCollection
- Defined in:
- lib/axlsx_enhanced/helpers/styles/style_collection.rb
Instance Method Summary collapse
- #add(args) ⇒ Object
- #collection ⇒ Object
- #find(name) ⇒ Object
-
#initialize(worksheet, items = []) ⇒ StyleCollection
constructor
A new instance of StyleCollection.
- #worksheet ⇒ Object
Constructor Details
#initialize(worksheet, items = []) ⇒ StyleCollection
Returns a new instance of StyleCollection.
5 6 7 8 9 10 |
# File 'lib/axlsx_enhanced/helpers/styles/style_collection.rb', line 5 def initialize(worksheet, items = []) @worksheet = worksheet @collection = [] self.add(items) end |
Instance Method Details
#add(args) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/axlsx_enhanced/helpers/styles/style_collection.rb', line 20 def add(args) items = args.is_a?(Array) ? args : [args] items.each do |item| self.collection.push AxlsxEnhanced::Helpers::Styles::Style.new(item) end end |
#collection ⇒ Object
16 17 18 |
# File 'lib/axlsx_enhanced/helpers/styles/style_collection.rb', line 16 def collection return @collection end |
#find(name) ⇒ Object
28 29 30 |
# File 'lib/axlsx_enhanced/helpers/styles/style_collection.rb', line 28 def find(name) return @collection.find { |x| x.name == name.to_sym } end |
#worksheet ⇒ Object
12 13 14 |
# File 'lib/axlsx_enhanced/helpers/styles/style_collection.rb', line 12 def worksheet return @worksheet end |