delegate_it 0.0.3 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e57152f604c87fa5c3232b78d9a35cfdd5b9ea82
4
- data.tar.gz: a5329c960ac1e9efbe11d9f5bdb49fe09076e84e
3
+ metadata.gz: 6f50eddfb21b4ce5194f165f8a54aa0c0289de12
4
+ data.tar.gz: 160a17d66a8b07abcd2b6d815c20f158d6f9c395
5
5
  SHA512:
6
- metadata.gz: c8e6667235220cc6ef4d55f16ecb623b91603ac15a6c2efb99636ecd74255ca94a97960cdc248924a63d8b591196d910ed96ffa38dda1546eaf68d7cf1b036f4
7
- data.tar.gz: f3e461c652478fcadba16bc4ca59fa23d739e6ea554f1eb844057bab21f0904283ec1ceb307e31208ff4355c015c458f8161189b865d34fcac9725fa3189e94b
6
+ metadata.gz: 290e75c1e27cf94be088089cadf1c8364dd042edf8c57e30cfd1c7bcf095cbc4c9ba647f011fd4a8c452110a485db9355584f89a052bd5421985ef864723c7e2
7
+ data.tar.gz: 84782ae5584bbd95de9fed4d37c5b6bef3de28f958264a8e5855be9d97d14f1210c4efd661c742e5faa4f4aad9fac8ba48c96e682e5ab4b05994cfefa0e9524c
data/README.md CHANGED
@@ -1,3 +1,41 @@
1
- # Delegate_it
1
+ # Delegate it
2
2
 
3
- Delegate_it gem provides an easy way to use ActiveSupport like `delegate` method in your non Rails projects.
3
+ delegate_it gem provides an easy way to use ActiveSupport like `delegate` method in your non Rails projects.
4
+
5
+ ## Installation
6
+
7
+ In your Gemfile:
8
+
9
+ ````ruby
10
+ gem 'delegate_it'
11
+ ````
12
+
13
+ ## Usage
14
+
15
+ ```` ruby
16
+ class Offer
17
+ include DelegateIt
18
+
19
+ delegate :name, :description, to: :product
20
+ delegate :brand, to: :manufacturer, allow_nil: true
21
+
22
+ private
23
+
24
+ def product
25
+ Struct.new(:name, :description)
26
+ .new('Great product', 'Awesome!')
27
+ end
28
+ end
29
+
30
+ offer = Offer.new
31
+ offer.name # => 'Great product'
32
+ offer.description # => 'Awesome!'
33
+ offer.brand # => nil
34
+
35
+ ````
36
+
37
+ ### Supported options
38
+
39
+ `allow_nil: true` - if the delegate does not exist method call will return nil.
40
+
41
+ PRs are welcome.
@@ -32,4 +32,4 @@ module DelegateIt
32
32
  super
33
33
  end
34
34
  end
35
- end
35
+ end
@@ -1,3 +1,3 @@
1
1
  module DelegateIt
2
- VERSION = "0.0.3"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -91,4 +91,3 @@ describe 'DelegateIt' do
91
91
  end
92
92
  end
93
93
  end
94
-
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: delegate_it
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - pawurb