Sha256: c2d300a6102acec3c439a578e923fabe8d8e238509b4ac4d984867e0033622b9
Contents?: true
Size: 1.31 KB
Versions: 1
Compression:
Stored size: 1.31 KB
Contents
# PikoModel [](http://badge.fury.io/rb/piko_model) [](https://codeclimate.com/github/skopciewski/piko_model) [](https://gemnasium.com/github.com/skopciewski/piko_model) Simple model which can be initialized from Hash. It is possible to define default values and check if all reqired fields are set. ## Installation Add this line to your application's Gemfile: gem 'piko_model' And then execute: $ bundle Or install it yourself as: $ gem install piko_model ## Usage ```ruby require "piko_model" class Config < PikoModel::Model field "a" field "b.c", default: true end foo = Config.new foo.valid? #=> false foo.missing_fields #=> ["a"] foo["b.c"] #=> true bar = Config.new a: "value", "b.c": false bar.valid? #=> true bar.fetch("a") #=> "value" baz = Config.new ENV.to_h ``` ## Versioning See [semver.org][semver] ## Contributing 1. Fork it 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 new Pull Request [semver]: http://semver.org/
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
piko_model-1.0.1 | README.md |