Class: Forma::Html::ClassAttr

Inherits:
Attr
  • Object
show all
Defined in:
lib/forma/html.rb

Overview

Class attribute.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(values) ⇒ ClassAttr

Returns a new instance of ClassAttr.



71
72
73
# File 'lib/forma/html.rb', line 71

def initialize(values)
  @values = values
end

Instance Attribute Details

#valuesObject (readonly)

Returns the value of attribute values.



70
71
72
# File 'lib/forma/html.rb', line 70

def values
  @values
end

Instance Method Details

#to_sObject



75
76
77
78
79
80
81
82
83
# File 'lib/forma/html.rb', line 75

def to_s
  if @values.present?
    if @values.is_a?(Array)
      %Q{class="#{@values.join(" ")}"}
    else
      %Q{class="#{@values}"}
    end
  end
end