Sha256: 0963f840d386bedbb35fe1ca01586b7de709df025a2a1873af83e9ff7d22def6
Contents?: true
Size: 1.12 KB
Versions: 2
Compression:
Stored size: 1.12 KB
Contents
# Parametron This simple library implements DSL for validating method input parameters ## Installation Add this line to your application's Gemfile: gem 'parametron' And then execute: $ bundle Or install it yourself as: $ gem install parametron ## Usage ```ruby class VictimStrict include Parametron params_for(:fetch, strict: true) do required :city, validator: /\w+/ required :year, validator: /\d{4}/ optional :title, validator: ->(str){ str != "Moscow" } optional :number, validator: /\d+/, default: 42 optional :gears, default: ->(obj){ choose_by(obj) } optional :weel_d, as: :weel_diameter end def fetch params # .. do something useful end end ``` See `spec/parametron_spec` how this library suppossed to work. All hackers do this and you should too! ## 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
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
parametron-0.2.2 | README.md |
parametron-0.2.0 | README.md |