method_object 0.1.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +150 -24
- data/lib/method_object.rb +43 -12
- data/spec/method_object_spec.rb +89 -44
- data/spec/spec_helper.rb +13 -15
- metadata +40 -35
- data/.gitignore +0 -17
- data/.rspec +0 -2
- data/.travis.yml +0 -12
- data/Gemfile +0 -3
- data/LICENSE +0 -22
- data/Rakefile +0 -8
- data/method_object.gemspec +0 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 6f253b26368bed785b3953ec65e8deca17d637232b67607c042eea7a93cf1238
|
4
|
+
data.tar.gz: 25c6c4c527708a4a7f1cd614fa89c1d0769358abf639ff2fb90d2667cc08e84e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1fcc4865de7c9c99e9d9b836e32d6b9d6a983bb0266ef46878021351982a1a03a0d2ac8e92c0f7000918493830d6a8e7eec7040186fde37603341d1b61571d6
|
7
|
+
data.tar.gz: 3f0ffd9158b17a45fcae5aa46c55fc6d4d2ffc2086cb43615bcc11b1a8b02d8cf265ce759cd01bbbced1546a043955bf1389b94dc9eccdc4c898209f2f5ea9b1
|
data/README.md
CHANGED
@@ -1,43 +1,169 @@
|
|
1
1
|
# MethodObject
|
2
2
|
|
3
|
-
|
3
|
+
[![Version](https://img.shields.io/gem/v/method_object)](https://github.com/bukowskis/method_object.svg/releases)
|
4
|
+
[![License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)](https://github.com/bukowskis/method_object/blob/master/LICENSE.md)
|
5
|
+
[![Build Status](https://circleci.com/gh/bukowskis/method_object.svg?style=shield)](https://circleci.com/gh/bukowskis/method_object)
|
6
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/55b133b2c8e1a9649d88/maintainability)](https://codeclimate.com/repos/5c8032b7c1be5c599400eedd/maintainability)
|
4
7
|
|
5
|
-
|
8
|
+
### TL; DR
|
6
9
|
|
7
|
-
|
10
|
+
The [method object pattern](https://refactoring.guru/replace-method-with-method-object) implies that you have one Ruby class for one single thing you want to perform.
|
11
|
+
|
12
|
+
This gem helps you to do just that with minimal overhead. The convention is to use the `.call` class method like so:
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
class SaySometing
|
16
|
+
include MethodObject
|
17
|
+
|
18
|
+
# Input
|
19
|
+
option :text
|
20
|
+
|
21
|
+
# Output
|
22
|
+
def call
|
23
|
+
puts text
|
24
|
+
end
|
25
|
+
end
|
8
26
|
|
9
|
-
|
27
|
+
SaySometihng.call(text: 'Hi there!') # => 'Hi there!'
|
28
|
+
```
|
10
29
|
|
11
|
-
|
30
|
+
## Rationale
|
12
31
|
|
13
|
-
|
32
|
+
A minimal implementation of the method object pattern would probably look [like this](https://github.com/deadlyicon/method_object/blob/16944f7088bbe4d9e0039688077b91fdd4adcdbd/lib/method_object.rb). This is sometimes also referred to as "service class".
|
14
33
|
|
15
|
-
|
34
|
+
```ruby
|
35
|
+
class SaySometing
|
36
|
+
def self.call(*args, &block)
|
37
|
+
new.call(*args, &block)
|
38
|
+
end
|
39
|
+
|
40
|
+
def call(text)
|
41
|
+
puts text
|
42
|
+
end
|
43
|
+
end
|
44
|
+
```
|
16
45
|
|
17
|
-
|
46
|
+
> Fun fact: [previously](https://github.com/deadlyicon/method_object/issues/3) that was actually the implementation of this gem.
|
18
47
|
|
19
|
-
|
48
|
+
Basically everything passed to `MyClass.call(...)` would be passed on to `MyClass.new.call(...)`.
|
20
49
|
|
21
|
-
|
50
|
+
Even better still, it *should* be passed on to `MyClass.new(...).call` so that your implementation becomes cleaner:
|
22
51
|
|
23
52
|
```ruby
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
53
|
+
class SaySometing
|
54
|
+
def self.call(*args, &block)
|
55
|
+
new(*args, &block).call
|
56
|
+
end
|
57
|
+
|
58
|
+
def initialize(text:)
|
59
|
+
@text = text
|
60
|
+
end
|
61
|
+
|
62
|
+
def call
|
63
|
+
puts @text
|
64
|
+
end
|
65
|
+
end
|
66
|
+
```
|
67
|
+
|
68
|
+
|
69
|
+
People [implemented that](https://github.com/LIQIDTechnology/methodobject/blob/89ba022d61ac6037564cc1056c00813375a2d3ae/lib/method_object.rb#L73-L75), but in doing so reinvented the wheel. Because now you not only have the method object pattern (i.e. `call`), now you also have to deal with initialization (i.e. `new`).
|
70
|
+
|
71
|
+
That's where the popular [dry-initializer](https://dry-rb.org/gems/dry-initializer) gem comes in. It is a battle-tested way to initialize objects with mandatory and optional attributes.
|
28
72
|
|
29
|
-
|
30
|
-
|
31
|
-
|
73
|
+
The `method_object` gem (you're looking at it right now), combines both the method object pattern and dry initialization.
|
74
|
+
|
75
|
+
## Installation
|
76
|
+
|
77
|
+
```
|
78
|
+
# Add this to your Gemfile
|
79
|
+
gem 'method_object`
|
80
|
+
```
|
81
|
+
|
82
|
+
## Usage
|
83
|
+
|
84
|
+
If you only have one mandatory, obvious argument, this is what your implementation most likely would look like:
|
85
|
+
|
86
|
+
```ruby
|
87
|
+
class CalculateTax
|
88
|
+
include MethodObject
|
89
|
+
|
90
|
+
param :product
|
91
|
+
|
92
|
+
def call
|
93
|
+
product.price * 0.1
|
32
94
|
end
|
95
|
+
end
|
33
96
|
|
34
|
-
|
97
|
+
bike = Bike.new(price: 50)
|
98
|
+
CalculateTax.call(bike) # => 5
|
35
99
|
```
|
36
100
|
|
37
|
-
|
101
|
+
If you prefer to use named keywords, use this instead:
|
102
|
+
|
103
|
+
````ruby
|
104
|
+
class CalculateTax
|
105
|
+
include MethodObject
|
106
|
+
|
107
|
+
option :product
|
108
|
+
|
109
|
+
def call
|
110
|
+
product.price * 0.1
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
bike = Bike.new(price: 50)
|
115
|
+
CalculateTax.call(product: bike) # => 5
|
116
|
+
````
|
117
|
+
|
118
|
+
You can also use both params and options. They are all mandatory.
|
119
|
+
|
120
|
+
````ruby
|
121
|
+
class CalculateTax
|
122
|
+
include MethodObject
|
123
|
+
|
124
|
+
param :product
|
125
|
+
option :dutyfree
|
126
|
+
|
127
|
+
def call
|
128
|
+
return 0 if dutyfree
|
129
|
+
product.price * 0.1
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
bike = Bike.new(price: 50)
|
134
|
+
CalculateTax.call(bike, dutyfree: true) # => 0
|
135
|
+
````
|
136
|
+
|
137
|
+
You can make options optional by defining a default value in a proc:
|
138
|
+
|
139
|
+
````ruby
|
140
|
+
class CalculateTax
|
141
|
+
include MethodObject
|
142
|
+
|
143
|
+
param :product
|
144
|
+
option :dutyfree, default: -> { false }
|
145
|
+
|
146
|
+
def call
|
147
|
+
return 0 if dutyfree
|
148
|
+
product.price * 0.1
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
bike = Bike.new(price: 50)
|
153
|
+
CalculateTax.call(bike) # => 5
|
154
|
+
````
|
155
|
+
|
156
|
+
That's it!
|
157
|
+
|
158
|
+
# Caveats
|
159
|
+
|
160
|
+
* `params` cannot be optional (or have default values). This is because there can be several params in a row, which leads to confusion when they are optional.
|
161
|
+
|
162
|
+
# Thanks
|
163
|
+
|
164
|
+
* A big thank you to [Jared](https://github.com/deadlyicon) who was so kind to give us the `method_object` gem name for our implementation.
|
165
|
+
* The [dry-rb](https://dry-rb.org/) team for their sense of beauty.
|
166
|
+
|
167
|
+
# License
|
38
168
|
|
39
|
-
|
40
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
41
|
-
3. Commit your changes (`git commit -am 'Added some feature'`)
|
42
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
43
|
-
5. Create new Pull Request
|
169
|
+
MIT License, see [LICENSE.md](https://github.com/bukowskis/method_object/blob/master/LICENSE.md)
|
data/lib/method_object.rb
CHANGED
@@ -1,21 +1,52 @@
|
|
1
|
-
|
1
|
+
require 'dry-initializer'
|
2
2
|
|
3
|
-
|
3
|
+
module MethodObject
|
4
|
+
def self.included(base)
|
5
|
+
base.extend Dry::Initializer
|
6
|
+
base.extend ClassMethods
|
7
|
+
base.send(:private_class_method, :new)
|
8
|
+
end
|
4
9
|
|
5
|
-
|
6
|
-
|
10
|
+
module ClassMethods
|
11
|
+
def call(*args, **kwargs, &block)
|
12
|
+
__check_for_unknown_options(*args, **kwargs)
|
7
13
|
|
8
|
-
|
9
|
-
|
14
|
+
if kwargs.empty?
|
15
|
+
# Preventing `Passing the keyword argument as the last hash parameter is deprecated`
|
16
|
+
new(*args).call(&block)
|
17
|
+
else
|
18
|
+
new(*args, **kwargs).call(&block)
|
19
|
+
end
|
10
20
|
end
|
11
21
|
|
12
|
-
|
13
|
-
|
22
|
+
# Overriding the implementation of `#param` in the `dry-initializer` gem.
|
23
|
+
# Because of the positioning of multiple params, params can never be omitted in a method object.
|
24
|
+
def param(name, type = nil, **opts, &block)
|
25
|
+
raise ArgumentError, "Default value for param not allowed - #{name}" if opts.key? :default
|
26
|
+
raise ArgumentError, "Optional params not supported - #{name}" if opts.fetch(:optional, false)
|
27
|
+
|
28
|
+
super
|
14
29
|
end
|
15
|
-
end
|
16
30
|
|
17
|
-
|
18
|
-
|
19
|
-
|
31
|
+
def __check_for_unknown_options(*args, **kwargs)
|
32
|
+
return if __defined_options.empty?
|
33
|
+
|
34
|
+
# Checking params
|
35
|
+
opts = args.drop(__defined_params.length).first || kwargs
|
36
|
+
raise ArgumentError, "Unexpected argument #{opts}" unless opts.is_a? Hash
|
20
37
|
|
38
|
+
# Checking options
|
39
|
+
unknown_options = opts.keys - __defined_options
|
40
|
+
message = "Key(s) #{unknown_options} not found in #{__defined_options}"
|
41
|
+
raise KeyError, message if unknown_options.any?
|
42
|
+
end
|
43
|
+
|
44
|
+
def __defined_options
|
45
|
+
dry_initializer.options.map(&:source)
|
46
|
+
end
|
47
|
+
|
48
|
+
def __defined_params
|
49
|
+
dry_initializer.params.map(&:source)
|
50
|
+
end
|
51
|
+
end
|
21
52
|
end
|
data/spec/method_object_spec.rb
CHANGED
@@ -1,71 +1,116 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
|
3
|
+
class MinimalMethodObject
|
4
|
+
include MethodObject
|
4
5
|
|
5
|
-
|
6
|
+
option :color
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
def call
|
9
|
+
"The color is #{color}"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class ExampleMethodObject
|
14
|
+
include MethodObject
|
15
|
+
|
16
|
+
param :shape
|
17
|
+
option :color
|
18
|
+
option :size, default: -> { :big }
|
19
|
+
|
20
|
+
def call
|
21
|
+
block_given? ? yield(to_s) : to_s
|
22
|
+
end
|
23
|
+
|
24
|
+
def to_s
|
25
|
+
"#{size} #{color} #{shape}"
|
11
26
|
end
|
27
|
+
end
|
28
|
+
|
29
|
+
class InspectionMethodObject
|
30
|
+
include MethodObject
|
31
|
+
|
32
|
+
param :something
|
12
33
|
|
13
|
-
|
34
|
+
def call
|
35
|
+
something
|
14
36
|
end
|
37
|
+
end
|
38
|
+
|
39
|
+
RSpec.describe MethodObject do
|
40
|
+
describe '.param' do
|
41
|
+
context 'when defining a default value' do
|
42
|
+
it 'raises an error' do
|
43
|
+
expect do
|
44
|
+
Class.new do
|
45
|
+
include MethodObject
|
46
|
+
|
47
|
+
param :shape, default: -> { :square }
|
48
|
+
end
|
49
|
+
end.to raise_error ArgumentError, /not allowed/
|
50
|
+
end
|
51
|
+
end
|
15
52
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
53
|
+
context 'when defined as optional' do
|
54
|
+
it 'raises an error' do
|
55
|
+
expect do
|
56
|
+
Class.new do
|
57
|
+
include MethodObject
|
58
|
+
|
59
|
+
param :user, optional: true
|
60
|
+
end
|
61
|
+
end.to raise_error ArgumentError, /not supported/
|
20
62
|
end
|
21
63
|
end
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
expect
|
26
|
-
|
64
|
+
|
65
|
+
context 'when properly defined' do
|
66
|
+
it 'is mandatory' do
|
67
|
+
expect do
|
68
|
+
ExampleMethodObject.call
|
69
|
+
end.to raise_error ArgumentError, /wrong number of arguments/
|
27
70
|
end
|
28
71
|
end
|
29
72
|
end
|
30
73
|
|
74
|
+
describe '.call' do
|
75
|
+
context 'without block' do
|
76
|
+
it 'has access to options' do
|
77
|
+
result = MinimalMethodObject.call color: 'blue'
|
31
78
|
|
32
|
-
|
33
|
-
subject{ SimpleMethodObjectWithNoCallMethod }
|
34
|
-
it_behaves_like 'a method object'
|
35
|
-
describe '.call' do
|
36
|
-
it 'should raise a SimpleMethodObjectWithNoCallMethod#call is not defined error' do
|
37
|
-
expect{ subject.call }.to raise_error StandardError, "SimpleMethodObjectWithNoCallMethod#call is not defined"
|
79
|
+
expect(result).to eq 'The color is blue'
|
38
80
|
end
|
39
81
|
end
|
40
|
-
end
|
41
82
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
83
|
+
context 'with block' do
|
84
|
+
it 'passes the block' do
|
85
|
+
result = ExampleMethodObject.call('circle', color: 'blue', &:upcase)
|
86
|
+
|
87
|
+
expect(result).to eq 'BIG BLUE CIRCLE'
|
88
|
+
end
|
48
89
|
end
|
49
|
-
end
|
50
90
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
[[
|
56
|
-
|
57
|
-
]
|
91
|
+
context 'with unknown options' do
|
92
|
+
it 'raises an error' do
|
93
|
+
expect do
|
94
|
+
ExampleMethodObject.call 'square', color: 'red', ability: 'Totally invalid'
|
95
|
+
end.to raise_error KeyError, 'Key(s) [:ability] not found in [:color, :size]'
|
96
|
+
end
|
58
97
|
end
|
59
|
-
end
|
60
98
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
99
|
+
context 'without options' do
|
100
|
+
it 'raises an error' do
|
101
|
+
expect do
|
102
|
+
ExampleMethodObject.call 'square', 'boom!'
|
103
|
+
end.to raise_error ArgumentError, 'Unexpected argument boom!'
|
65
104
|
end
|
105
|
+
end
|
66
106
|
|
67
|
-
|
107
|
+
context 'with one param' do
|
108
|
+
it 'has the argument that was passed in' do
|
109
|
+
object = Object.new
|
110
|
+
result = InspectionMethodObject.call object
|
111
|
+
|
112
|
+
expect(result).to be object
|
113
|
+
end
|
68
114
|
end
|
69
115
|
end
|
70
|
-
|
71
116
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,19 +1,17 @@
|
|
1
|
+
require 'bundler/setup'
|
1
2
|
require 'method_object'
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
# loaded once.
|
7
|
-
#
|
8
|
-
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
3
|
+
|
4
|
+
require 'warning'
|
5
|
+
Warning.process { raise "This gem should not cause deprecation warnings, but it did: #{_1}" }
|
6
|
+
|
9
7
|
RSpec.configure do |config|
|
10
|
-
|
11
|
-
config.
|
12
|
-
|
8
|
+
# Enable flags like --only-failures and --next-failure
|
9
|
+
config.example_status_persistence_file_path = '.rspec_status'
|
10
|
+
|
11
|
+
# Disable RSpec exposing methods globally on `Module` and `main`
|
12
|
+
config.disable_monkey_patching!
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
# --seed 1234
|
18
|
-
config.order = 'random'
|
14
|
+
config.expect_with :rspec do |c|
|
15
|
+
c.syntax = :expect
|
16
|
+
end
|
19
17
|
end
|
metadata
CHANGED
@@ -1,90 +1,96 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: method_object
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Bukowskis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-03-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: dry-initializer
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec-core
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
20
34
|
type: :development
|
21
35
|
prerelease: false
|
22
36
|
version_requirements: !ruby/object:Gem::Requirement
|
23
37
|
requirements:
|
24
|
-
- -
|
38
|
+
- - ">="
|
25
39
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
42
|
+
name: rspec-expectations
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
|
-
- -
|
45
|
+
- - ">="
|
32
46
|
- !ruby/object:Gem::Version
|
33
47
|
version: '0'
|
34
48
|
type: :development
|
35
49
|
prerelease: false
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
38
|
-
- -
|
52
|
+
- - ">="
|
39
53
|
- !ruby/object:Gem::Version
|
40
54
|
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
56
|
+
name: rubocop
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
|
-
- -
|
59
|
+
- - ">="
|
46
60
|
- !ruby/object:Gem::Version
|
47
61
|
version: '0'
|
48
62
|
type: :development
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
|
-
- -
|
66
|
+
- - ">="
|
53
67
|
- !ruby/object:Gem::Version
|
54
68
|
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
70
|
+
name: rubocop-rspec
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
|
-
- -
|
73
|
+
- - ">="
|
60
74
|
- !ruby/object:Gem::Version
|
61
75
|
version: '0'
|
62
76
|
type: :development
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
|
-
- -
|
80
|
+
- - ">="
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: '0'
|
69
|
-
description:
|
70
|
-
email:
|
71
|
-
- jared@deadlyicon.com
|
83
|
+
description:
|
84
|
+
email:
|
72
85
|
executables: []
|
73
86
|
extensions: []
|
74
87
|
extra_rdoc_files: []
|
75
88
|
files:
|
76
|
-
- .gitignore
|
77
|
-
- .rspec
|
78
|
-
- .travis.yml
|
79
|
-
- Gemfile
|
80
|
-
- LICENSE
|
81
89
|
- README.md
|
82
|
-
- Rakefile
|
83
90
|
- lib/method_object.rb
|
84
|
-
- method_object.gemspec
|
85
91
|
- spec/method_object_spec.rb
|
86
92
|
- spec/spec_helper.rb
|
87
|
-
homepage: https://github.com/
|
93
|
+
homepage: https://github.com/bukowskis/method_object
|
88
94
|
licenses:
|
89
95
|
- MIT
|
90
96
|
metadata: {}
|
@@ -94,20 +100,19 @@ require_paths:
|
|
94
100
|
- lib
|
95
101
|
required_ruby_version: !ruby/object:Gem::Requirement
|
96
102
|
requirements:
|
97
|
-
- -
|
103
|
+
- - ">="
|
98
104
|
- !ruby/object:Gem::Version
|
99
|
-
version:
|
105
|
+
version: 2.7.0
|
100
106
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
107
|
requirements:
|
102
|
-
- -
|
108
|
+
- - ">="
|
103
109
|
- !ruby/object:Gem::Version
|
104
110
|
version: '0'
|
105
111
|
requirements: []
|
106
|
-
|
107
|
-
rubygems_version: 2.1.10
|
112
|
+
rubygems_version: 3.0.3.1
|
108
113
|
signing_key:
|
109
114
|
specification_version: 4
|
110
|
-
summary:
|
115
|
+
summary: Combining the method object pattern with DRY initialization
|
111
116
|
test_files:
|
112
|
-
- spec/method_object_spec.rb
|
113
117
|
- spec/spec_helper.rb
|
118
|
+
- spec/method_object_spec.rb
|
data/.gitignore
DELETED
data/.rspec
DELETED
data/.travis.yml
DELETED
data/Gemfile
DELETED
data/LICENSE
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
Copyright (c) 2012 Jared Grippe
|
2
|
-
|
3
|
-
MIT License
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
a copy of this software and associated documentation files (the
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
11
|
-
the following conditions:
|
12
|
-
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
included in all copies or substantial portions of the Software.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
DELETED
data/method_object.gemspec
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'method_object'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "method_object"
|
8
|
-
spec.version = MethodObject::VERSION
|
9
|
-
spec.authors = ["Jared Grippe"]
|
10
|
-
spec.email = ["jared@deadlyicon.com"]
|
11
|
-
spec.description = %q{wraps up the method object pattern into a class}
|
12
|
-
spec.summary = %q{wraps up the method object pattern into a class}
|
13
|
-
spec.homepage = "https://github.com/deadlyicon/method_object"
|
14
|
-
spec.license = "MIT"
|
15
|
-
|
16
|
-
spec.files = `git ls-files`.split($/)
|
17
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
-
spec.require_paths = ["lib"]
|
20
|
-
|
21
|
-
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
-
spec.add_development_dependency "rake"
|
23
|
-
spec.add_development_dependency 'rspec'
|
24
|
-
spec.add_development_dependency 'pry-debugger'
|
25
|
-
end
|