Class: SpinningCursor::Parser
- Inherits:
-
Object
- Object
- SpinningCursor::Parser
- Defined in:
- lib/spinning_cursor/parser.rb
Instance Attribute Summary collapse
-
#outer_scope_object ⇒ Object
Returns the value of attribute outer_scope_object.
Instance Method Summary collapse
-
#action(&block) ⇒ Object
Getter and setter for the action block.
-
#initialize(&block) ⇒ Parser
constructor
Parses proc.
Constructor Details
#initialize(&block) ⇒ Parser
Parses proc
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/spinning_cursor/parser.rb', line 8 def initialize(&block) @banner = "Loading" @type = :spinner @message = "Done" @delay = nil @action = nil @output = :inline if block_given? @outer_scope_object = eval("self", block.binding) if block.arity == 1 yield self else instance_eval &block end end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object (private)
Pass any other methods to the calling class
79 80 81 |
# File 'lib/spinning_cursor/parser.rb', line 79 def method_missing(method, *args, &block) @outer_scope_object.send method, *args, &block end |
Instance Attribute Details
#outer_scope_object ⇒ Object
Returns the value of attribute outer_scope_object.
3 4 5 |
# File 'lib/spinning_cursor/parser.rb', line 3 def outer_scope_object @outer_scope_object end |
Instance Method Details
#action(&block) ⇒ Object
Getter and setter for the action block
29 30 31 32 33 |
# File 'lib/spinning_cursor/parser.rb', line 29 def action(&block) @action = block if block @action end |