diff options
| author | Randy Morgan <[email protected]> | 2012-10-14 11:28:02 +0900 |
|---|---|---|
| committer | Randy Morgan <[email protected]> | 2012-10-14 11:28:02 +0900 |
| commit | e4d4538e1ea15b6aff9e4ef3fbc47c2e29ceb8be (patch) | |
| tree | 92b9ef6e6a0d0329428e4ce1679cea6a0eff90e9 /lib/axlsx/stylesheet/border.rb | |
| parent | 9740fed4e0834c0fcdce8e07153b9b794525f37e (diff) | |
| download | caxlsx-e4d4538e1ea15b6aff9e4ef3fbc47c2e29ceb8be.tar.gz caxlsx-e4d4538e1ea15b6aff9e4ef3fbc47c2e29ceb8be.zip | |
Refactored to use options parser
Diffstat (limited to 'lib/axlsx/stylesheet/border.rb')
| -rw-r--r-- | lib/axlsx/stylesheet/border.rb | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/lib/axlsx/stylesheet/border.rb b/lib/axlsx/stylesheet/border.rb index 6c104263..422a4466 100644 --- a/lib/axlsx/stylesheet/border.rb +++ b/lib/axlsx/stylesheet/border.rb @@ -4,22 +4,7 @@ module Axlsx class Border include Axlsx::SerializedAttributes - - serializable_attributes :diagonal_up, :diagonal_down, :outline - - # @return [Boolean] The diagonal up property for the border that indicates if the border should include a diagonal line from the bottom left to the top right of the cell. - attr_reader :diagonal_up - alias :diagonalUp :diagonal_up - - # @return [Boolean] The diagonal down property for the border that indicates if the border should include a diagonal line from the top left to the top right of the cell. - attr_reader :diagonal_down - alias :diagonalDown :diagonal_down - - # @return [Boolean] The outline property for the border indicating that top, left, right and bottom borders should only be applied to the outside border of a range of cells. - attr_reader :outline - - # @return [SimpleTypedList] A list of BorderPr objects for this border. - attr_reader :prs + include Axlsx::OptionsParser # Creates a new Border object # @option options [Boolean] diagonal_up @@ -36,11 +21,25 @@ module Axlsx # @see Style#add_style def initialize(options={}) @prs = SimpleTypedList.new BorderPr - options.each do |o| - self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}=" - end + parse_options options end + serializable_attributes :diagonal_up, :diagonal_down, :outline + + # @return [Boolean] The diagonal up property for the border that indicates if the border should include a diagonal line from the bottom left to the top right of the cell. + attr_reader :diagonal_up + alias :diagonalUp :diagonal_up + + # @return [Boolean] The diagonal down property for the border that indicates if the border should include a diagonal line from the top left to the top right of the cell. + attr_reader :diagonal_down + alias :diagonalDown :diagonal_down + + # @return [Boolean] The outline property for the border indicating that top, left, right and bottom borders should only be applied to the outside border of a range of cells. + attr_reader :outline + + # @return [SimpleTypedList] A list of BorderPr objects for this border. + attr_reader :prs + # @see diagonalUp def diagonal_up=(v) Axlsx::validate_boolean v; @diagonal_up = v end alias :diagonalUp= :diagonal_up= |
