class SyncSign::Widget

Widgets are UI elements that are placed onto a Template for rendering.

Public Class Methods

check_colours(colours) click to toggle source

Check a set of colours to make sure they're all valid. Will raise ArgumentError if any elements are not valid colours. @param colours [Array] An array of symbols to check.

# File lib/syncsign/widget-core.rb, line 59
def self.check_colours(colours)
  colours.each do |colour|
    next if [:white, :black, :red].include? colour
    raise ArgumentError, "Colour must be :white, :black, or :red."
  end
end
check_patterns(patterns) click to toggle source

Check a set of patterns to make sure they're all valid. Will raise ArgumentError if any elements are not valid patterns. @param patterns [Array] An array of symbols to check.

# File lib/syncsign/widget-core.rb, line 69
def self.check_patterns(patterns)
  patterns.each do |pattern|
    next if [:solid, :interleave, :dash_tiny, :dash_medium, :dash_wide, :none].include? pattern
    raise ArgumentError, "Pattern must be :solid, :interleave, :dash_tiny, :dash_medium, :dash_wide, or :none."
  end
end