diff options
| author | Randy Morgan <[email protected]> | 2012-10-14 12:02:40 +0900 |
|---|---|---|
| committer | Randy Morgan <[email protected]> | 2012-10-14 12:02:40 +0900 |
| commit | 5b5410845447772f4ba01b2ee5d03907f5897e7a (patch) | |
| tree | ce66d2add8423cf23b1c1a0bc35162c7447075ee /lib/axlsx/stylesheet/font.rb | |
| parent | a441bc1ff24c5b238203adb49b6e7ce208d5dabf (diff) | |
| download | caxlsx-5b5410845447772f4ba01b2ee5d03907f5897e7a.tar.gz caxlsx-5b5410845447772f4ba01b2ee5d03907f5897e7a.zip | |
Refactored to use options parser and serialized attributes
Diffstat (limited to 'lib/axlsx/stylesheet/font.rb')
| -rw-r--r-- | lib/axlsx/stylesheet/font.rb | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/lib/axlsx/stylesheet/font.rb b/lib/axlsx/stylesheet/font.rb index d35aebf8..03da52e5 100644 --- a/lib/axlsx/stylesheet/font.rb +++ b/lib/axlsx/stylesheet/font.rb @@ -4,6 +4,27 @@ module Axlsx # @note The recommended way to manage fonts, and other styles is Styles#add_style # @see Styles#add_style class Font + include Axlsx::OptionsParser + + # Creates a new Font + # @option options [String] name + # @option options [Integer] charset + # @option options [Integer] family + # @option options [Integer] family + # @option options [Boolean] b + # @option options [Boolean] i + # @option options [Boolean] u + # @option options [Boolean] strike + # @option options [Boolean] outline + # @option options [Boolean] shadow + # @option options [Boolean] condense + # @option options [Boolean] extend + # @option options [Color] color + # @option options [Integer] sz + def initialize(options={}) + parse_options options + end + # The name of the font # @return [String] attr_reader :name @@ -86,28 +107,7 @@ module Axlsx # @return [Integer] attr_reader :sz - # Creates a new Font - # @option options [String] name - # @option options [Integer] charset - # @option options [Integer] family - # @option options [Integer] family - # @option options [Boolean] b - # @option options [Boolean] i - # @option options [Boolean] u - # @option options [Boolean] strike - # @option options [Boolean] outline - # @option options [Boolean] shadow - # @option options [Boolean] condense - # @option options [Boolean] extend - # @option options [Color] color - # @option options [Integer] sz - def initialize(options={}) - options.each do |o| - next if o[1].nil? - self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}=" - end - end - # @see name + # @see name def name=(v) Axlsx::validate_string v; @name = v end # @see charset def charset=(v) Axlsx::validate_unsigned_int v; @charset = v end |
