jsondoc 0.0.2 → 0.0.3
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.
- checksums.yaml +4 -4
- data/CHANGELOG +4 -1
- data/README.rdoc +2 -0
- data/VERSION +1 -1
- data/jsondoc.gemspec +2 -2
- data/lib/jsondoc/document.rb +21 -4
- data/test/test_setup.rb +5 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d31ab6bc50e452d8df5d5ffe3eec2517671353b
|
4
|
+
data.tar.gz: 6ef7c6ae540f56e4ad608e7e1952ed1d5185d43d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 594bb9c373b34df5a94df646882a41b197e4f3b5b62e4df0c8164aefff6833e1da0f3c14a73608dadfa43a3ce15b56e6c7d11f2bc0aebbdfd03bb5d1d2e8f146
|
7
|
+
data.tar.gz: 5f3ff7c0a942cf38d6cb258fc39ca98c515e588dcf8bb65b571a5450c66e8df2fe11a6fee4e0fbb1f357ecd0f453ca44b1836171bc98b63bd527424ff606f74c
|
data/CHANGELOG
CHANGED
data/README.rdoc
CHANGED
@@ -38,6 +38,8 @@ Download and install jsondoc with the following:
|
|
38
38
|
thisUser.pushAttr( :email_addresses, 'john@example.com' )
|
39
39
|
thisUser.pushAttr( :email_addresses, 'john.doe@example.com' )
|
40
40
|
|
41
|
+
thisUser.cpAttr( :first_name, :last_name )
|
42
|
+
|
41
43
|
== Notes
|
42
44
|
|
43
45
|
=== Schema Validation
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3
|
data/jsondoc.gemspec
CHANGED
data/lib/jsondoc/document.rb
CHANGED
@@ -78,6 +78,19 @@ module JsonDoc
|
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
81
|
+
def cpAttr(yKeySrc=nil,yKeyDest=nil)
|
82
|
+
yKeySrc = yKeySrc.to_sym if yKeySrc.kind_of?(String)
|
83
|
+
yKeyDest = yKeyDest.to_sym if yKeyDest.kind_of?(String)
|
84
|
+
self.setAttr(yKeyDest, self.getAttr(yKeySrc))
|
85
|
+
end
|
86
|
+
|
87
|
+
def sortKeys()
|
88
|
+
@dDocument.keys.sort!
|
89
|
+
#dProperties = @dDocument[:properties]
|
90
|
+
#dProperties = dProperties.sort
|
91
|
+
#@dDocument[:properties] = dProperties
|
92
|
+
end
|
93
|
+
|
81
94
|
def fromJson(jDocument=nil)
|
82
95
|
if jDocument.kind_of?(String)
|
83
96
|
@dDocument = JSON.load(jDocument)
|
@@ -97,9 +110,11 @@ module JsonDoc
|
|
97
110
|
return JSON.dump( self.asHash() )
|
98
111
|
end
|
99
112
|
|
100
|
-
def getValStringForProperties(aCols=nil)
|
113
|
+
def getValStringForProperties(aCols=nil,sDelimiter=nil)
|
114
|
+
sDelimiter = "\t" unless sDelimiter.kind_of?(String) && sDelimiter.length>0
|
101
115
|
aVals = self.getValArrayForProperties(aCols)
|
102
|
-
sVals = aVals.join(
|
116
|
+
sVals = aVals.join(sDelimiter)
|
117
|
+
#sVals = aVals.join("\t")
|
103
118
|
return sVals
|
104
119
|
end
|
105
120
|
|
@@ -116,9 +131,11 @@ module JsonDoc
|
|
116
131
|
return aVals
|
117
132
|
end
|
118
133
|
|
119
|
-
def getDescStringForProperties(aCols=nil)
|
134
|
+
def getDescStringForProperties(aCols=nil,sDelimiter=nil)
|
135
|
+
sDelimiter = "\t" unless sDelimiter.kind_of?(String) && sDelimiter.length>0
|
120
136
|
aVals = self.getDescArrayForProperties(aCols)
|
121
|
-
sVals = aVals.join(
|
137
|
+
sVals = aVals.join(sDelimiter)
|
138
|
+
#sVals = aVals.join("\t")
|
122
139
|
return sVals
|
123
140
|
end
|
124
141
|
|
data/test/test_setup.rb
CHANGED
@@ -35,5 +35,10 @@ class JsonDocTest < Test::Unit::TestCase
|
|
35
35
|
jDoc.setAttr(:array,['qux'])
|
36
36
|
assert_equal ['qux'], jDoc.getAttr(:array)
|
37
37
|
|
38
|
+
jDoc.setAttr(:id ,'abc')
|
39
|
+
jDoc.setAttr(:foo,'bar')
|
40
|
+
jDoc.cpAttr(:id,:foo)
|
41
|
+
assert_equal jDoc.getAttr(:id), jDoc.getAttr(:foo)
|
42
|
+
|
38
43
|
end
|
39
44
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jsondoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Wang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A base document object
|
14
14
|
email: john@johnwang.com
|