class SpinningCursor::Parser

Attributes

outer_scope_object[RW]

Public Class Methods

new() { |self| ... } click to toggle source

Parses proc

# 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

Public Instance Methods

action(&block) click to toggle source

Getter and setter for the action block

# File lib/spinning_cursor/parser.rb, line 29
def action(&block)
  @action = block if block

  @action
end

Private Instance Methods

method_missing(method, *args, &block) click to toggle source

Pass any other methods to the calling class

# File lib/spinning_cursor/parser.rb, line 79
def method_missing(method, *args, &block)
  @outer_scope_object.send method, *args, &block
end