jsondoc 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ca4466650ed76801d4ebe0f4761b2ca4dac71a40
4
- data.tar.gz: ff506a4d784eea2ed81ed0e1bba730ecfec43a47
3
+ metadata.gz: 4d31ab6bc50e452d8df5d5ffe3eec2517671353b
4
+ data.tar.gz: 6ef7c6ae540f56e4ad608e7e1952ed1d5185d43d
5
5
  SHA512:
6
- metadata.gz: 50362e8f0f9e3e594232c5e7a47e9854d2209024d3cf0b022d6f31d721eb9e32d6a31e4744b97fbf878f9369fb16f1c2bd90ea6ecc66999b29f5cf78f6b68da0
7
- data.tar.gz: 9bf554caa53803fffd2611c2f389fa8ca4d1bd15622dc60f85c3e5e46fd2e0669fa0173e6a142c7633fae54584d6ec8726acc1a25d84a2a0769cba445bae4492
6
+ metadata.gz: 594bb9c373b34df5a94df646882a41b197e4f3b5b62e4df0c8164aefff6833e1da0f3c14a73608dadfa43a3ce15b56e6c7d11f2bc0aebbdfd03bb5d1d2e8f146
7
+ data.tar.gz: 5f3ff7c0a942cf38d6cb258fc39ca98c515e588dcf8bb65b571a5450c66e8df2fe11a6fee4e0fbb1f357ecd0f453ca44b1836171bc98b63bd527424ff606f74c
data/CHANGELOG CHANGED
@@ -1,5 +1,8 @@
1
+ = 0.0.3
2
+ - Added cpAttr() method
3
+
1
4
  = 0.0.2
2
5
  - README bugfix
3
6
 
4
7
  = 0.0.1
5
- - Initial release
8
+ - Initial release
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.2
1
+ 0.0.3
data/jsondoc.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'jsondoc'
3
- s.version = '0.0.2'
4
- s.date = '2014-01-31'
3
+ s.version = '0.0.3'
4
+ s.date = '2014-02-12'
5
5
  s.summary = 'JsonDoc'
6
6
  s.description = 'A base document object'
7
7
  s.authors = ['John Wang']
@@ -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("\t")
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("\t")
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.2
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-01-31 00:00:00.000000000 Z
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