Sha256: 4ddcd478e5f59fab44866e9997736585b296aabb795038a41363a3063108b2ea

Contents?: true

Size: 598 Bytes

Versions: 4

Compression:

Stored size: 598 Bytes

Contents

module Osheet; end
module Osheet::StyledElement

  def style_class(value=nil)
    if value.nil?
      instance_variable_get("@style_class")
    else
      instance_variable_set("@style_class", verify_style_class(value))
    end
  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

4 entries across 4 versions & 1 rubygems

Version Path
osheet-1.0.0.rc.4 lib/osheet/styled_element.rb
osheet-1.0.0.rc.3 lib/osheet/styled_element.rb
osheet-1.0.0.rc.2 lib/osheet/styled_element.rb
osheet-1.0.0.rc.1 lib/osheet/styled_element.rb