nutella 0.10 → 0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/nutella/core_ext/string/aliases.rb +6 -0
- data/lib/nutella/core_ext/string/colour.rb +7 -0
- data/lib/nutella/core_ext/string/exclude.rb +10 -0
- data/lib/nutella/core_ext/string/heredoc.rb +20 -0
- data/lib/nutella/core_ext/string.rb +1 -34
- data/lib/nutella/version.rb +1 -1
- data/nutella.gemspec +3 -3
- metadata +38 -37
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
class String
|
|
2
|
+
# The inverse of <tt>String#include?</tt>.
|
|
3
|
+
#
|
|
4
|
+
# @param [String] str the string to test for exclusion
|
|
5
|
+
# @return [Boolean] whether or not the string excludes the substring +str+
|
|
6
|
+
def exclude?(str)
|
|
7
|
+
!include? str
|
|
8
|
+
end
|
|
9
|
+
alias excludes? exclude?
|
|
10
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
class String
|
|
2
|
+
# Left-aligns a heredoc by finding the least indented line in the string, and
|
|
3
|
+
# removing that amount of leading whitespace from each line.
|
|
4
|
+
#
|
|
5
|
+
# @example Prints the contents of the heredoc as described on each line
|
|
6
|
+
# puts <<-EOS.heredoc
|
|
7
|
+
# This line would be left-aligned.
|
|
8
|
+
# This line too.
|
|
9
|
+
# This line would be indented by four spaces.
|
|
10
|
+
# As well as this line.
|
|
11
|
+
# And back to left-aligned.
|
|
12
|
+
# EOS
|
|
13
|
+
#
|
|
14
|
+
# @return [String] the string with excess leading whitespace stripped
|
|
15
|
+
def heredoc
|
|
16
|
+
gsub /^[ \t]{#{scan(/^[ \t]*(?=\S)/).min.size}}/, ""
|
|
17
|
+
end
|
|
18
|
+
alias format_heredoc heredoc
|
|
19
|
+
alias strip_heredoc heredoc
|
|
20
|
+
end
|
|
@@ -1,34 +1 @@
|
|
|
1
|
-
|
|
2
|
-
alias contains? include?
|
|
3
|
-
alias includes? include?
|
|
4
|
-
|
|
5
|
-
alias each each_char
|
|
6
|
-
|
|
7
|
-
# The inverse of <tt>String#include?</tt>.
|
|
8
|
-
#
|
|
9
|
-
# @param [String] str the string to test for exclusion
|
|
10
|
-
# @return [Boolean] whether or not the string excludes the substring +str+
|
|
11
|
-
def exclude?(str)
|
|
12
|
-
!include? str
|
|
13
|
-
end
|
|
14
|
-
alias excludes? exclude?
|
|
15
|
-
|
|
16
|
-
# Left-aligns a heredoc by finding the least indented line in the string, and
|
|
17
|
-
# removing that amount of leading whitespace from each line.
|
|
18
|
-
#
|
|
19
|
-
# @example Prints the contents of the heredoc as described on each line
|
|
20
|
-
# puts <<-EOS.heredoc
|
|
21
|
-
# This line would be left-aligned.
|
|
22
|
-
# This line too.
|
|
23
|
-
# This line would be indented by four spaces.
|
|
24
|
-
# As well as this line.
|
|
25
|
-
# And back to left-aligned.
|
|
26
|
-
# EOS
|
|
27
|
-
#
|
|
28
|
-
# @return [String] the string with excess leading whitespace stripped
|
|
29
|
-
def heredoc
|
|
30
|
-
gsub /^[ \t]{#{scan(/^[ \t]*(?=\S)/).min.size}}/, ""
|
|
31
|
-
end
|
|
32
|
-
alias format_heredoc heredoc
|
|
33
|
-
alias strip_heredoc heredoc
|
|
34
|
-
end
|
|
1
|
+
Dir[File.expand_path("../string/**/*.rb", __FILE__)].each { |f| require f }
|
data/lib/nutella/version.rb
CHANGED
data/nutella.gemspec
CHANGED
|
@@ -21,9 +21,9 @@ Gem::Specification.new do |gem|
|
|
|
21
21
|
|
|
22
22
|
gem.required_ruby_version = "~> 1.9"
|
|
23
23
|
gem.add_development_dependency "fuubar", "~> 1.1"
|
|
24
|
-
gem.add_development_dependency "rake", "~> 0
|
|
25
|
-
gem.add_development_dependency "redcarpet", "~> 2.
|
|
26
|
-
gem.add_development_dependency "rdoc", "~> 3.
|
|
24
|
+
gem.add_development_dependency "rake", "~> 10.0"
|
|
25
|
+
gem.add_development_dependency "redcarpet", "~> 2.2"
|
|
26
|
+
gem.add_development_dependency "rdoc", "~> 3.12"
|
|
27
27
|
gem.add_development_dependency "rspec", "~> 2.11"
|
|
28
28
|
gem.add_development_dependency "yard", "~> 0.8"
|
|
29
29
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: nutella
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: '0.
|
|
4
|
+
version: '0.11'
|
|
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: 2012-
|
|
12
|
+
date: 2012-12-07 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: fuubar
|
|
@@ -34,7 +34,7 @@ dependencies:
|
|
|
34
34
|
requirements:
|
|
35
35
|
- - ~>
|
|
36
36
|
- !ruby/object:Gem::Version
|
|
37
|
-
version: '0
|
|
37
|
+
version: '10.0'
|
|
38
38
|
type: :development
|
|
39
39
|
prerelease: false
|
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -42,7 +42,7 @@ dependencies:
|
|
|
42
42
|
requirements:
|
|
43
43
|
- - ~>
|
|
44
44
|
- !ruby/object:Gem::Version
|
|
45
|
-
version: '0
|
|
45
|
+
version: '10.0'
|
|
46
46
|
- !ruby/object:Gem::Dependency
|
|
47
47
|
name: redcarpet
|
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -50,7 +50,7 @@ dependencies:
|
|
|
50
50
|
requirements:
|
|
51
51
|
- - ~>
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
|
-
version: '2.
|
|
53
|
+
version: '2.2'
|
|
54
54
|
type: :development
|
|
55
55
|
prerelease: false
|
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -58,7 +58,7 @@ dependencies:
|
|
|
58
58
|
requirements:
|
|
59
59
|
- - ~>
|
|
60
60
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: '2.
|
|
61
|
+
version: '2.2'
|
|
62
62
|
- !ruby/object:Gem::Dependency
|
|
63
63
|
name: rdoc
|
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -66,7 +66,7 @@ dependencies:
|
|
|
66
66
|
requirements:
|
|
67
67
|
- - ~>
|
|
68
68
|
- !ruby/object:Gem::Version
|
|
69
|
-
version: '3.
|
|
69
|
+
version: '3.12'
|
|
70
70
|
type: :development
|
|
71
71
|
prerelease: false
|
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -74,7 +74,7 @@ dependencies:
|
|
|
74
74
|
requirements:
|
|
75
75
|
- - ~>
|
|
76
76
|
- !ruby/object:Gem::Version
|
|
77
|
-
version: '3.
|
|
77
|
+
version: '3.12'
|
|
78
78
|
- !ruby/object:Gem::Dependency
|
|
79
79
|
name: rspec
|
|
80
80
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -113,41 +113,45 @@ executables: []
|
|
|
113
113
|
extensions: []
|
|
114
114
|
extra_rdoc_files: []
|
|
115
115
|
files:
|
|
116
|
-
- lib/nutella.rb
|
|
117
|
-
- lib/nutella/version.rb
|
|
118
116
|
- lib/nutella/input.rb
|
|
119
|
-
- lib/nutella/
|
|
120
|
-
- lib/nutella/core_ext/integer/multiples.rb
|
|
121
|
-
- lib/nutella/core_ext/integer/format.rb
|
|
122
|
-
- lib/nutella/core_ext/integer/digits.rb
|
|
123
|
-
- lib/nutella/core_ext/object.rb
|
|
117
|
+
- lib/nutella/version.rb
|
|
124
118
|
- lib/nutella/core_ext/string.rb
|
|
125
119
|
- lib/nutella/core_ext/file.rb
|
|
120
|
+
- lib/nutella/core_ext/object/aliases.rb
|
|
121
|
+
- lib/nutella/core_ext/object/blank.rb
|
|
122
|
+
- lib/nutella/core_ext/integer.rb
|
|
123
|
+
- lib/nutella/core_ext/enumerable/map.rb
|
|
126
124
|
- lib/nutella/core_ext/enumerable/group.rb
|
|
127
|
-
- lib/nutella/core_ext/enumerable/sum.rb
|
|
128
125
|
- lib/nutella/core_ext/enumerable/apply.rb
|
|
129
|
-
- lib/nutella/core_ext/enumerable/map.rb
|
|
130
126
|
- lib/nutella/core_ext/enumerable/search.rb
|
|
131
|
-
- lib/nutella/core_ext/
|
|
127
|
+
- lib/nutella/core_ext/enumerable/sum.rb
|
|
128
|
+
- lib/nutella/core_ext/object.rb
|
|
129
|
+
- lib/nutella/core_ext/numeric.rb
|
|
130
|
+
- lib/nutella/core_ext/enumerable.rb
|
|
132
131
|
- lib/nutella/core_ext/hash.rb
|
|
133
|
-
- lib/nutella/core_ext/
|
|
134
|
-
- lib/nutella/core_ext/
|
|
132
|
+
- lib/nutella/core_ext/string/heredoc.rb
|
|
133
|
+
- lib/nutella/core_ext/string/aliases.rb
|
|
134
|
+
- lib/nutella/core_ext/string/exclude.rb
|
|
135
|
+
- lib/nutella/core_ext/string/colour.rb
|
|
135
136
|
- lib/nutella/core_ext/numeric/percent.rb
|
|
136
|
-
- lib/nutella/core_ext/numeric/sanity_check.rb
|
|
137
137
|
- lib/nutella/core_ext/numeric/bytes.rb
|
|
138
|
-
- lib/nutella/core_ext/
|
|
138
|
+
- lib/nutella/core_ext/numeric/sanity_check.rb
|
|
139
|
+
- lib/nutella/core_ext/integer/multiples.rb
|
|
140
|
+
- lib/nutella/core_ext/integer/format.rb
|
|
141
|
+
- lib/nutella/core_ext/integer/digits.rb
|
|
139
142
|
- lib/nutella/core_ext.rb
|
|
143
|
+
- lib/nutella.rb
|
|
144
|
+
- spec/spec_helper.rb
|
|
140
145
|
- spec/support/alias.rb
|
|
141
|
-
- spec/support/number_formats.rb
|
|
142
146
|
- spec/support/apply_tester.rb
|
|
143
|
-
- spec/
|
|
144
|
-
- spec/nutella/core_ext/hash_spec.rb
|
|
145
|
-
- spec/nutella/core_ext/numeric_spec.rb
|
|
146
|
-
- spec/nutella/core_ext/enumerable_spec.rb
|
|
147
|
+
- spec/support/number_formats.rb
|
|
147
148
|
- spec/nutella/core_ext/integer_spec.rb
|
|
149
|
+
- spec/nutella/core_ext/hash_spec.rb
|
|
150
|
+
- spec/nutella/core_ext/object_spec.rb
|
|
148
151
|
- spec/nutella/core_ext/string_spec.rb
|
|
149
152
|
- spec/nutella/core_ext/file_spec.rb
|
|
150
|
-
- spec/
|
|
153
|
+
- spec/nutella/core_ext/numeric_spec.rb
|
|
154
|
+
- spec/nutella/core_ext/enumerable_spec.rb
|
|
151
155
|
- .rspec
|
|
152
156
|
- LICENSE
|
|
153
157
|
- Rakefile
|
|
@@ -172,9 +176,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
172
176
|
- - ! '>='
|
|
173
177
|
- !ruby/object:Gem::Version
|
|
174
178
|
version: '0'
|
|
175
|
-
segments:
|
|
176
|
-
- 0
|
|
177
|
-
hash: -2105265980765175677
|
|
178
179
|
requirements: []
|
|
179
180
|
rubyforge_project:
|
|
180
181
|
rubygems_version: 1.8.24
|
|
@@ -182,15 +183,15 @@ signing_key:
|
|
|
182
183
|
specification_version: 3
|
|
183
184
|
summary: Spread some Nutella on Ruby to sweeten up its functionality.
|
|
184
185
|
test_files:
|
|
186
|
+
- spec/spec_helper.rb
|
|
185
187
|
- spec/support/alias.rb
|
|
186
|
-
- spec/support/number_formats.rb
|
|
187
188
|
- spec/support/apply_tester.rb
|
|
188
|
-
- spec/
|
|
189
|
-
- spec/nutella/core_ext/hash_spec.rb
|
|
190
|
-
- spec/nutella/core_ext/numeric_spec.rb
|
|
191
|
-
- spec/nutella/core_ext/enumerable_spec.rb
|
|
189
|
+
- spec/support/number_formats.rb
|
|
192
190
|
- spec/nutella/core_ext/integer_spec.rb
|
|
191
|
+
- spec/nutella/core_ext/hash_spec.rb
|
|
192
|
+
- spec/nutella/core_ext/object_spec.rb
|
|
193
193
|
- spec/nutella/core_ext/string_spec.rb
|
|
194
194
|
- spec/nutella/core_ext/file_spec.rb
|
|
195
|
-
- spec/
|
|
195
|
+
- spec/nutella/core_ext/numeric_spec.rb
|
|
196
|
+
- spec/nutella/core_ext/enumerable_spec.rb
|
|
196
197
|
has_rdoc:
|