method_object 0.1.1 → 1.0.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 +42 -12
- data/spec/method_object_spec.rb +71 -45
- data/spec/spec_helper.rb +10 -15
- metadata +39 -34
- 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: 3b6cfbf7d4687cd268dadbd876eb81148740f126d2f30d1ecc925df05572e263
|
4
|
+
data.tar.gz: 003b2f8abf57ee1aa073e5715b318016e1597053b31a6d540b41627838e813d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 42177284d72db7f0f4888c3a4d42af7f96d7d6ddc0e6a85c7b9926c07b7c34fe511f194ab775da2145fed1a3dd50420e20499554181d42e08a13d73ca43c6ab1
|
7
|
+
data.tar.gz: b56eabe3a2f69cfd845ea74e2ea8b7304f494ad3bdf8d4408d0f31228fa27abd57bab72f0e9581c0fe0644ec0a6fe8f71c39768df2cfe57d218f9025908112b8
|
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,51 @@
|
|
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
|
9
|
+
|
10
|
+
module ClassMethods
|
11
|
+
def call(*args, &block)
|
12
|
+
__check_for_unknown_options(*args)
|
13
|
+
new(*args).call(&block)
|
14
|
+
end
|
4
15
|
|
5
|
-
|
6
|
-
|
16
|
+
# Because of the positioning of multiple params, params can never be omitted.
|
17
|
+
def param(name, type = nil, **opts, &block)
|
18
|
+
raise ArgumentError, "Default value for param not allowed - #{name}" if opts.key? :default
|
19
|
+
raise ArgumentError, "Optional params not supported - #{name}" if opts.fetch(:optional, false)
|
7
20
|
|
8
|
-
|
9
|
-
|
21
|
+
dry_initializer.param(name, type, **opts, &block)
|
22
|
+
self
|
10
23
|
end
|
11
24
|
|
12
|
-
|
13
|
-
|
25
|
+
# DEPRECATED
|
26
|
+
def assign(variable, to:)
|
27
|
+
warn 'MethodObject.assign is deprecated. ' \
|
28
|
+
"Please use this instead: `option #{variable.inspect}, default: ...`"
|
29
|
+
option variable, default: to
|
14
30
|
end
|
15
|
-
end
|
16
31
|
|
17
|
-
|
18
|
-
|
19
|
-
|
32
|
+
def __check_for_unknown_options(*args)
|
33
|
+
return if __defined_options.empty?
|
34
|
+
|
35
|
+
opts = args.drop(__defined_params.length).first || {}
|
36
|
+
raise ArgumentError, "Unexpected argument #{opts}" unless opts.is_a? Hash
|
20
37
|
|
38
|
+
unknown_options = opts.keys - __defined_options
|
39
|
+
message = "Key(s) #{unknown_options} not found in #{__defined_options}"
|
40
|
+
raise KeyError, message if unknown_options.any?
|
41
|
+
end
|
42
|
+
|
43
|
+
def __defined_options
|
44
|
+
dry_initializer.options.map(&:source)
|
45
|
+
end
|
46
|
+
|
47
|
+
def __defined_params
|
48
|
+
dry_initializer.params.map(&:source)
|
49
|
+
end
|
50
|
+
end
|
21
51
|
end
|
data/spec/method_object_spec.rb
CHANGED
@@ -1,71 +1,97 @@
|
|
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
|
-
[args, block]
|
10
|
-
end
|
8
|
+
def call
|
9
|
+
"The color is #{color}"
|
11
10
|
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class ExampleMethodObject
|
14
|
+
include MethodObject
|
12
15
|
|
13
|
-
|
16
|
+
param :shape
|
17
|
+
option :color
|
18
|
+
option :size, default: -> { :big }
|
19
|
+
|
20
|
+
def call
|
21
|
+
block_given? ? yield(to_s) : to_s
|
14
22
|
end
|
15
23
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
24
|
+
def to_s
|
25
|
+
"#{size} #{color} #{shape}"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
RSpec.describe MethodObject do
|
30
|
+
describe '.param' do
|
31
|
+
context 'when defining a default value' do
|
32
|
+
it 'raises an error' do
|
33
|
+
expect do
|
34
|
+
Class.new do
|
35
|
+
include MethodObject
|
36
|
+
|
37
|
+
param :shape, default: -> { :square }
|
38
|
+
end
|
39
|
+
end.to raise_error ArgumentError, /not allowed/
|
20
40
|
end
|
21
41
|
end
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
expect
|
26
|
-
|
42
|
+
|
43
|
+
context 'when defined as optional' do
|
44
|
+
it 'raises an error' do
|
45
|
+
expect do
|
46
|
+
Class.new do
|
47
|
+
include MethodObject
|
48
|
+
|
49
|
+
param :user, optional: true
|
50
|
+
end
|
51
|
+
end.to raise_error ArgumentError, /not supported/
|
27
52
|
end
|
28
53
|
end
|
29
|
-
end
|
30
54
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
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"
|
55
|
+
context 'when properly defined' do
|
56
|
+
it 'is mandatory' do
|
57
|
+
expect do
|
58
|
+
ExampleMethodObject.call
|
59
|
+
end.to raise_error ArgumentError, /wrong number of arguments/
|
38
60
|
end
|
39
61
|
end
|
40
62
|
end
|
41
63
|
|
42
|
-
describe
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
64
|
+
describe '.call' do
|
65
|
+
context 'without block' do
|
66
|
+
it 'has access to options' do
|
67
|
+
result = MinimalMethodObject.call color: 'blue'
|
68
|
+
|
69
|
+
expect(result).to eq 'The color is blue'
|
70
|
+
end
|
48
71
|
end
|
49
|
-
end
|
50
72
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
]
|
73
|
+
context 'with block' do
|
74
|
+
it 'passes the block' do
|
75
|
+
result = ExampleMethodObject.call('circle', color: 'blue', &:upcase)
|
76
|
+
|
77
|
+
expect(result).to eq 'BIG BLUE CIRCLE'
|
78
|
+
end
|
58
79
|
end
|
59
|
-
end
|
60
80
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
81
|
+
context 'with unknown options' do
|
82
|
+
it 'raises an error' do
|
83
|
+
expect do
|
84
|
+
ExampleMethodObject.call 'square', color: 'red', ability: 'Totally invalid'
|
85
|
+
end.to raise_error KeyError, 'Key(s) [:ability] not found in [:color, :size]'
|
65
86
|
end
|
87
|
+
end
|
66
88
|
|
67
|
-
|
89
|
+
context 'without options' do
|
90
|
+
it 'raises an error' do
|
91
|
+
expect do
|
92
|
+
ExampleMethodObject.call 'square', 'boom!'
|
93
|
+
end.to raise_error ArgumentError, 'Unexpected argument boom!'
|
94
|
+
end
|
68
95
|
end
|
69
96
|
end
|
70
|
-
|
71
97
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,19 +1,14 @@
|
|
1
|
+
require 'bundler/setup'
|
1
2
|
require 'method_object'
|
2
|
-
|
3
|
-
# This file was generated by the `rspec --init` command. Conventionally, all
|
4
|
-
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
5
|
-
# Require this file using `require "spec_helper"` to ensure that it is only
|
6
|
-
# loaded once.
|
7
|
-
#
|
8
|
-
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
3
|
+
|
9
4
|
RSpec.configure do |config|
|
10
|
-
|
11
|
-
config.
|
12
|
-
|
5
|
+
# Enable flags like --only-failures and --next-failure
|
6
|
+
config.example_status_persistence_file_path = '.rspec_status'
|
7
|
+
|
8
|
+
# Disable RSpec exposing methods globally on `Module` and `main`
|
9
|
+
config.disable_monkey_patching!
|
13
10
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
# --seed 1234
|
18
|
-
config.order = 'random'
|
11
|
+
config.expect_with :rspec do |c|
|
12
|
+
c.syntax = :expect
|
13
|
+
end
|
19
14
|
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: 0.
|
4
|
+
version: 1.0.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: 2019-09-06 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
105
|
version: '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.6
|
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
|