wordnik_ruby_helpers 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- wordnik_ruby_helpers (0.0.5)
4
+ wordnik_ruby_helpers (0.0.8)
5
5
  RedCloth (>= 4.2.3)
6
6
  rails
7
7
 
@@ -1,3 +1,3 @@
1
1
  module WordnikRubyHelpers
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
@@ -263,4 +263,11 @@ class Array
263
263
  self[0..self.size-2]
264
264
  end
265
265
 
266
+ # Randomly move around the contents of the array, but not by too much.
267
+ def jiggle(max_deviation=5)
268
+ replacement = []
269
+ self.each_slice(max_deviation) {|a| replacement << a.shuffle }
270
+ replacement
271
+ end
272
+
266
273
  end
@@ -27,4 +27,21 @@ describe WordnikRubyHelpers do
27
27
 
28
28
  end
29
29
 
30
+ describe "value_or_default" do
31
+ it "returns a default message if argument is blank" do
32
+ value_or_default(nil).should == "<span class=\"blank\">not specified</span>"
33
+ value_or_default("").should == "<span class=\"blank\">not specified</span>"
34
+ end
35
+
36
+ it "returns a custom message if argument is blank" do
37
+ value_or_default(nil, "nada").should == "<span class=\"blank\">nada</span>"
38
+ end
39
+
40
+ it "returns the argument if it's not blank" do
41
+ value_or_default("Arg Matey").should == "Arg Matey"
42
+ value_or_default("Arg Matey", "nada").should == "Arg Matey"
43
+ end
44
+ end
45
+
46
+
30
47
  end
metadata CHANGED
@@ -1,12 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wordnik_ruby_helpers
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 0
8
- - 8
9
- version: 0.0.8
4
+ prerelease:
5
+ version: 0.0.9
10
6
  platform: ruby
11
7
  authors:
12
8
  - Zeke Sikelianos
@@ -15,7 +11,7 @@ autorequire:
15
11
  bindir: bin
16
12
  cert_chain: []
17
13
 
18
- date: 2011-01-28 00:00:00 -08:00
14
+ date: 2011-03-22 00:00:00 -07:00
19
15
  default_executable:
20
16
  dependencies:
21
17
  - !ruby/object:Gem::Dependency
@@ -26,8 +22,6 @@ dependencies:
26
22
  requirements:
27
23
  - - ">="
28
24
  - !ruby/object:Gem::Version
29
- segments:
30
- - 0
31
25
  version: "0"
32
26
  type: :runtime
33
27
  version_requirements: *id001
@@ -39,10 +33,6 @@ dependencies:
39
33
  requirements:
40
34
  - - ">="
41
35
  - !ruby/object:Gem::Version
42
- segments:
43
- - 4
44
- - 2
45
- - 3
46
36
  version: 4.2.3
47
37
  type: :runtime
48
38
  version_requirements: *id002
@@ -54,8 +44,6 @@ dependencies:
54
44
  requirements:
55
45
  - - ">="
56
46
  - !ruby/object:Gem::Version
57
- segments:
58
- - 0
59
47
  version: "0"
60
48
  type: :development
61
49
  version_requirements: *id003
@@ -95,21 +83,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
95
83
  requirements:
96
84
  - - ">="
97
85
  - !ruby/object:Gem::Version
98
- segments:
99
- - 0
100
86
  version: "0"
101
87
  required_rubygems_version: !ruby/object:Gem::Requirement
102
88
  none: false
103
89
  requirements:
104
90
  - - ">="
105
91
  - !ruby/object:Gem::Version
106
- segments:
107
- - 0
108
92
  version: "0"
109
93
  requirements: []
110
94
 
111
95
  rubyforge_project: wordnik_ruby_helpers
112
- rubygems_version: 1.3.7
96
+ rubygems_version: 1.6.2
113
97
  signing_key:
114
98
  specification_version: 3
115
99
  summary: A handful of monkey patches and view helpers that we use in our rails projects