Sha256: 361df745431ff638831edc63486e3bf123f4073e4b49c4fceab397b50cfd1cc3

Contents?: true

Size: 1.13 KB

Versions: 3

Compression:

Stored size: 1.13 KB

Contents

# coding: utf-8

module Thinreports
  module Core::Shape

    class Style::Graphic < Style::Basic
      style_accessible :border_color, :border_width, :fill_color, :border

      # @method border_color
      #   @return [String]
      # @method border_color=(color)
      #   @param [String] color
      style_accessor :border_color, 'stroke'

      # @method border_width
      #   @return [String, Number]
      style_reader :border_width, 'stroke-width'

      # @method fill_color
      #   @return [String]
      # @method fill_color=(color)
      #   @param [String] color
      style_accessor :fill_color, 'fill'

      # @param [String, Number] width
      def border_width=(width)
        write_internal_style('stroke-opacity', '1') unless width.to_i.zero?
        write_internal_style('stroke-width', width)
      end

      # @return [Array<String, Number>]
      def border
        [self.border_width, self.border_color]
      end

      # @param [Array<String, Number>] width_and_color
      def border=(width_and_color)
        w, c = width_and_color
        self.border_width = w
        self.border_color = c
      end
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
thinreports-0.8.2 lib/thinreports/core/shape/style/graphic.rb
thinreports-0.8.1 lib/thinreports/core/shape/style/graphic.rb
thinreports-0.8.0 lib/thinreports/core/shape/style/graphic.rb