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.



87
88
89
# File 'lib/forma/html.rb', line 87

def initialize(styles)
  @styles = styles
end

Instance Attribute Details

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



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