class Maglove::Widgets::Base

Attributes

options[R]
scope[R]

Public Class Methods

new(options, scope) click to toggle source
# File lib/maglove/widgets/base.rb, line 17
def initialize(options, scope)
  @options = defaults.merge(options)
  @scope = scope
end

Public Instance Methods

defaults() click to toggle source
# File lib/maglove/widgets/base.rb, line 13
def defaults
  {}
end
identifier() click to toggle source
# File lib/maglove/widgets/base.rb, line 9
def identifier
  "base"
end
widget_options() click to toggle source
# File lib/maglove/widgets/base.rb, line 22
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