Class: Maglove::Widget::Base

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/maglove/widget.rb

Direct Known Subclasses

V1, V2

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scope, options = {}) ⇒ Base

Returns a new instance of Base.



16
17
18
19
# File 'lib/maglove/widget.rb', line 16

def initialize(scope, options = {})
  @options = defaults.merge(options)
  @scope = scope
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



5
6
7
# File 'lib/maglove/widget.rb', line 5

def options
  @options
end

#scopeObject (readonly)

Returns the value of attribute scope.



5
6
7
# File 'lib/maglove/widget.rb', line 5

def scope
  @scope
end

Instance Method Details

#defaultsObject



12
13
14
# File 'lib/maglove/widget.rb', line 12

def defaults
  {}
end

#identifierObject



8
9
10
# File 'lib/maglove/widget.rb', line 8

def identifier
  "base"
end

#render {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



29
30
31
# File 'lib/maglove/widget.rb', line 29

def render(&block)
  yield self if block_given?
end

#style_string(options, *args, &block) ⇒ Object



25
26
27
# File 'lib/maglove/widget.rb', line 25

def style_string(options, *args, &block)
  scope.style_string(options, *args, &block)
end

#widget_optionsObject



21
22
23
# File 'lib/maglove/widget.rb', line 21

def widget_options
  {}
end