Class: Styles::Properties::MatchFontWeight

Inherits:
Base
  • Object
show all
Defined in:
lib/styles/properties/match_font_weight.rb

Constant Summary collapse

COLOR_PROPERTY_TYPE =
:match
VALUES =
[:normal, :bold].freeze

Instance Attribute Summary

Attributes inherited from Base

#name, #selector, #value

Instance Method Summary collapse

Methods inherited from Base

#colors, #initialize, multiple_names?, names, other_names, sub_engine, sub_engines, to_sym

Constructor Details

This class inherits a constructor from Styles::Properties::Base

Instance Method Details

#color_to_useObject



14
15
16
17
18
19
20
# File 'lib/styles/properties/match_font_weight.rb', line 14

def color_to_use
  if value.is_a? Array
    value.map { |sub_value| sub_value == :normal ? :no_bold : sub_value }
  elsif value.is_a? Symbol
    value == :normal ? :no_bold : value
  end
end

#valid_value?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/styles/properties/match_font_weight.rb', line 10

def valid_value?
  [value].flatten.all? { |sub_value| VALUES.include?(sub_value) }
end