method_fallback 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +9 -4
- data/Gemfile.lock +9 -1
- data/README.md +14 -4
- data/lib/method_fallback.rb +3 -1
- data/lib/method_fallback/version.rb +1 -1
- data/method_fallback.gemspec +4 -3
- metadata +18 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a6a2c2171f08b4a9bd2b81ed2f3b5711636ec62
|
4
|
+
data.tar.gz: 419323672f0034b12857a815316079937b5079db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 359cdebdd6f26db8b76c6d03c429f5b06060cc89e1c0a3f04110adc6bcd2a2422449e3641a1d5456206560228c40d0a25932fd7a6d3b0ada7e34dfac1b9da13d
|
7
|
+
data.tar.gz: 01adffe9aecf4a1d66ae9166865ce8c1c195c7c7ba7989da9348c16f7b53664e859f5f5da4cb02f2c3119580bef55d5a6f8578ebe6f3ee11f466a08a13f07084
|
data/.travis.yml
CHANGED
@@ -2,10 +2,15 @@ language: ruby
|
|
2
2
|
sudo: false
|
3
3
|
cache: bundler
|
4
4
|
rvm:
|
5
|
-
- 2.0
|
6
|
-
- 2.1
|
7
|
-
- 2.2
|
8
5
|
- 2.3
|
9
6
|
- 2.4
|
10
7
|
- ruby-head
|
11
|
-
before_install:
|
8
|
+
before_install:
|
9
|
+
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
10
|
+
- chmod +x ./cc-test-reporter
|
11
|
+
- ./cc-test-reporter before-build
|
12
|
+
- gem install bundler -v 1.16.4
|
13
|
+
after_script:
|
14
|
+
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
15
|
+
notifications:
|
16
|
+
- false
|
data/Gemfile.lock
CHANGED
@@ -1,13 +1,20 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
method_fallback (0.1.
|
4
|
+
method_fallback (0.1.2)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
+
docile (1.3.1)
|
10
|
+
json (2.1.0)
|
9
11
|
minitest (5.11.3)
|
10
12
|
rake (10.5.0)
|
13
|
+
simplecov (0.16.1)
|
14
|
+
docile (~> 1.1)
|
15
|
+
json (>= 1.8, < 3)
|
16
|
+
simplecov-html (~> 0.10.0)
|
17
|
+
simplecov-html (0.10.2)
|
11
18
|
yard (0.9.16)
|
12
19
|
|
13
20
|
PLATFORMS
|
@@ -18,6 +25,7 @@ DEPENDENCIES
|
|
18
25
|
method_fallback!
|
19
26
|
minitest (~> 5.0)
|
20
27
|
rake (~> 10.0)
|
28
|
+
simplecov (~> 0.16)
|
21
29
|
yard
|
22
30
|
|
23
31
|
BUNDLED WITH
|
data/README.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# MethodFallback
|
2
2
|
|
3
|
+
[![Build Status](https://travis-ci.org/f-mer/method_fallback.svg?branch=master)](https://travis-ci.org/f-mer/method_fallback)
|
4
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/6600af762b40e0c56192/maintainability)](https://codeclimate.com/github/f-mer/method_fallback/maintainability)
|
5
|
+
[![Test Coverage](https://api.codeclimate.com/v1/badges/6600af762b40e0c56192/test_coverage)](https://codeclimate.com/github/f-mer/method_fallback/test_coverage)
|
6
|
+
|
3
7
|
`MethodFallback` offers an easy way of delegating to another method if the
|
4
8
|
original one returned nil.
|
5
9
|
|
@@ -13,22 +17,28 @@ gem 'method_fallback'
|
|
13
17
|
|
14
18
|
And then execute:
|
15
19
|
|
16
|
-
|
20
|
+
```sh
|
21
|
+
$ bundle
|
22
|
+
```
|
17
23
|
|
18
24
|
Or install it yourself as:
|
19
25
|
|
20
|
-
|
26
|
+
```sh
|
27
|
+
$ gem install method_fallback
|
28
|
+
```
|
21
29
|
|
22
30
|
## Usage
|
23
31
|
|
24
32
|
```ruby
|
25
33
|
class Author
|
26
34
|
def name
|
27
|
-
'
|
35
|
+
'Jane Doe'
|
28
36
|
end
|
29
37
|
end
|
30
38
|
|
31
39
|
class Article
|
40
|
+
include MethodFallback
|
41
|
+
|
32
42
|
def author
|
33
43
|
Author.new
|
34
44
|
end
|
@@ -40,7 +50,7 @@ class Article
|
|
40
50
|
fallback author_name: :name, to: :author
|
41
51
|
end
|
42
52
|
|
43
|
-
article =
|
53
|
+
article = Article.new
|
44
54
|
|
45
55
|
article.author_name_without_fallback # => nil
|
46
56
|
article.author_name # => "Jane Doe"
|
data/lib/method_fallback.rb
CHANGED
data/method_fallback.gemspec
CHANGED
@@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ['Fabian Mersch']
|
10
10
|
spec.email = ['fabianmersch@gmail.com']
|
11
11
|
|
12
|
-
spec.summary = %q{Fallback to other
|
13
|
-
spec.description = %q{Fallback to other
|
12
|
+
spec.summary = %q{Fallback to other method in case the original method returned nil.}
|
13
|
+
spec.description = %q{Fallback to other method in case the original method returned nil.}
|
14
14
|
spec.homepage = 'https://github.com/f-mer/method_fallback'
|
15
15
|
spec.license = 'MIT'
|
16
16
|
|
@@ -23,9 +23,10 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
24
|
spec.require_paths = ['lib']
|
25
25
|
|
26
|
-
spec.required_ruby_version = '>= 2.
|
26
|
+
spec.required_ruby_version = '>= 2.3'
|
27
27
|
|
28
28
|
spec.add_development_dependency 'bundler', '~> 1.16'
|
29
29
|
spec.add_development_dependency 'rake', '~> 10.0'
|
30
30
|
spec.add_development_dependency 'minitest', '~> 5.0'
|
31
|
+
spec.add_development_dependency 'simplecov', '~> 0.16'
|
31
32
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: method_fallback
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fabian Mersch
|
@@ -52,7 +52,21 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '5.0'
|
55
|
-
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: simplecov
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.16'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.16'
|
69
|
+
description: Fallback to other method in case the original method returned nil.
|
56
70
|
email:
|
57
71
|
- fabianmersch@gmail.com
|
58
72
|
executables: []
|
@@ -84,7 +98,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
84
98
|
requirements:
|
85
99
|
- - ">="
|
86
100
|
- !ruby/object:Gem::Version
|
87
|
-
version: '2.
|
101
|
+
version: '2.3'
|
88
102
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
103
|
requirements:
|
90
104
|
- - ">="
|
@@ -95,5 +109,5 @@ rubyforge_project:
|
|
95
109
|
rubygems_version: 2.6.14
|
96
110
|
signing_key:
|
97
111
|
specification_version: 4
|
98
|
-
summary: Fallback to other
|
112
|
+
summary: Fallback to other method in case the original method returned nil.
|
99
113
|
test_files: []
|