bootstripe 0.2.11 → 0.2.12
Sign up to get free protection for your applications and to get access to all the features.
@@ -9,4 +9,18 @@ class Hash
|
|
9
9
|
end
|
10
10
|
keys
|
11
11
|
end
|
12
|
+
|
13
|
+
def deep_push_merge!(other)
|
14
|
+
other.each_pair do |key, other_val|
|
15
|
+
val = self[key]
|
16
|
+
case val
|
17
|
+
when Array
|
18
|
+
self[key] = val + [*other_val]
|
19
|
+
when Hash
|
20
|
+
val.deep_push_merge! other_val
|
21
|
+
else
|
22
|
+
self[key] = other_val unless other_val.nil?
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
12
26
|
end
|
data/lib/bootstripe/version.rb
CHANGED
data/spec/hash_additions_spec.rb
CHANGED
@@ -6,4 +6,10 @@ describe Hash do
|
|
6
6
|
{ :a => { :b => { :c => :d, :e => :f }}}.nested_keys.should =~ [:a, :b, :c, :e]
|
7
7
|
end
|
8
8
|
|
9
|
+
it 'should deep push merge' do
|
10
|
+
h = { :a => { :b => [1, 2] }, :c => :d }
|
11
|
+
h.deep_push_merge!({ :a => { :b => [3, 4] }, :c => :e })
|
12
|
+
h.should == { :a => { :b => [1,2,3,4] }, :c => :e }
|
13
|
+
end
|
14
|
+
|
9
15
|
end
|
@@ -2,6 +2,12 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Numeric do
|
4
4
|
|
5
|
+
it 'should clamp numbers' do
|
6
|
+
5.clamp(1, 3).should == 3
|
7
|
+
5.clamp(0, 6).should == 5
|
8
|
+
5.clamp(6, 8).should == 6
|
9
|
+
end
|
10
|
+
|
5
11
|
it 'should report formatted time accurately' do
|
6
12
|
0.to_formatted_time.should eq '00:00'
|
7
13
|
(60.75).to_formatted_time.should eq '01:01'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bootstripe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.12
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-05-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70341911314360 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70341911314360
|
25
25
|
description: A handful of useful additions for Ruby
|
26
26
|
email:
|
27
27
|
- mike@bytebin.com
|