Sha256: c25bdf413f09aa9406df0eadf9f763b319ac9794948a9110484bccfa6e1379ab
Contents?: true
Size: 1.33 KB
Versions: 1
Compression:
Stored size: 1.33 KB
Contents
# BlockConfigurable [![Build Status](https://travis-ci.org/artemshitov/block_configurable.png?branch=master)](https://travis-ci.org/artemshitov/block_configurable) [![Code Climate](https://codeclimate.com/github/artemshitov/block_configurable.png)](https://codeclimate.com/github/artemshitov/block_configurable) [![Gem Version](https://badge.fury.io/rb/block_configurable.png)](http://badge.fury.io/rb/block_configurable) A little mixin to make your classes and modules configurable using either single statements or blocks. ## Installation Install as a standalone gem: gem install block_configurable Or include into your `Gemfile`: ```ruby gem 'block_configurable', '~> 0.10.0' ``` ## Usage Set up class (or module). Only parameters explicitly listed will be available for configuration. ```ruby class MyClass include BlockConfigurable configurable :param_with_default_value, 'A default!' configurable :param_without_default_value configurable :another_one end ``` Configure it: ```ruby MyClass.configure do |c| c.param_without_default_value = 'A value now!' c.another_one = 'My values, my rules' end # or MyClass.configuration.another_one = 'My values, my rules' ``` Read configuration: ```ruby MyClass.configuration.param_with_default_value #=> 'A default!' MyClass.configuration.another_one #=> 'My values, my rules' ```
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
block_configurable-0.10.0 | README.md |