block_configurable 0.9.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0835eaa0da15465594873dedfc834e28ca02221c
4
- data.tar.gz: 24fb1fc30a11579a5da38a7d98a73f23df2e9d7d
3
+ metadata.gz: c16db92cffd0aa2c695abb35add01b294050c5b4
4
+ data.tar.gz: 1f1be3a9c3a4bc569e7e0c7ae349dd21a0fb6f59
5
5
  SHA512:
6
- metadata.gz: bddd854d8a75024647a1bb7b4c37fd89956e10d2c787fcdc60393c44c72a99e7b9a655b9e7c41aa1f9bca791b004d63a49709a3c2f055e8a8d748ee37f8861f1
7
- data.tar.gz: 21c0469b08b1323f2166f39b701ddbb49ea13d67af91d18131cdb93c5884ea4129a53ec6d816d9c9b7953a71d3b2eabef09f6320b864720ba289695a87b5b560
6
+ metadata.gz: 4347a2ffd104826dd9a97cc79dbb9ff4de0826c4152c4b46183388dcfae42e236b1c110dba71c04aac8643badc07c3ec2530a8a4110b4c16079801ff880ea238
7
+ data.tar.gz: bda47a8b19f0e58136c488e11a108d58550cdad8d565b9488e9451ae73ac7c0b74272f70c7a45cbd0f5ef1b7d4ccfb5e68d0dea3a2d2de2eb8d4e7d38942a9c1
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # BlockConfigurable
2
2
 
3
- [![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)
3
+ [![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)
4
4
 
5
5
  A little mixin to make your classes and modules configurable using either single statements or blocks.
6
6
 
@@ -12,38 +12,43 @@ Install as a standalone gem:
12
12
 
13
13
  Or include into your `Gemfile`:
14
14
 
15
- gem 'block_configurable', '~> 0.9.0'
15
+ ```ruby
16
+ gem 'block_configurable', '~> 0.10.0'
17
+ ```
16
18
 
17
19
  ## Usage
18
-
20
+
21
+ Set up class (or module). Only parameters explicitly listed will be available for configuration.
22
+
19
23
  ```ruby
20
24
  class MyClass
21
25
  include BlockConfigurable
22
26
 
23
- config :param_with_default_value, 'A default!'
24
- config :param_without_default_value
25
- config :another_one
27
+ configurable :param_with_default_value, 'A default!'
28
+ configurable :param_without_default_value
29
+ configurable :another_one
26
30
  end
31
+ ```
27
32
 
28
- MyClass.configuration.param_with_default_value
29
- #=> 'A default!'
30
-
31
- MyClass.configuration.param_without_default_value
32
- #=> nil
33
+ Configure it:
33
34
 
35
+ ```ruby
34
36
  MyClass.configure do |c|
35
- c.param_with_default_value = 'My values, my rules'
36
37
  c.param_without_default_value = 'A value now!'
38
+ c.another_one = 'My values, my rules'
37
39
  end
38
40
 
39
- MyClass.configuration.param_with_default_value
40
- #=> 'My values, my rules'
41
+ # or
42
+
43
+ MyClass.configuration.another_one = 'My values, my rules'
44
+ ```
41
45
 
42
- MyClass.configuration.param_without_default_value
43
- #=> 'A value now!'
46
+ Read configuration:
44
47
 
45
- MyClass.configuration.another_one = 'The third'
48
+ ```ruby
49
+ MyClass.configuration.param_with_default_value
50
+ #=> 'A default!'
46
51
 
47
52
  MyClass.configuration.another_one
48
- #=> 'The third'
53
+ #=> 'My values, my rules'
49
54
  ```
@@ -1,3 +1,3 @@
1
1
  module BlockConfigurable
2
- VERSION = "0.9.0"
2
+ VERSION = "0.10.0"
3
3
  end
@@ -7,7 +7,7 @@ module BlockConfigurable
7
7
  @configuration ||= Configuration.new
8
8
  end
9
9
 
10
- def config(param, default = nil)
10
+ def configurable(param, default = nil)
11
11
  configuration.add_config(param, default)
12
12
  end
13
13
 
@@ -18,6 +18,6 @@ module BlockConfigurable
18
18
 
19
19
  def self.included(receiver)
20
20
  receiver.extend ClassMethods
21
- receiver.send :private_class_method, :config
21
+ receiver.send :private_class_method, :configurable
22
22
  end
23
23
  end
@@ -4,16 +4,16 @@ require 'block_configurable'
4
4
  class Configurable
5
5
  include BlockConfigurable
6
6
 
7
- config :value_with_default, 1
8
- config :value_without_default, nil
9
- config :value_to_change, 'a'
10
- config :value_to_test_hash, :test
7
+ configurable :value_with_default, 1
8
+ configurable :value_without_default, nil
9
+ configurable :value_to_change, 'a'
10
+ configurable :value_to_test_hash, :test
11
11
  end
12
12
 
13
13
  module ConfigurableModule
14
14
  include BlockConfigurable
15
15
 
16
- config :value_with_default, 1
16
+ configurable :value_with_default, 1
17
17
  end
18
18
 
19
19
  class BlockConfigurableTest < Minitest::Test
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: block_configurable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Artem Shitov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-31 00:00:00.000000000 Z
11
+ date: 2013-08-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler