Class: AdminWidgets::BaseWidget
- Inherits:
-
Erector::Widget
- Object
- Erector::Widget
- AdminWidgets::BaseWidget
show all
- Extended by:
- Delegation, Memoization
- Defined in:
- lib/admin_widgets/base_widget.rb
Instance Method Summary
collapse
memoize
Methods included from Delegation
delegate
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
24
25
26
|
# File 'lib/admin_widgets/base_widget.rb', line 24
def method_missing(method_name, *args, &block)
rawtext helper.send(method_name, *args, &block)
end
|
Instance Method Details
#capture(&block) ⇒ Object
7
8
9
10
11
12
13
14
|
# File 'lib/admin_widgets/base_widget.rb', line 7
def capture(&block)
original, @_output = output, Erector::Output.new
instance_eval &block
original.widgets.concat(output.widgets)
output.to_s
ensure
@_output = original
end
|
#content_block ⇒ Object
28
29
30
|
# File 'lib/admin_widgets/base_widget.rb', line 28
def content_block
instance_eval &@block if @block
end
|
#helper ⇒ Object
20
21
22
|
# File 'lib/admin_widgets/base_widget.rb', line 20
def helper
@controller.view_context
end
|
#root ⇒ Object
16
17
18
|
# File 'lib/admin_widgets/base_widget.rb', line 16
def root
parent and parent.root or self
end
|