crystal_plus

An extension of the Crystal standard library
0.1.0 released
mosop/crystal_plus
5
mosop

Crystal Plus

An extension of the Crystal standard library.

Build Status

Installation

Add this to your application's shard.yml:

dependencies:
  crystal_plus:
    github: mosop/crystal_plus

NamedTuple

#to_h?

def test_to_h(**options)
  options.to_h
end

test_to_h # compile error
require "cyrstal_plus/named_tuple/#to_h?"

def test_to_h?(**options)
  options.to_h?
end

test_to_h? # => nil

#merge

require "cyrstal_plus/named_tuple/#merge"

def merge(tuple, **options)
  tuple.merge(options)
end

def reverse_merge(tuple, **options)
  options.merge(tuple)
end

smile = {face: ":)"}
frown = {face: ":("}
other = {other: ":P"}

merge(smile).should   # => {face: ":)"}
merge(smile, **frown) # => {face: ":("}
merge(smile, **other) # => ArgumentError
reverse_merge(smile)  # => ArgumentError

Contributing

  1. Fork it ( https://github.com/mosop/crystal_plus/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

  • mosop - creator, maintainer
crystal_plus:
  github: mosop/crystal_plus
  version: ~> 0.1.0
License MIT
Crystal none

Authors

  • mosop

Dependencies 0

Development Dependencies 0

Dependents 3

Last synced .
search fire star recently