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.



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

def initialize(values)
  @values = values
end

Instance Attribute Details

#valuesObject (readonly)

Returns the value of attribute values.



68
69
70
# File 'lib/forma/html.rb', line 68

def values
  @values
end

Instance Method Details

#to_sObject



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

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