tfg_support 1.0.1 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/.rspec CHANGED
@@ -1 +0,0 @@
1
- --debugger
@@ -0,0 +1,11 @@
1
+ class Numeric
2
+ def clamp(range)
3
+ if self < range.min
4
+ range.min
5
+ elsif self > range.max
6
+ range.max
7
+ else
8
+ self
9
+ end
10
+ end
11
+ end
@@ -1,5 +1,5 @@
1
1
  module TFG
2
2
  module Support
3
- VERSION = "1.0.1"
3
+ VERSION = "1.1.1"
4
4
  end
5
5
  end
@@ -0,0 +1,32 @@
1
+ require "spec_helper"
2
+
3
+ describe Fixnum do
4
+ describe "#clamp" do
5
+
6
+ subject(:clamp) { numeric.clamp(min..max) }
7
+
8
+ context "when the number is within the range" do
9
+ let(:numeric) { 5.5 }
10
+ let(:min) { 0 }
11
+ let(:max) { 10 }
12
+
13
+ it { should be numeric }
14
+ end
15
+
16
+ context "when the number less than the range minimum" do
17
+ let(:numeric) { -5 }
18
+ let(:min) { 0 }
19
+ let(:max) { 10 }
20
+
21
+ it { should be min }
22
+ end
23
+
24
+ context "when the number greater than the range maximum" do
25
+ let(:numeric) { 12 }
26
+ let(:min) { 0 }
27
+ let(:max) { 10 }
28
+
29
+ it { should be max }
30
+ end
31
+ end
32
+ end
data/tfg_support.gemspec CHANGED
@@ -23,6 +23,5 @@ Gem::Specification.new do |spec|
23
23
  spec.add_development_dependency "rspec"
24
24
  spec.add_development_dependency "yard"
25
25
  spec.add_development_dependency "redcarpet"
26
- spec.add_development_dependency "debugger"
27
26
  spec.add_development_dependency "active_support"
28
27
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tfg_support
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.1
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-08-29 00:00:00.000000000 Z
12
+ date: 2013-09-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -91,22 +91,6 @@ dependencies:
91
91
  - - ! '>='
92
92
  - !ruby/object:Gem::Version
93
93
  version: '0'
94
- - !ruby/object:Gem::Dependency
95
- name: debugger
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'
110
94
  - !ruby/object:Gem::Dependency
111
95
  name: active_support
112
96
  requirement: !ruby/object:Gem::Requirement
@@ -143,6 +127,7 @@ files:
143
127
  - lib/tfg/support/core_ext/hash/deep.rb
144
128
  - lib/tfg/support/core_ext/hash/map_values.rb
145
129
  - lib/tfg/support/core_ext/hash/with_indifferent_equality.rb
130
+ - lib/tfg/support/core_ext/numeric/clamp.rb
146
131
  - lib/tfg/support/core_ext/object.rb
147
132
  - lib/tfg/support/core_ext/object/as.rb
148
133
  - lib/tfg/support/core_ext/string.rb
@@ -156,6 +141,7 @@ files:
156
141
  - spec/tfg/support/core_ext/hash/deep_spec.rb
157
142
  - spec/tfg/support/core_ext/hash/map_values_spec.rb
158
143
  - spec/tfg/support/core_ext/hash/with_indifferent_equality_spec.rb
144
+ - spec/tfg/support/core_ext/numeric/clamp_spec.rb
159
145
  - spec/tfg/support/core_ext/object/as_spec.rb
160
146
  - spec/tfg/support/core_ext/string/to_boolean_spec.rb
161
147
  - spec/tfg/support/deep_hash_accessor_spec.rb
@@ -192,8 +178,10 @@ test_files:
192
178
  - spec/tfg/support/core_ext/hash/deep_spec.rb
193
179
  - spec/tfg/support/core_ext/hash/map_values_spec.rb
194
180
  - spec/tfg/support/core_ext/hash/with_indifferent_equality_spec.rb
181
+ - spec/tfg/support/core_ext/numeric/clamp_spec.rb
195
182
  - spec/tfg/support/core_ext/object/as_spec.rb
196
183
  - spec/tfg/support/core_ext/string/to_boolean_spec.rb
197
184
  - spec/tfg/support/deep_hash_accessor_spec.rb
198
185
  - spec/tfg/support/hash_with_indifferent_equality_spec.rb
199
186
  - spec/tfg/support/sequence_spec.rb
187
+ has_rdoc: