spruz 0.2.9 → 0.2.10
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/spruz/string_camelize.rb +14 -0
- data/lib/spruz/string_underscore.rb +13 -0
- data/lib/spruz/version.rb +1 -1
- data/lib/spruz/xt.rb +1 -0
- data/lib/spruz/xt/string.rb +6 -0
- data/lib/spruz/xt/string_camelize.rb +8 -0
- data/lib/spruz/xt/string_underscore.rb +8 -0
- data/spruz.gemspec +3 -3
- data/tests/test_spruz.rb +25 -0
- metadata +9 -4
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.10
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Spruz
|
2
|
+
module StringCamelize
|
3
|
+
def camelize(first_letter = :upper)
|
4
|
+
case first_letter
|
5
|
+
when :upper, true
|
6
|
+
gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase }
|
7
|
+
when :lower, false
|
8
|
+
self[0].chr.downcase + camelize[1..-1]
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
alias camelcase camelize
|
13
|
+
end
|
14
|
+
end
|
data/lib/spruz/version.rb
CHANGED
data/lib/spruz/xt.rb
CHANGED
data/spruz.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{spruz}
|
5
|
-
s.version = "0.2.
|
5
|
+
s.version = "0.2.10"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = [%q{Florian Frank}]
|
9
|
-
s.date = %q{2011-07-
|
9
|
+
s.date = %q{2011-07-15}
|
10
10
|
s.description = %q{All the stuff that isn't good/big enough for a real library.}
|
11
11
|
s.email = %q{flori@ping.de}
|
12
12
|
s.executables = [%q{enum}]
|
13
13
|
s.extra_rdoc_files = [%q{README}]
|
14
|
-
s.files = [%q{tests}, %q{tests/test_spruz_memoize.rb}, %q{tests/test_spruz.rb}, %q{LICENSE}, %q{Rakefile}, %q{spruz.gemspec}, %q{lib}, %q{lib/spruz.rb}, %q{lib/spruz}, %q{lib/spruz/hash_symbolize_keys_recursive.rb}, %q{lib/spruz/hash_union.rb}, %q{lib/spruz/write.rb}, %q{lib/spruz/version.rb}, %q{lib/spruz/round.rb}, %q{lib/spruz/go.rb}, %q{lib/spruz/generator.rb}, %q{lib/spruz/shuffle.rb}, %q{lib/spruz/deep_dup.rb}, %q{lib/spruz/memoize.rb}, %q{lib/spruz/subhash.rb}, %q{lib/spruz/bijection.rb}, %q{lib/spruz/limited.rb}, %q{lib/spruz/attempt.rb}, %q{lib/spruz/to_proc.rb}, %q{lib/spruz/module_group.rb}, %q{lib/spruz/null.rb}, %q{lib/spruz/xt.rb}, %q{lib/spruz/once.rb}, %q{lib/spruz/xt}, %q{lib/spruz/xt/named.rb}, %q{lib/spruz/xt/hash_symbolize_keys_recursive.rb}, %q{lib/spruz/xt/hash_union.rb}, %q{lib/spruz/xt/write.rb}, %q{lib/spruz/xt/irb.rb}, %q{lib/spruz/xt/round.rb}, %q{lib/spruz/xt/shuffle.rb}, %q{lib/spruz/xt/deep_dup.rb}, %q{lib/spruz/xt/symbol_to_proc.rb}, %q{lib/spruz/xt/subhash.rb}, %q{lib/spruz/xt/attempt.rb}, %q{lib/spruz/xt/null.rb}, %q{lib/spruz/xt/p.rb}, %q{lib/spruz/xt/partial_application.rb}, %q{lib/spruz/xt/time_dummy.rb}, %q{lib/spruz/xt/full.rb}, %q{lib/spruz/xt/range_plus.rb}, %q{lib/spruz/xt/count_by.rb}, %q{lib/spruz/xt/blank.rb}, %q{lib/spruz/xt/uniq_by.rb}, %q{lib/spruz/p.rb}, %q{lib/spruz/minimize.rb}, %q{lib/spruz/partial_application.rb}, %q{lib/spruz/time_dummy.rb}, %q{lib/spruz/range_plus.rb}, %q{lib/spruz/count_by.rb}, %q{lib/spruz/uniq_by.rb}, %q{bin}, %q{bin/enum}, %q{README}, %q{VERSION}, %q{install.rb}]
|
14
|
+
s.files = [%q{tests}, %q{tests/test_spruz_memoize.rb}, %q{tests/test_spruz.rb}, %q{LICENSE}, %q{Rakefile}, %q{spruz.gemspec}, %q{lib}, %q{lib/spruz.rb}, %q{lib/spruz}, %q{lib/spruz/hash_symbolize_keys_recursive.rb}, %q{lib/spruz/string_underscore.rb}, %q{lib/spruz/hash_union.rb}, %q{lib/spruz/write.rb}, %q{lib/spruz/version.rb}, %q{lib/spruz/round.rb}, %q{lib/spruz/go.rb}, %q{lib/spruz/generator.rb}, %q{lib/spruz/string_camelize.rb}, %q{lib/spruz/shuffle.rb}, %q{lib/spruz/deep_dup.rb}, %q{lib/spruz/memoize.rb}, %q{lib/spruz/subhash.rb}, %q{lib/spruz/bijection.rb}, %q{lib/spruz/limited.rb}, %q{lib/spruz/attempt.rb}, %q{lib/spruz/to_proc.rb}, %q{lib/spruz/module_group.rb}, %q{lib/spruz/null.rb}, %q{lib/spruz/xt.rb}, %q{lib/spruz/once.rb}, %q{lib/spruz/xt}, %q{lib/spruz/xt/named.rb}, %q{lib/spruz/xt/hash_symbolize_keys_recursive.rb}, %q{lib/spruz/xt/string_underscore.rb}, %q{lib/spruz/xt/hash_union.rb}, %q{lib/spruz/xt/write.rb}, %q{lib/spruz/xt/irb.rb}, %q{lib/spruz/xt/round.rb}, %q{lib/spruz/xt/string_camelize.rb}, %q{lib/spruz/xt/shuffle.rb}, %q{lib/spruz/xt/deep_dup.rb}, %q{lib/spruz/xt/symbol_to_proc.rb}, %q{lib/spruz/xt/subhash.rb}, %q{lib/spruz/xt/attempt.rb}, %q{lib/spruz/xt/null.rb}, %q{lib/spruz/xt/p.rb}, %q{lib/spruz/xt/partial_application.rb}, %q{lib/spruz/xt/time_dummy.rb}, %q{lib/spruz/xt/string.rb}, %q{lib/spruz/xt/full.rb}, %q{lib/spruz/xt/range_plus.rb}, %q{lib/spruz/xt/count_by.rb}, %q{lib/spruz/xt/blank.rb}, %q{lib/spruz/xt/uniq_by.rb}, %q{lib/spruz/p.rb}, %q{lib/spruz/minimize.rb}, %q{lib/spruz/partial_application.rb}, %q{lib/spruz/time_dummy.rb}, %q{lib/spruz/range_plus.rb}, %q{lib/spruz/count_by.rb}, %q{lib/spruz/uniq_by.rb}, %q{bin}, %q{bin/enum}, %q{README}, %q{VERSION}, %q{install.rb}]
|
15
15
|
s.homepage = %q{http://flori.github.com/spruz}
|
16
16
|
s.rdoc_options = [%q{--title}, %q{Spruz}, %q{--main}, %q{README}]
|
17
17
|
s.require_paths = [%q{lib}]
|
data/tests/test_spruz.rb
CHANGED
@@ -573,4 +573,29 @@ module Spruz
|
|
573
573
|
end
|
574
574
|
end
|
575
575
|
end
|
576
|
+
|
577
|
+
require 'spruz/xt/string'
|
578
|
+
class StringCamelizeTest < Test::Unit::TestCase
|
579
|
+
def test_camelize
|
580
|
+
assert_equal 'FooBar', 'foo_bar'.camelize
|
581
|
+
assert_equal 'FooBar', 'foo_bar'.camelize(:upper)
|
582
|
+
assert_equal 'FooBar', 'foo_bar'.camelize(true)
|
583
|
+
assert_equal 'fooBar', 'foo_bar'.camelize(:lower)
|
584
|
+
assert_equal 'fooBar', 'foo_bar'.camelize(false)
|
585
|
+
assert_equal 'FooBar', 'foo_bar'.camelcase
|
586
|
+
assert_equal 'Foo::Bar', 'foo/bar'.camelize
|
587
|
+
assert_equal 'Foo::Bar', 'foo/bar'.camelize(:upper)
|
588
|
+
assert_equal 'Foo::Bar', 'foo/bar'.camelize(true)
|
589
|
+
assert_equal 'foo::Bar', 'foo/bar'.camelize(:lower)
|
590
|
+
assert_equal 'foo::Bar', 'foo/bar'.camelize(false)
|
591
|
+
assert_equal 'Foo::Bar', 'foo/bar'.camelcase
|
592
|
+
end
|
593
|
+
end
|
594
|
+
|
595
|
+
class StringUnderscoreTest < Test::Unit::TestCase
|
596
|
+
def test_underscore
|
597
|
+
assert_equal 'foo_bar', 'FooBar'.underscore
|
598
|
+
assert_equal 'foo/bar', 'Foo::Bar'.underscore
|
599
|
+
end
|
600
|
+
end
|
576
601
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spruz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 3
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 10
|
10
|
+
version: 0.2.10
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Florian Frank
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-07-
|
18
|
+
date: 2011-07-15 00:00:00 Z
|
19
19
|
dependencies: []
|
20
20
|
|
21
21
|
description: All the stuff that isn't good/big enough for a real library.
|
@@ -34,12 +34,14 @@ files:
|
|
34
34
|
- spruz.gemspec
|
35
35
|
- lib/spruz.rb
|
36
36
|
- lib/spruz/hash_symbolize_keys_recursive.rb
|
37
|
+
- lib/spruz/string_underscore.rb
|
37
38
|
- lib/spruz/hash_union.rb
|
38
39
|
- lib/spruz/write.rb
|
39
40
|
- lib/spruz/version.rb
|
40
41
|
- lib/spruz/round.rb
|
41
42
|
- lib/spruz/go.rb
|
42
43
|
- lib/spruz/generator.rb
|
44
|
+
- lib/spruz/string_camelize.rb
|
43
45
|
- lib/spruz/shuffle.rb
|
44
46
|
- lib/spruz/deep_dup.rb
|
45
47
|
- lib/spruz/memoize.rb
|
@@ -54,10 +56,12 @@ files:
|
|
54
56
|
- lib/spruz/once.rb
|
55
57
|
- lib/spruz/xt/named.rb
|
56
58
|
- lib/spruz/xt/hash_symbolize_keys_recursive.rb
|
59
|
+
- lib/spruz/xt/string_underscore.rb
|
57
60
|
- lib/spruz/xt/hash_union.rb
|
58
61
|
- lib/spruz/xt/write.rb
|
59
62
|
- lib/spruz/xt/irb.rb
|
60
63
|
- lib/spruz/xt/round.rb
|
64
|
+
- lib/spruz/xt/string_camelize.rb
|
61
65
|
- lib/spruz/xt/shuffle.rb
|
62
66
|
- lib/spruz/xt/deep_dup.rb
|
63
67
|
- lib/spruz/xt/symbol_to_proc.rb
|
@@ -67,6 +71,7 @@ files:
|
|
67
71
|
- lib/spruz/xt/p.rb
|
68
72
|
- lib/spruz/xt/partial_application.rb
|
69
73
|
- lib/spruz/xt/time_dummy.rb
|
74
|
+
- lib/spruz/xt/string.rb
|
70
75
|
- lib/spruz/xt/full.rb
|
71
76
|
- lib/spruz/xt/range_plus.rb
|
72
77
|
- lib/spruz/xt/count_by.rb
|