Sha256: 36481d440c770a8d09c5cee53aa933e6b4c9a2b979eddfc0151ed117433fd2dc

Contents?: true

Size: 1.16 KB

Versions: 2

Compression:

Stored size: 1.16 KB

Contents

require 'json'

require_relative 'alignment'
require_relative 'bg_color'
require_relative 'text_color'

module WhirledPeas
  module Settings
    class ElementSettings
      def self.inherit(parent)
        child = self.new
        child.inherit(parent)
        child
      end

      attr_accessor :width, :height

      def validate!
      end

      def bg_color
        @_bg_color || BgColor::DEFAULT
      end

      def bg_color=(color)
        @_bg_color = BgColor.validate!(color)
      end

      def bold?
        @_bold || false
      end

      def bold=(val)
        @_bold = val
      end

      def color
        @_color || TextColor::DEFAULT
      end

      def color=(color)
        @_color = TextColor.validate!(color)
      end

      def underline?
        @_underline || false
      end

      def underline=(val)
        @_underline = val
      end

      def inherit(parent)
        @_bg_color = parent._bg_color
        @_bold = parent._bold
        @_color = parent._color
        @_underline = parent._underline
      end

      protected

      attr_accessor :_bg_color, :_bold, :_color, :_underline
    end
    private_constant :ElementSettings
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
whirled_peas-0.9.1 lib/whirled_peas/settings/element_settings.rb
whirled_peas-0.9.0 lib/whirled_peas/settings/element_settings.rb