module Cura::Attributes::HasColors
Adds the foreground and background attributes. TODO: Should be color and background… HasBackground and HasColor
Public Class Methods
new(attributes={})
click to toggle source
Calls superclass method
Cura::Attributes::HasAttributes::new
# File lib/cura/attributes/has_colors.rb, line 16 def initialize(attributes={}) @foreground = :inherit unless instance_variable_defined?(:@foreground) @background = :inherit unless instance_variable_defined?(:@background) super end
Protected Instance Methods
validate_color_attribute(value)
click to toggle source
# File lib/cura/attributes/has_colors.rb, line 51 def validate_color_attribute(value) unless value.is_a?(Cura::Color) value = value.to_sym if [:black, :white, :red, :green, :blue].include?(value) value = Cura::Color.send(value) else raise Error::InvalidColor unless value == :inherit end end value end