pay_dirt 0.0.5 → 0.0.6

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: d13653ca31886f48e4ba93eb97ae6f91cef87374
4
- data.tar.gz: c3d0eccb7a62fe7230a537e3575d39a14779dd7f
3
+ metadata.gz: 5e655923315bdb6d5e505d48e461eb4e0afec67d
4
+ data.tar.gz: b4564a452999940afa5089e08c86059d1fccc92e
5
5
  SHA512:
6
- metadata.gz: d670fdd42176d8a7f2d4a7d67c47dbe573f0db4ac1fa01de6f7c3ec3237686148fee629cb1f234533aa0c9880413815e830b562ff7a4e181bf26479a7fd8001f
7
- data.tar.gz: 7d4e283310e7a594064bcef39a5fdc06bde3085cccc890d08b4c8c8bb5a030220be728198e617a985ef1f11584b8083175fadb05e27cfdce085c9dec195180e0
6
+ metadata.gz: 1981409378dcb42ed4805dab77ca0ac8ddbe2a9a20dbd5ff25496ef9db838e211777ac69506a8c612706779e7d2e64e2a2b845f24a5394ab91fef4c837ba71dd
7
+ data.tar.gz: 2b71786a43a7a4efd02e5746add7451f26fea1b92239a81d762a52afc58fe1c0b86e0b5e5c5eb778ef9f5824936414d32dac2507622debe2d28e06c1d4c7253f
data/.travis.yml ADDED
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
4
+ - 1.9.3
5
+ - 1.9.2
6
+ - jruby-19mode
7
+ - ruby-head
8
+ - jruby-head
9
+ script: bundle exec rake test
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
- ## pay_dirt
1
+ ## pay_dirt [![Gem Version](https://badge.fury.io/rb/pay_dirt.png)](http://badge.fury.io/rb/pay_dirt) [![Build Status](https://travis-ci.org/rthbound/pay_dirt.png?branch=master)](https://travis-ci.org/rthbound/pay_dirt) [![Coverage Status](https://coveralls.io/repos/rthbound/pay_dirt/badge.png?branch=master)](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)
@@ -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}", options.fetch(option.to_sym) {
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 load_options(*option_names, options)
15
- option_names.each { |o| options = load_option(o, options) }
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
@@ -1,3 +1,3 @@
1
1
  module PayDirt
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
data/pay_dirt.gemspec CHANGED
@@ -27,4 +27,5 @@ Gem::Specification.new do |s|
27
27
  s.add_development_dependency "minitest"
28
28
  s.add_development_dependency "rake"
29
29
  s.add_development_dependency "pry"
30
+ s.add_development_dependency "coveralls"
30
31
  end
data/test/test_helper.rb CHANGED
@@ -1,7 +1,6 @@
1
- # Set up simplecov
2
- ENV["RAILS_ENV"] = "test"
1
+ require 'coveralls'
2
+ Coveralls.wear!
3
3
 
4
- require "minitest/spec"
5
4
  require "minitest/autorun"
6
5
 
7
6
  # Debugger
@@ -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
- begin
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.5
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-04-30 00:00:00.000000000 Z
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