subtle 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -15,3 +15,5 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+
19
+ .DS_Store
@@ -6,4 +6,3 @@ rvm:
6
6
  - jruby-19mode
7
7
  - rbx-19mode
8
8
  - jruby-head
9
- - ree
data/Gemfile CHANGED
@@ -1,14 +1,3 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
-
5
- gem 'blankslate'
6
- gem 'mocha'
7
-
8
- gem 'minitest'
9
- group :development do
10
- gem 'guard'
11
- gem 'guard-minitest', :git => 'git://github.com/aspiers/guard-minitest.git'
12
- gem 'ruby_gntp'
13
- gem 'coveralls'
14
- end
data/README.md CHANGED
@@ -180,8 +180,6 @@ With both, you could do this:
180
180
 
181
181
  But with the latter, the call to execute the big web service won't be made until .temperature is called. Future calls to methods on @weather_results will use the same object passed from the Proc.
182
182
 
183
- I know, I know... there are lots of reasons **NOT** to do this, and I'm not saying to do this all the time, but it's neat to know that it is possible.
184
-
185
183
 
186
184
 
187
185
 
@@ -1,5 +1,5 @@
1
1
  require File.dirname(__FILE__) + '/subtle/cover.rb'
2
- Dir[File.dirname(__FILE__) + '/subtle/*.rb'].each {|file| require file }
2
+ Dir[File.dirname(__FILE__) + '/subtle/*.rb'].each { |file| require file }
3
3
 
4
4
  module Subtle
5
5
  end
@@ -0,0 +1,9 @@
1
+ class Proc
2
+ def exception_raised
3
+ self.call
4
+ nil
5
+ rescue => e
6
+ e
7
+ end
8
+ end
9
+
@@ -1,3 +1,3 @@
1
1
  module Subtle
2
- VERSION = "1.1.1"
2
+ VERSION = "1.2.0"
3
3
  end
@@ -0,0 +1,27 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe "exception returning" do
4
+
5
+ ['uh oh', 'another error'].each do |message|
6
+
7
+ describe "a runtime exception" do
8
+
9
+ it "should return a runtime exception" do
10
+ exception = (->() { raise message }).exception_raised
11
+ exception.is_a?(RuntimeError).must_equal true
12
+ exception.message.must_equal message
13
+ end
14
+
15
+ end
16
+
17
+ describe "no runtime exception" do
18
+
19
+ it "should return a runtime exception" do
20
+ exception = (->() { message }).exception_raised
21
+ exception.nil?.must_equal true
22
+ end
23
+
24
+ end
25
+
26
+ end
27
+ end
@@ -19,4 +19,7 @@ Gem::Specification.new do |gem|
19
19
  gem.add_runtime_dependency 'blankslate'
20
20
  gem.add_development_dependency 'mocha'
21
21
  gem.add_development_dependency 'rake'
22
+ gem.add_development_dependency 'minitest'
23
+ gem.add_development_dependency 'coveralls'
24
+ gem.add_development_dependency 'minitest'
22
25
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: subtle
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-11 00:00:00.000000000 Z
12
+ date: 2013-09-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: blankslate
@@ -59,6 +59,54 @@ dependencies:
59
59
  - - ! '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: minitest
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: coveralls
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: minitest
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
62
110
  description: A few small updates to make even more concise Ruby.
63
111
  email:
64
112
  - darren@cauthon.com
@@ -67,10 +115,8 @@ extensions: []
67
115
  extra_rdoc_files: []
68
116
  files:
69
117
  - .gitignore
70
- - .rvmrc
71
118
  - .travis.yml
72
119
  - Gemfile
73
- - Guardfile
74
120
  - LICENSE
75
121
  - README.md
76
122
  - Rakefile
@@ -78,6 +124,7 @@ files:
78
124
  - lib/subtle/array_to_hashes.rb
79
125
  - lib/subtle/array_to_objects.rb
80
126
  - lib/subtle/cover.rb
127
+ - lib/subtle/exception.rb
81
128
  - lib/subtle/lambda_to_object.rb
82
129
  - lib/subtle/lazy_cover.rb
83
130
  - lib/subtle/param_constructor.rb
@@ -88,6 +135,7 @@ files:
88
135
  - spec/subtle/array_to_object_spec.rb
89
136
  - spec/subtle/array_to_objects_spec.rb
90
137
  - spec/subtle/cover_spec.rb
138
+ - spec/subtle/exception_spec.rb
91
139
  - spec/subtle/lambda_to_object_spec.rb
92
140
  - spec/subtle/lazy_cover_spec.rb
93
141
  - spec/subtle/param_constructor_spec.rb
@@ -108,7 +156,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
108
156
  version: '0'
109
157
  segments:
110
158
  - 0
111
- hash: 4485186973684471807
159
+ hash: 1358572796960427440
112
160
  required_rubygems_version: !ruby/object:Gem::Requirement
113
161
  none: false
114
162
  requirements:
@@ -117,7 +165,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
117
165
  version: '0'
118
166
  segments:
119
167
  - 0
120
- hash: 4485186973684471807
168
+ hash: 1358572796960427440
121
169
  requirements: []
122
170
  rubyforge_project:
123
171
  rubygems_version: 1.8.24
@@ -130,6 +178,7 @@ test_files:
130
178
  - spec/subtle/array_to_object_spec.rb
131
179
  - spec/subtle/array_to_objects_spec.rb
132
180
  - spec/subtle/cover_spec.rb
181
+ - spec/subtle/exception_spec.rb
133
182
  - spec/subtle/lambda_to_object_spec.rb
134
183
  - spec/subtle/lazy_cover_spec.rb
135
184
  - spec/subtle/param_constructor_spec.rb
data/.rvmrc DELETED
@@ -1,48 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- # This is an RVM Project .rvmrc file, used to automatically load the ruby
4
- # development environment upon cd'ing into the directory
5
-
6
- # First we specify our desired <ruby>[@<gemset>], the @gemset name is optional,
7
- # Only full ruby name is supported here, for short names use:
8
- # echo "rvm use 1.9.3" > .rvmrc
9
- environment_id="ruby-1.9.3-head"
10
-
11
- # Uncomment the following lines if you want to verify rvm version per project
12
- # rvmrc_rvm_version="1.17.0 (master)" # 1.10.1 seams as a safe start
13
- # eval "$(echo ${rvm_version}.${rvmrc_rvm_version} | awk -F. '{print "[[ "$1*65536+$2*256+$3" -ge "$4*65536+$5*256+$6" ]]"}' )" || {
14
- # echo "This .rvmrc file requires at least RVM ${rvmrc_rvm_version}, aborting loading."
15
- # return 1
16
- # }
17
-
18
- # First we attempt to load the desired environment directly from the environment
19
- # file. This is very fast and efficient compared to running through the entire
20
- # CLI and selector. If you want feedback on which environment was used then
21
- # insert the word 'use' after --create as this triggers verbose mode.
22
- if [[ -d "${rvm_path:-$HOME/.rvm}/environments"
23
- && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
24
- then
25
- \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
26
- [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]] &&
27
- \. "${rvm_path:-$HOME/.rvm}/hooks/after_use" || true
28
- else
29
- # If the environment file has not yet been created, use the RVM CLI to select.
30
- rvm --create "$environment_id" || {
31
- echo "Failed to create RVM environment '${environment_id}'."
32
- return 1
33
- }
34
- fi
35
-
36
- # If you use bundler, this might be useful to you:
37
- # if [[ -s Gemfile ]] && {
38
- # ! builtin command -v bundle >/dev/null ||
39
- # builtin command -v bundle | GREP_OPTIONS= \grep $rvm_path/bin/bundle >/dev/null
40
- # }
41
- # then
42
- # printf "%b" "The rubygem 'bundler' is not installed. Installing it now.\n"
43
- # gem install bundler
44
- # fi
45
- # if [[ -s Gemfile ]] && builtin command -v bundle >/dev/null
46
- # then
47
- # bundle install | GREP_OPTIONS= \grep -vE '^Using|Your bundle is complete'
48
- # fi
data/Guardfile DELETED
@@ -1,12 +0,0 @@
1
- guard 'minitest' do
2
- watch(%r|^test/test_(.*)\.rb|)
3
- watch(%r|^lib/(.*)([^/]+)\.rb|) { |m| "test/#{m[1]}test_#{m[2]}.rb" }
4
- watch(%r|^test/test_helper\.rb|) { "test" }
5
- watch(%r|^lib/(.*)\.rb|) { |m| "test/test_#{m[1]}.rb" }
6
-
7
- watch(%r{^spec/.+_spec\.rb$})
8
- watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
9
- watch(%r{^lib/subtle/(.+)\.rb$}) { |m| "spec/subtle/#{m[1]}_spec.rb" }
10
- watch(%r{^spec/models/.+\.rb$}) { ["spec/models", "spec/acceptance"] }
11
- watch('spec/spec_helper.rb') { "spec" }
12
- end