Sha256: ff6d1fe91452ec532099cf9ce571c6a90c70c1e749948b63373a33795c2d33b1

Contents?: true

Size: 474 Bytes

Versions: 8

Compression:

Stored size: 474 Bytes

Contents

module Osheet::StyledElement
  def style_class(value); set_ivar(:style_class, verify_style_class(value)); end

  private

  def verify_style_class(style_class)
    if !style_class.kind_of?(::String) || invalid_style_class?(style_class)
      raise ArgumentError, "invalid style_class: '#{style_class}', cannot contain '.' or '>'"
    else
      style_class
    end
  end

  def invalid_style_class?(style_class)
    style_class =~ /\.+/ ||
    style_class =~ />+/
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
osheet-0.10.0 lib/osheet/styled_element.rb
osheet-0.9.2 lib/osheet/styled_element.rb
osheet-0.9.1 lib/osheet/styled_element.rb
osheet-0.9.0 lib/osheet/styled_element.rb
osheet-0.8.0 lib/osheet/styled_element.rb
osheet-0.7.0 lib/osheet/styled_element.rb
osheet-0.6.0 lib/osheet/styled_element.rb
osheet-0.5.0 lib/osheet/styled_element.rb