class Hollaback::Callback

Attributes

executable[R]
type[R]

Public Class Methods

new(type, execute = nil, &block) click to toggle source
# File lib/hollaback/callback.rb, line 5
def initialize(type, execute = nil, &block)
  @type       = type
  @executable = (execute ? execute : block)
end

Public Instance Methods

build() click to toggle source
# File lib/hollaback/callback.rb, line 10
def build
  case executable
  when Symbol
    -> (target, &block) { target.send(executable, &block) }
  when Proc
    -> (target) { target.instance_eval(&executable) }
  end
end