method_object 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -12
- data/Rakefile +6 -0
- data/lib/method_object.rb +1 -1
- data/method_object.gemspec +21 -17
- metadata +18 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1bfe8995eec3e81eaefbb5ecb602df64a8b245ac
|
4
|
+
data.tar.gz: d47526095a680c8b3541c26d4aa3ca44e1293813
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7fab229d72852bb1a9d53995537c03f2d70b1a549eba1473fe909897fe14165d237aca12021a5ccf41df3db244328b1b455a8129ce716d96213a86bece5f5a8
|
7
|
+
data.tar.gz: 923bb884354b0dfb5ddc2f9cb33b6b15df12480e37ca6d143b93f6f696a4cbc3ff32f5240a8c179033611a07f742e978695bea1dd4e5f6a3743a8143165618da
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
MethodObject is a simple class for facilitating the method object pattern.
|
4
4
|
|
5
|
-
You can think of a MethodObject as a proc with
|
5
|
+
You can think of a MethodObject as a proc with the power of a class. Define methods, use instance variables, etc.
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
@@ -21,21 +21,17 @@ Or install it yourself as:
|
|
21
21
|
## Usage
|
22
22
|
|
23
23
|
```ruby
|
24
|
-
class
|
25
|
-
|
26
|
-
|
27
|
-
def call
|
28
|
-
[@size, color]
|
24
|
+
class OpenDoor < MethodObject
|
25
|
+
def call door
|
26
|
+
open_door!(door)
|
29
27
|
end
|
30
|
-
end
|
31
28
|
|
32
|
-
|
33
|
-
|
34
|
-
option :key_type, default: ->{ :upside }
|
35
|
-
def call
|
36
|
-
[size, color, @key_type]
|
29
|
+
def open_door!(door)
|
30
|
+
door.open
|
37
31
|
end
|
38
32
|
end
|
33
|
+
|
34
|
+
OpenDoor.call(my_door)
|
39
35
|
```
|
40
36
|
|
41
37
|
# Contributing
|
data/Rakefile
CHANGED
data/lib/method_object.rb
CHANGED
data/method_object.gemspec
CHANGED
@@ -1,21 +1,25 @@
|
|
1
|
-
#
|
2
|
-
|
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'
|
3
5
|
|
4
|
-
Gem::Specification.new do |
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
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"
|
10
15
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
gem.require_paths = ["lib"]
|
16
|
-
gem.version = MethodObject::VERSION
|
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"]
|
17
20
|
|
18
|
-
|
19
|
-
|
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'
|
21
25
|
end
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: method_object
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jared Grippe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-11-
|
11
|
+
date: 2013-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: rake
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -71,7 +85,8 @@ files:
|
|
71
85
|
- spec/method_object_spec.rb
|
72
86
|
- spec/spec_helper.rb
|
73
87
|
homepage: https://github.com/deadlyicon/method_object
|
74
|
-
licenses:
|
88
|
+
licenses:
|
89
|
+
- MIT
|
75
90
|
metadata: {}
|
76
91
|
post_install_message:
|
77
92
|
rdoc_options: []
|