delegate_it 1.1.0 → 1.1.1
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 +4 -4
- data/README.md +21 -19
- data/delegate_it.gemspec +2 -2
- data/lib/delegate_it/version.rb +1 -1
- data/spec/spec_helper.rb +2 -0
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c613609bd7bd82ecaca7208496320d6056558bec
|
4
|
+
data.tar.gz: ce70c78a5bd1c7fa86063111c00543eb2297958a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8f02d8c514ca169df58566181f6df04f3bbd61fefb5715ce4e5e090251a28713347d48911578761302f07c9d7e039c660d08551539d8c6e00f8fba3952ac21f
|
7
|
+
data.tar.gz: 5dda666ac8a0414e605c78a9a3ec5423869bdcbd8de7aa7572b93f758a5d5deea90689cb62adee645285cccc216a7048e739669147651fb1c08de0e11df74e50
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
#Delegate it [](https://travis-ci.org/pawurb/delegate_it) [](http://badge.fury.io/rb/delegate_it) [](https://coveralls.io/r/pawurb/delegate_it)
|
2
2
|
|
3
3
|
delegate_it gem provides an easy way to use ActiveSupport like `delegate` method in your non Rails projects.
|
4
4
|
|
@@ -12,34 +12,36 @@ gem 'delegate_it'
|
|
12
12
|
|
13
13
|
## Usage
|
14
14
|
|
15
|
-
````
|
16
|
-
|
17
|
-
extend DelegateIt
|
18
|
-
|
19
|
-
delegate :name, :description, to: :product
|
20
|
-
delegate :brand, to: :manufacturer, allow_nil: true
|
15
|
+
````ruby
|
16
|
+
require 'delegate_it'
|
21
17
|
|
22
|
-
|
23
|
-
|
24
|
-
|
18
|
+
class Cowboy
|
19
|
+
extend DelegateIt
|
20
|
+
attr_reader :pouch, :pistol
|
25
21
|
|
26
|
-
|
22
|
+
delegate :name, to: :horse, prefix: true
|
23
|
+
delegate :money, to: :pouch, allow_nil: true
|
24
|
+
delegate :bullets, to: :pistol, allow_nil: true, prefix: :gun
|
27
25
|
|
28
|
-
def
|
29
|
-
Struct.new(:name
|
30
|
-
.new('Great product', 'Awesome!')
|
26
|
+
def horse
|
27
|
+
Struct.new(:name).new('Jolly Jumper')
|
31
28
|
end
|
32
29
|
end
|
33
30
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
31
|
+
cowboy = Cowboy.new
|
32
|
+
cowboy.horse_name # => 'Jolly Jumper'
|
33
|
+
cowboy.money # => nil
|
34
|
+
cowboy.gun_bullets # => nil
|
38
35
|
|
39
36
|
````
|
40
37
|
|
41
38
|
### Supported options
|
42
39
|
|
43
|
-
|
40
|
+
`allow_nil: true` - if the delegate does not exist method call will return nil.
|
41
|
+
|
42
|
+
`prefix: true` - prefix delegated method name with the delegate or custom name.
|
43
|
+
|
44
|
+
|
45
|
+
### Status
|
44
46
|
|
45
47
|
PRs are welcome.
|
data/delegate_it.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |gem|
|
|
8
8
|
gem.version = DelegateIt::VERSION
|
9
9
|
gem.authors = ["pawurb"]
|
10
10
|
gem.email = ["p.urbanek89@gmail.com"]
|
11
|
-
gem.summary = %q{
|
12
|
-
gem.description = %q{
|
11
|
+
gem.summary = %q{ A drop in replacement for ActiveSupport delegate method in non Rails projects. }
|
12
|
+
gem.description = %q{ delegate_it gem provides an easy way to use ActiveSupport like delegate method in your non Rails projects. }
|
13
13
|
gem.homepage = "http://github.com/pawurb/delegate_it"
|
14
14
|
gem.files = `git ls-files`.split("\n")
|
15
15
|
gem.test_files = gem.files.grep(%r{^(spec)/})
|
data/lib/delegate_it/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: delegate_it
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- pawurb
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -52,8 +52,8 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
-
description: "
|
56
|
-
method in your non Rails projects "
|
55
|
+
description: " delegate_it gem provides an easy way to use ActiveSupport like delegate
|
56
|
+
method in your non Rails projects. "
|
57
57
|
email:
|
58
58
|
- p.urbanek89@gmail.com
|
59
59
|
executables: []
|
@@ -96,7 +96,7 @@ rubyforge_project:
|
|
96
96
|
rubygems_version: 2.4.6
|
97
97
|
signing_key:
|
98
98
|
specification_version: 4
|
99
|
-
summary:
|
99
|
+
summary: A drop in replacement for ActiveSupport delegate method in non Rails projects.
|
100
100
|
test_files:
|
101
101
|
- spec/delegate_it/main_spec.rb
|
102
102
|
- spec/spec_helper.rb
|