Class: Forma::Html::StyleAttr

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

Overview

Style attribute.

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#stylesObject (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_sObject



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