Class: Maglove::Widgets::Base
- Inherits:
-
Object
- Object
- Maglove::Widgets::Base
- Extended by:
- Forwardable
- Includes:
- Hamloft::Helpers
- Defined in:
- lib/maglove/widgets/base.rb
Direct Known Subclasses
Button, Columns, Container, Heading, HorizontalRule, Image, Paragraph, ScrollableImage, Slider, Video, Youtube
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#scope ⇒ Object
readonly
Returns the value of attribute scope.
Instance Method Summary collapse
- #defaults ⇒ Object
- #identifier ⇒ Object
-
#initialize(options, scope) ⇒ Base
constructor
A new instance of Base.
- #widget_options ⇒ Object
Constructor Details
#initialize(options, scope) ⇒ Base
Returns a new instance of Base.
17 18 19 20 |
# File 'lib/maglove/widgets/base.rb', line 17 def initialize(, scope) = defaults.merge() @scope = scope end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
6 7 8 |
# File 'lib/maglove/widgets/base.rb', line 6 def end |
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
6 7 8 |
# File 'lib/maglove/widgets/base.rb', line 6 def scope @scope end |
Instance Method Details
#defaults ⇒ Object
13 14 15 |
# File 'lib/maglove/widgets/base.rb', line 13 def defaults {} end |
#identifier ⇒ Object
9 10 11 |
# File 'lib/maglove/widgets/base.rb', line 9 def identifier "base" end |
#widget_options ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/maglove/widgets/base.rb', line 22 def attributes = { widget: true } .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 |