Sha256: 995f32341ec62172fd0615890a7478d491969eaafc1b2ac2edc8ec81aad9e39f

Contents?: true

Size: 865 Bytes

Versions: 6

Compression:

Stored size: 865 Bytes

Contents

require 'xmlss/style/base'

module Xmlss::Style
  class Alignment

    def self.writer; :alignment; end

    include Enumeration
    enum :horizontal, {
      :automatic => "Automatic",
      :left => "Left",
      :center => "Center",
      :right => "Right"
    }
    enum :vertical, {
      :automatic => "Automatic",
      :top => "Top",
      :center => "Center",
      :bottom => "Bottom"
    }

    attr_accessor :wrap_text, :rotate

    def initialize(attrs={})
      self.wrap_text = attrs[:wrap_text] || false
      self.rotate = attrs[:rotate]
      self.horizontal = attrs[:horizontal]
      self.vertical = attrs[:vertical]
    end

    def wrap_text?; !!self.wrap_text; end

    def rotate=(value)
      @rotate = if value.kind_of?(::Numeric)
        value <= 90 && value >= -90 ? value.round : nil
      else
        nil
      end
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
xmlss-1.0.1 lib/xmlss/style/alignment.rb
xmlss-1.0.0 lib/xmlss/style/alignment.rb
xmlss-1.0.0.rc.4 lib/xmlss/style/alignment.rb
xmlss-1.0.0.rc.3 lib/xmlss/style/alignment.rb
xmlss-1.0.0.rc.2 lib/xmlss/style/alignment.rb
xmlss-1.0.0.rc.1 lib/xmlss/style/alignment.rb