Sha256: 06531863b111cfc513886903035d3c411c366f468275213c9aef2db21172efbc

Contents?: true

Size: 825 Bytes

Versions: 2

Compression:

Stored size: 825 Bytes

Contents

# Class for working Underline style parameter
module OoxmlParser
  class Underline
    attr_accessor :style, :color

    def initialize(style = :none, color = nil)
      @style = (style == 'single') ? :single : style
      @color = color
    end

    def ==(other)
      if other.is_a? Underline
        @style.to_sym == other.style.to_sym && @color == other.color
      elsif other.is_a? Symbol
        @style.to_sym == other
      else
        false
      end
    end

    def to_s
      if @color.nil?
        @style.to_s
      else
        "#{@style} #{@color}"
      end
    end

    def self.parse(attribute_value)
      underline = Underline.new
      case attribute_value
      when 'sng'
        underline.style = :single
      when 'none'
        underline.style = :none
      end
      underline
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ooxml_parser-0.1.2 lib/ooxml_parser/common_parser/common_data/underline.rb
ooxml_parser-0.1.1 lib/ooxml_parser/common_parser/common_data/underline.rb