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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7cda58f183562da4e7e27ba4b270919de0f55c53
4
- data.tar.gz: 1580f33fec747b9be76c0c0e82b351e5aa55714e
3
+ metadata.gz: 1bfe8995eec3e81eaefbb5ecb602df64a8b245ac
4
+ data.tar.gz: d47526095a680c8b3541c26d4aa3ca44e1293813
5
5
  SHA512:
6
- metadata.gz: f2599f1d96b78a0bca5e4da74411d979f589bdfcaea5c9779a24d2a8b3876247db31ba53fe87b8dca9ebdc4f47cb881799f33430cc0152f4304a32b8f27df9b3
7
- data.tar.gz: 285b9e3159846a104cc599e62cff4e5c364f27f7ad27651205750e15aa410a752838cb626e0eb4ee6f2e5675feaacdbee8d3d9d199dcc9b22e9597ae2fcc4a4b
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 private methods.
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 OpenChest < MethodObject
25
- option :size, default: 12
26
- option :color, required: true
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
- class OpenMagicChest < OpenChest
33
- option :size, required: true
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
@@ -1,2 +1,8 @@
1
1
  #!/usr/bin/env rake
2
2
  require "bundler/gem_tasks"
3
+
4
+ task :test do
5
+ exec 'bundle exec rspec'
6
+ end
7
+
8
+ task :default => :test
data/lib/method_object.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  class MethodObject
2
2
 
3
- VERSION = '0.1.0'
3
+ VERSION = '0.1.1'
4
4
 
5
5
  class << self
6
6
  private :new
@@ -1,21 +1,25 @@
1
- # -*- encoding: utf-8 -*-
2
- require File.expand_path('../lib/method_object', __FILE__)
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 |gem|
5
- gem.authors = ["Jared Grippe"]
6
- gem.email = ["jared@deadlyicon.com"]
7
- gem.description = %q{wraps up the method object pattern into a class}
8
- gem.summary = %q{wraps up the method object pattern into a class}
9
- gem.homepage = "https://github.com/deadlyicon/method_object"
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
- gem.files = `git ls-files`.split($\)
12
- gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
- gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
- gem.name = "method_object"
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
- gem.add_development_dependency 'rake'
19
- gem.add_development_dependency 'rspec'
20
- gem.add_development_dependency 'pry-debugger'
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.0
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-06 00:00:00.000000000 Z
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: []