rison 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 566b0e9dbc9092248272d6366155bbb816c38656
4
+ data.tar.gz: 87afe8b93dcea92f2188c969b8cd8bb4178f7b3a
5
+ SHA512:
6
+ metadata.gz: da2611ba52ae851ad42db72831832f30c5f8628d6b347eb8644d3c692c9e0fb35227cf48cb6cab2edd82b77b605f3aa8332c114b6fb554a0b96df514488043ec
7
+ data.tar.gz: 5cb1556e6b618f1b3bdf1a819e354703e3721ef0f258a781f79bb04a4e0b24e3a686975c9971724414a9ae3bd068fdd102aed6d07081fdf1dc21ec2d9d3c4533
@@ -25,7 +25,7 @@ module Rison
25
25
 
26
26
  when String then "'#{escape(object)}'"
27
27
 
28
- when Hash then '(%s)' % object.map { |(k, v)| "#{dump(k)}:#{dump(v)}" }.join(?,)
28
+ when Hash then '(%s)' % object.map { |(k, v)| dump_pair(k, v) }.join(?,)
29
29
 
30
30
  when Array then '!(%s)' % object.map { |member| dump(member) }.join(?,)
31
31
 
@@ -34,6 +34,10 @@ module Rison
34
34
  end
35
35
  end
36
36
 
37
+ def self.dump_pair(key, value)
38
+ key.is_a?(Symbol) ? "#{key}:#{dump(value)}" : "#{dump(key.to_s)}:#{dump(value)}"
39
+ end
40
+
37
41
  def self.escape(string)
38
42
  string.gsub('!', '!!').gsub("'", "!'")
39
43
  end
@@ -1,6 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'rison'
3
- s.version = '2.0.0'
3
+ s.version = '2.1.0'
4
+ s.license = 'MIT'
4
5
  s.platform = Gem::Platform::RUBY
5
6
  s.authors = ['Tim Fletcher']
6
7
  s.email = ['mail@tfletcher.com']
@@ -8,6 +9,8 @@ Gem::Specification.new do |s|
8
9
  s.description = 'A Ruby implementation of Rison (http://mjtemplate.org/examples/rison.html)'
9
10
  s.summary = 'See description'
10
11
  s.files = Dir.glob('{lib,spec}/**/*') + %w(README.md Rakefile.rb rison.gemspec License.txt)
11
- s.add_dependency('parslet', ['~> 1.4.0'])
12
+ s.add_dependency('parslet', '~> 1.4')
13
+ s.add_development_dependency('rake', '~> 10')
14
+ s.add_development_dependency('minitest', '~> 5')
12
15
  s.require_path = 'lib'
13
16
  end
@@ -65,6 +65,10 @@ describe 'Rison dump method' do
65
65
  Rison.dump({'id' => nil, 'type' => '/common/document'}).must_equal(%(('id':!n,'type':'/common/document')))
66
66
  end
67
67
 
68
+ it 'encodes numeric hash keys as strings' do
69
+ Rison.dump({1 => 2}).must_equal("('1':2)")
70
+ end
71
+
68
72
  it 'encodes arrays' do
69
73
  Rison.dump([]).must_equal('!()')
70
74
  Rison.dump([true]).must_equal('!(!t)')
metadata CHANGED
@@ -1,32 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rison
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
5
- prerelease:
4
+ version: 2.1.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Tim Fletcher
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-11-03 00:00:00.000000000 Z
11
+ date: 2016-03-30 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: parslet
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
- version: 1.4.0
19
+ version: '1.4'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ~>
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
- version: 1.4.0
26
+ version: '1.4'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '5'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '5'
30
55
  description: A Ruby implementation of Rison (http://mjtemplate.org/examples/rison.html)
31
56
  email:
32
57
  - mail@tfletcher.com
@@ -34,39 +59,38 @@ executables: []
34
59
  extensions: []
35
60
  extra_rdoc_files: []
36
61
  files:
62
+ - License.txt
63
+ - README.md
64
+ - Rakefile.rb
65
+ - lib/rison.rb
37
66
  - lib/rison/dump.rb
38
67
  - lib/rison/parslet_parser.rb
39
68
  - lib/rison/parslet_transform.rb
40
- - lib/rison.rb
69
+ - rison.gemspec
41
70
  - spec/rison_dump_spec.rb
42
71
  - spec/rison_load_spec.rb
43
- - README.md
44
- - Rakefile.rb
45
- - rison.gemspec
46
- - License.txt
47
72
  homepage: http://github.com/tim/ruby-rison
48
- licenses: []
73
+ licenses:
74
+ - MIT
75
+ metadata: {}
49
76
  post_install_message:
50
77
  rdoc_options: []
51
78
  require_paths:
52
79
  - lib
53
80
  required_ruby_version: !ruby/object:Gem::Requirement
54
- none: false
55
81
  requirements:
56
- - - ! '>='
82
+ - - ">="
57
83
  - !ruby/object:Gem::Version
58
84
  version: '0'
59
85
  required_rubygems_version: !ruby/object:Gem::Requirement
60
- none: false
61
86
  requirements:
62
- - - ! '>='
87
+ - - ">="
63
88
  - !ruby/object:Gem::Version
64
89
  version: '0'
65
90
  requirements: []
66
91
  rubyforge_project:
67
- rubygems_version: 1.8.24
92
+ rubygems_version: 2.4.5.1
68
93
  signing_key:
69
- specification_version: 3
94
+ specification_version: 4
70
95
  summary: See description
71
96
  test_files: []
72
- has_rdoc: