Class: Forma::Html::StyleAttr
Overview
Style attribute.
Instance Attribute Summary collapse
-
#styles ⇒ Object
readonly
Returns the value of attribute styles.
Instance Method Summary collapse
-
#initialize(styles) ⇒ StyleAttr
constructor
A new instance of StyleAttr.
- #to_s ⇒ Object
Constructor Details
#initialize(styles) ⇒ StyleAttr
Returns a new instance of StyleAttr.
87 88 89 |
# File 'lib/forma/html.rb', line 87 def initialize(styles) @styles = styles end |
Instance Attribute Details
#styles ⇒ Object (readonly)
Returns the value of attribute styles.
86 87 88 |
# File 'lib/forma/html.rb', line 86 def styles @styles end |
Instance Method Details
#to_s ⇒ Object
91 92 93 94 95 |
# File 'lib/forma/html.rb', line 91 def to_s if @styles.present? %Q{style="#{@styles.map{ |k,v| "#{k}:#{v}" }.join(";")}"} end end |