Sha256: 12f7f72d83201458b67d70aa26a39526c8f8348b1de78eb433d23127da09a75a

Contents?: true

Size: 307 Bytes

Versions: 7

Compression:

Stored size: 307 Bytes

Contents

# would be nice to use refinements here, but that breaks 2.0 compatibility
class Method
  def kwargs_as_hash( invocation_binding )
    named_locals = parameters. \
      select{|type,_| type == :key}. \
      flat_map{|_,name| [name,invocation_binding.eval(name.to_s)]}

    Hash[ *named_locals ]
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
wyrm-0.4.2 lib/wyrm/core_extensions.rb
wyrm-0.4.1 lib/wyrm/core_extensions.rb
wyrm-0.4.0 lib/wyrm/core_extensions.rb
wyrm-0.3.3 lib/wyrm/core_extensions.rb
wyrm-0.3.2 lib/wyrm/core_extensions.rb
wyrm-0.3.1 lib/wyrm/core_extensions.rb
wyrm-0.3.0 lib/wyrm/core_extensions.rb