Class: Maglove::Widget::V2

Inherits:
Base
  • Object
show all
Defined in:
lib/maglove/widget.rb

Instance Attribute Summary

Attributes inherited from Base

#options, #scope

Instance Method Summary collapse

Methods inherited from Base

#defaults, #identifier, #initialize, #style_string

Constructor Details

This class inherits a constructor from Maglove::Widget::Base

Instance Method Details

#render(&block) ⇒ Object



48
49
50
51
52
# File 'lib/maglove/widget.rb', line 48

def render(&block)
  haml_tag "#{identifier}-widget", widget_options do
    yield self if block_given?
  end
end

#widget_optionsObject



35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/maglove/widget.rb', line 35

def widget_options
  attributes = { widget: true }
  @options.each do |key, value|
    attributes[key.to_s.dasherize.to_s] = value
  end
  if attributes["padding"]
    attributes["padding"] = attributes["padding"].join(" ")
  else
    attributes["padding"] = "0 0 0 0"
  end
  attributes
end