pay_dirt 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +9 -0
- data/README.md +6 -3
- data/lib/pay_dirt/use_case.rb +10 -6
- data/lib/pay_dirt/version.rb +1 -1
- data/pay_dirt.gemspec +1 -0
- data/test/test_helper.rb +2 -3
- data/test/unit/pay_dirt/base_test.rb +1 -5
- metadata +17 -3
- data/Gemfile.lock +0 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e655923315bdb6d5e505d48e461eb4e0afec67d
|
4
|
+
data.tar.gz: b4564a452999940afa5089e08c86059d1fccc92e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1981409378dcb42ed4805dab77ca0ac8ddbe2a9a20dbd5ff25496ef9db838e211777ac69506a8c612706779e7d2e64e2a2b845f24a5394ab91fef4c837ba71dd
|
7
|
+
data.tar.gz: 2b71786a43a7a4efd02e5746add7451f26fea1b92239a81d762a52afc58fe1c0b86e0b5e5c5eb778ef9f5824936414d32dac2507622debe2d28e06c1d4c7253f
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
## pay_dirt
|
1
|
+
## pay_dirt [](http://badge.fury.io/rb/pay_dirt) [](https://travis-ci.org/rthbound/pay_dirt) [](https://coveralls.io/r/rthbound/pay_dirt?branch=master)
|
2
|
+
|
2
3
|
#### A Ruby gem based on the "use case" pattern set forth in [opencurriculum-flashcards](https://github.com/isotope11/opencurriculum-flashcards)
|
3
4
|
|
4
5
|
Provides the basic building blocks of a pattern capable of reducing a towering codebase to modular rubble (or more Ruby gems)
|
@@ -61,5 +62,7 @@ result.data[:optional_option] #=> true
|
|
61
62
|
```
|
62
63
|
|
63
64
|
### Other examples
|
64
|
-
[rubeuler](https://github.com/rthbound/rubeuler)
|
65
|
-
[protected_record](https://github.com/rthbound/protected_record)
|
65
|
+
1. [rubeuler](https://github.com/rthbound/rubeuler)
|
66
|
+
2. [protected_record](https://github.com/rthbound/protected_record)
|
67
|
+
3. [konamio](https://github.com/rthbound/konamio)
|
68
|
+
4. [eenie_meenie](https://github.com/rthbound/eenie_meenie)
|
data/lib/pay_dirt/use_case.rb
CHANGED
@@ -1,20 +1,24 @@
|
|
1
1
|
module PayDirt
|
2
2
|
module UseCase
|
3
3
|
def self.included(base)
|
4
|
+
def load_options(*option_names, options)
|
5
|
+
option_names.each { |o| options = load_option(o, options) }
|
6
|
+
options.each_key { |o| options = load_option(o, options) }
|
7
|
+
end
|
8
|
+
|
9
|
+
private
|
4
10
|
def load_option(option, options)
|
5
|
-
instance_variable_set("@#{option}",
|
6
|
-
raise "Missing required option: #{option}"
|
7
|
-
})
|
11
|
+
instance_variable_set("@#{option}", fetch(option, options))
|
8
12
|
|
9
13
|
options.delete(option)
|
10
14
|
|
11
15
|
return options
|
12
16
|
end
|
13
17
|
|
14
|
-
def
|
15
|
-
|
16
|
-
options.each_key { |o| options = load_option(o, options) }
|
18
|
+
def fetch(opt, opts)
|
19
|
+
opts.fetch(opt.to_sym) { raise "Missing required option: #{opt}" }
|
17
20
|
end
|
21
|
+
|
18
22
|
end
|
19
23
|
end
|
20
24
|
end
|
data/lib/pay_dirt/version.rb
CHANGED
data/pay_dirt.gemspec
CHANGED
data/test/test_helper.rb
CHANGED
@@ -32,11 +32,7 @@ describe PayDirt::Base do
|
|
32
32
|
end
|
33
33
|
|
34
34
|
it "must error when initialized without required options" do
|
35
|
-
|
36
|
-
@use_case.new
|
37
|
-
rescue => e
|
38
|
-
e.must_be_kind_of ArgumentError
|
39
|
-
end
|
35
|
+
proc { @use_case.new }.must_raise ArgumentError
|
40
36
|
end
|
41
37
|
|
42
38
|
it "it won't error if defaults were supplied for an omitted option" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pay_dirt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tad Hosford
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: coveralls
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
description: "\n Provides the basic building blocks\n of
|
56
70
|
a pattern capable of reducing a\n towering codebase to modular
|
57
71
|
rubble\n (or more Ruby gems)\n "
|
@@ -64,8 +78,8 @@ files:
|
|
64
78
|
- .gitignore
|
65
79
|
- .ruby-gemset
|
66
80
|
- .ruby-version
|
81
|
+
- .travis.yml
|
67
82
|
- Gemfile
|
68
|
-
- Gemfile.lock
|
69
83
|
- LICENSE
|
70
84
|
- README.md
|
71
85
|
- Rakefile
|
data/Gemfile.lock
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
pay_dirt (0.0.4)
|
5
|
-
|
6
|
-
GEM
|
7
|
-
remote: http://rubygems.org/
|
8
|
-
specs:
|
9
|
-
coderay (1.0.9)
|
10
|
-
method_source (0.8.1)
|
11
|
-
minitest (4.7.3)
|
12
|
-
pry (0.9.12.1)
|
13
|
-
coderay (~> 1.0.5)
|
14
|
-
method_source (~> 0.8)
|
15
|
-
slop (~> 3.4)
|
16
|
-
rake (10.0.4)
|
17
|
-
slop (3.4.4)
|
18
|
-
|
19
|
-
PLATFORMS
|
20
|
-
ruby
|
21
|
-
|
22
|
-
DEPENDENCIES
|
23
|
-
minitest
|
24
|
-
pay_dirt!
|
25
|
-
pry
|
26
|
-
rake
|