delegate_it 1.1.0 → 1.1.1

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: fc80e0b4e561ceeb1b577e6177c2a792ce09e01b
4
- data.tar.gz: b68bf200456ebc5d774cac5e037a1eac1c512101
3
+ metadata.gz: c613609bd7bd82ecaca7208496320d6056558bec
4
+ data.tar.gz: ce70c78a5bd1c7fa86063111c00543eb2297958a
5
5
  SHA512:
6
- metadata.gz: 89f4b36d01c98e19628f1c32e64ddbaa3d1eca96e152028c4971aaefd54fe54f0cbe84cb9d38b521cf435eb96ab03a8710791c9363eb5321b6ad0c13d1880165
7
- data.tar.gz: 0b99c3256034d4b67d50733fa14ab35ae444077fc8e61473f0394ce6a8ff2308639b17bffbfabd25f77478efe41b0981f17126fd3bb4b628d8f04075c02cc7fc
6
+ metadata.gz: a8f02d8c514ca169df58566181f6df04f3bbd61fefb5715ce4e5e090251a28713347d48911578761302f07c9d7e039c660d08551539d8c6e00f8fba3952ac21f
7
+ data.tar.gz: 5dda666ac8a0414e605c78a9a3ec5423869bdcbd8de7aa7572b93f758a5d5deea90689cb62adee645285cccc216a7048e739669147651fb1c08de0e11df74e50
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Delegate it
1
+ #Delegate it [![Build Status](https://travis-ci.org/pawurb/delegate_it.png)](https://travis-ci.org/pawurb/delegate_it) [![Gem Version](https://badge.fury.io/rb/delegate_it.png)](http://badge.fury.io/rb/delegate_it) [![Coverage Status](https://coveralls.io/repos/pawurb/delegate_it/badge.png)](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
- ```` ruby
16
- class Offer
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
- def manufacturer
23
- nil
24
- end
18
+ class Cowboy
19
+ extend DelegateIt
20
+ attr_reader :pouch, :pistol
25
21
 
26
- private
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 product
29
- Struct.new(:name, :description)
30
- .new('Great product', 'Awesome!')
26
+ def horse
27
+ Struct.new(:name).new('Jolly Jumper')
31
28
  end
32
29
  end
33
30
 
34
- offer = Offer.new
35
- offer.name # => 'Great product'
36
- offer.description # => 'Awesome!'
37
- offer.brand # => nil
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
- `allow_nil: true` - if the delegate does not exist method call will return nil.
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.
@@ -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{ Use delegate method without ActiveSupport }
12
- gem.description = %q{ Delegate_it gem provides an easy way to use ActiveSupport like delegate method in your non Rails projects }
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)/})
@@ -1,3 +1,3 @@
1
1
  module DelegateIt
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
@@ -1,4 +1,6 @@
1
1
  require 'rubygems'
2
2
  require 'bundler/setup'
3
+ require 'coveralls'
4
+ Coveralls.wear!
3
5
 
4
6
  require_relative '../lib/delegate_it'
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.0
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-15 00:00:00.000000000 Z
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: " Delegate_it gem provides an easy way to use ActiveSupport like delegate
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: Use delegate method without ActiveSupport
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