rash 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/rash.rb +4 -1
- data/rash.gemspec +58 -0
- data/spec/rash_spec.rb +5 -1
- metadata +2 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/lib/rash.rb
CHANGED
@@ -11,9 +11,12 @@ module Hashie
|
|
11
11
|
end
|
12
12
|
|
13
13
|
# converts a camel_cased string to a underscore string
|
14
|
+
# subs spaces with underscores, strips whitespace
|
14
15
|
# Same way ActiveSupport does string.underscore
|
15
16
|
def underscore_string(str)
|
16
|
-
str.to_s.
|
17
|
+
str.to_s.strip.
|
18
|
+
gsub(' ', '_').
|
19
|
+
gsub(/::/, '/').
|
17
20
|
gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
|
18
21
|
gsub(/([a-z\d])([A-Z])/,'\1_\2').
|
19
22
|
tr("-", "_").
|
data/rash.gemspec
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{rash}
|
8
|
+
s.version = "0.1.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["tcocca"]
|
12
|
+
s.date = %q{2010-08-26}
|
13
|
+
s.description = %q{simple extension to Hashie::Mash for rubyified keys, all keys are converted to underscore to eliminate horrible camelCasing}
|
14
|
+
s.email = %q{tom.cocca@gmail.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
".gitignore",
|
22
|
+
"LICENSE",
|
23
|
+
"README.rdoc",
|
24
|
+
"Rakefile",
|
25
|
+
"VERSION",
|
26
|
+
"lib/rash.rb",
|
27
|
+
"rash.gemspec",
|
28
|
+
"spec/rash_spec.rb",
|
29
|
+
"spec/spec.opts",
|
30
|
+
"spec/spec_helper.rb"
|
31
|
+
]
|
32
|
+
s.homepage = %q{http://github.com/tcocca/rash}
|
33
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
34
|
+
s.require_paths = ["lib"]
|
35
|
+
s.rubygems_version = %q{1.3.5}
|
36
|
+
s.summary = %q{simple extension to Hashie::Mash for rubyified keys}
|
37
|
+
s.test_files = [
|
38
|
+
"spec/rash_spec.rb",
|
39
|
+
"spec/spec_helper.rb"
|
40
|
+
]
|
41
|
+
|
42
|
+
if s.respond_to? :specification_version then
|
43
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
44
|
+
s.specification_version = 3
|
45
|
+
|
46
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
47
|
+
s.add_runtime_dependency(%q<hashie>, [">= 0.3.1"])
|
48
|
+
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
49
|
+
else
|
50
|
+
s.add_dependency(%q<hashie>, [">= 0.3.1"])
|
51
|
+
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
52
|
+
end
|
53
|
+
else
|
54
|
+
s.add_dependency(%q<hashie>, [">= 0.3.1"])
|
55
|
+
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
data/spec/rash_spec.rb
CHANGED
@@ -16,7 +16,9 @@ describe Hashie::Rash do
|
|
16
16
|
"nestedTwo" => {
|
17
17
|
"nested_two" => 22,
|
18
18
|
:nestedThree => 23
|
19
|
-
}
|
19
|
+
},
|
20
|
+
"spaced Key" => "When would this happen?",
|
21
|
+
"trailing spaces " => "better safe than sorry"
|
20
22
|
})
|
21
23
|
}
|
22
24
|
|
@@ -35,6 +37,8 @@ describe Hashie::Rash do
|
|
35
37
|
subject.nested_two.should be_a(Hashie::Rash)
|
36
38
|
subject.nested_two.nested_two.should == 22
|
37
39
|
subject.nested_two.nested_three.should == 23
|
40
|
+
subject.spaced_key.should == "When would this happen?"
|
41
|
+
subject.trailing_spaces.should == "better safe than sorry"
|
38
42
|
end
|
39
43
|
|
40
44
|
it "should allow camelCased accessors" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- tcocca
|
@@ -49,6 +49,7 @@ files:
|
|
49
49
|
- Rakefile
|
50
50
|
- VERSION
|
51
51
|
- lib/rash.rb
|
52
|
+
- rash.gemspec
|
52
53
|
- spec/rash_spec.rb
|
53
54
|
- spec/spec.opts
|
54
55
|
- spec/spec_helper.rb
|