Skip to content

Some real-life examples #1

@zverok

Description

@zverok

Hey! Thanks for the RubyConf talk. Just some real-life examples that I'd probably like to use the gem to, but I can't 😢

require 'kwurry/proc'
JSON.method(:parse).to_proc.kwurry.(symbolize_names: true).('{"a":1,"b":2}')
# ArgumentError (unknown keyword: [:symbolize_names])

# because...
JSON.method(:parse).parameters
# => [[:req, :source], [:opt, :opts]]

# The same way:
File.method(:read).to_proc.kwurry.(mode: 'rb')
# ArgumentError (unknown keyword: [:mode])
File.method(:read).parameters
# => [[:rest]] 

So it is cool to curry "real" kwargs but probably would be much cooler to be able also to curry "imitational" ones.

Thanks nevertheless!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions