Sha256: 669b9d6b3c04291f64ca19732684d7eb350faf2e6cca1c822623bbc38956aafd

Contents?: true

Size: 420 Bytes

Versions: 1

Compression:

Stored size: 420 Bytes

Contents

module Hollaback
  class Callback
    attr_reader :type, :executable

    def initialize(type, execute = nil, &block)
      @type       = type
      @executable = (execute ? execute : block)
    end

    def build
      case executable
      when Symbol
        -> (target, &block) { target.send(executable, &block) }
      when Proc
        -> (target) { target.instance_eval(&executable) }
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hollaback-0.1.0 lib/hollaback/callback.rb