Class: Forma::Html::SimpleAttr
Overview
Simple attribute.
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(name, value) ⇒ SimpleAttr
constructor
A new instance of SimpleAttr.
- #to_s ⇒ Object
Constructor Details
#initialize(name, value) ⇒ SimpleAttr
Returns a new instance of SimpleAttr.
54 55 56 57 |
# File 'lib/forma/html.rb', line 54 def initialize(name, value) @name = name @value = value end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
53 54 55 |
# File 'lib/forma/html.rb', line 53 def name @name end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
53 54 55 |
# File 'lib/forma/html.rb', line 53 def value @value end |
Instance Method Details
#to_s ⇒ Object
59 60 61 62 63 64 65 |
# File 'lib/forma/html.rb', line 59 def to_s if @name == 'value' %Q{#{@name}="#{ERB::Util.html_escape(@value)}"} elsif @name.present? and @value.present? %Q{#{@name}="#{ERB::Util.html_escape(@value)}"} end end |