Module: WhirledPeas::Settings::Border::Styles

Defined in:
lib/whirled_peas/settings/border.rb

Constant Summary collapse

BOLD =
Style.new(
  '', '', '', '',
  '', '',
  '', '', '',
  '', '',
  '', '', '', ''
)
SOFT =
Style.new(
  '', '', '', '',
  '', '',
  '', '', '',
  '', '',
  '', '', '', ''
)
DOUBLE =
Style.new(
  '', '', '', '',
  '', '',
  '', '', '',
  '', '',
  '', '', '', ''
)
DEFAULT =
SOFT

Class Method Summary collapse

Class Method Details

.validate!(style) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/whirled_peas/settings/border.rb', line 39

def self.validate!(style)
  return if style.nil?
  return style if style.is_a?(Border::Style)
  if style.is_a?(Symbol)
    style_class = self.const_get(style.upcase)
    return style_class if style_class.is_a?(Border::Style)
  end
  error_message = "Unsupported border style: #{style.inspect}"
  raise ArgumentError, error_message
rescue NameError
  error_message = "Unsupported border style: #{style.inspect}"
  raise ArgumentError, error_message
end