gyoku 0.4.0 → 0.4.1
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/gyoku/version.rb +1 -1
- data/lib/gyoku/xml_key.rb +7 -6
- data/spec/gyoku/xml_key_spec.rb +9 -0
- metadata +3 -3
data/lib/gyoku/version.rb
CHANGED
data/lib/gyoku/xml_key.rb
CHANGED
@@ -14,16 +14,17 @@ module Gyoku
|
|
14
14
|
def create(key, options = {})
|
15
15
|
xml_key = chop_special_characters key.to_s
|
16
16
|
|
17
|
-
if unqualify?(xml_key)
|
17
|
+
if unqualified = unqualify?(xml_key)
|
18
18
|
xml_key = xml_key.split(":").last
|
19
|
-
elsif qualify?(options) && !xml_key.include?(":")
|
20
|
-
xml_key = "#{options[:namespace]}:#{xml_key}"
|
21
19
|
end
|
22
20
|
|
23
|
-
|
24
|
-
|
25
|
-
|
21
|
+
xml_key = symbol_converter.call(xml_key) if Symbol === key
|
22
|
+
|
23
|
+
if !unqualified && qualify?(options) && !xml_key.include?(":")
|
24
|
+
xml_key = "#{options[:namespace]}:#{xml_key}"
|
26
25
|
end
|
26
|
+
|
27
|
+
xml_key
|
27
28
|
end
|
28
29
|
|
29
30
|
# Returns the formula for converting Symbol keys.
|
data/spec/gyoku/xml_key_spec.rb
CHANGED
@@ -30,6 +30,15 @@ describe Gyoku::XMLKey do
|
|
30
30
|
key = create ":qualify", :element_form_default => :qualified, :namespace => :v1
|
31
31
|
key.should == "qualify"
|
32
32
|
end
|
33
|
+
|
34
|
+
it "should add a given :namespace after converting the key" do
|
35
|
+
Gyoku::XMLKey.symbol_converter = :camelcase
|
36
|
+
|
37
|
+
key = create :username, :element_form_default => :qualified, :namespace => :v1
|
38
|
+
key.should == "v1:Username"
|
39
|
+
end
|
40
|
+
|
41
|
+
after { Gyoku::XMLKey.symbol_converter = :lower_camelcase } #reset
|
33
42
|
end
|
34
43
|
end
|
35
44
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gyoku
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 13
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 1
|
10
|
+
version: 0.4.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Daniel Harrington
|