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.
89 90 91 |
# File 'lib/forma/html.rb', line 89 def initialize(styles) @styles = styles end |
Instance Attribute Details
#styles ⇒ Object (readonly)
Returns the value of attribute styles.
88 89 90 |
# File 'lib/forma/html.rb', line 88 def styles @styles end |
Instance Method Details
#to_s ⇒ Object
93 94 95 96 97 |
# File 'lib/forma/html.rb', line 93 def to_s if @styles.present? %Q{style="#{@styles.map{ |k,v| "#{k}:#{v}" }.join(";")}"} end end |