Sha256: 1154ca4fa7e41b43df82d8fd3a40d238f76b200e358d2521d7da5852be744e80

Contents?: true

Size: 443 Bytes

Versions: 14

Compression:

Stored size: 443 Bytes

Contents

module Invokr
  Invocation = Struct.new :method, :positional_args, :keyword_args, :block_arg do
    def invoke! obj
      if block_arg?
        obj.public_send method, *args, &block_arg
      else
        obj.public_send method, *args
      end
    end

    def block_arg?
      block_arg ? true : false
    end

    def args
      args = positional_args.dup
      args << keyword_args unless keyword_args.empty?
      args
    end
  end

end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
invokr-0.9.7 lib/invokr/invocation.rb
invokr-0.9.6 lib/invokr/invocation.rb
invokr-0.9.5 lib/invokr/invocation.rb
invokr-0.9.4 lib/invokr/invocation.rb
invokr-0.9.3 lib/invokr/invocation.rb
invokr-0.9.2 lib/invokr/invocation.rb
invokr-0.9.1 lib/invokr/invocation.rb
invokr-0.9.0 lib/invokr/invocation.rb
invokr-0.1.0 lib/invokr/invocation.rb
invokr-0.0.6 lib/invokr/invocation.rb
invokr-0.0.5 lib/invokr/invocation.rb
invokr-0.0.4 lib/invokr/invocation.rb
invokr-0.0.2 lib/invokr/invocation.rb
invokr-0.0.1 lib/invokr/invocation.rb