erlang-terms 1.1.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/.coveralls.yml +1 -0
  3. data/.editorconfig +20 -0
  4. data/.gitignore +10 -18
  5. data/.ruby-gemset +1 -0
  6. data/.ruby-version +1 -0
  7. data/.travis.yml +15 -3
  8. data/.yardopts +6 -0
  9. data/CHANGELOG.md +9 -0
  10. data/Gemfile +21 -1
  11. data/LICENSE.txt +1 -1
  12. data/README.md +95 -17
  13. data/Rakefile +8 -3
  14. data/erlang-terms.gemspec +14 -11
  15. data/lib/erlang-terms.rb +1 -0
  16. data/lib/erlang/associable.rb +98 -0
  17. data/lib/erlang/atom.rb +257 -0
  18. data/lib/erlang/binary.rb +425 -0
  19. data/lib/erlang/bitstring.rb +464 -0
  20. data/lib/erlang/cons.rb +122 -0
  21. data/lib/erlang/enumerable.rb +160 -0
  22. data/lib/erlang/error.rb +4 -0
  23. data/lib/erlang/export.rb +110 -12
  24. data/lib/erlang/float.rb +201 -0
  25. data/lib/erlang/function.rb +259 -0
  26. data/lib/erlang/immutable.rb +101 -0
  27. data/lib/erlang/list.rb +1685 -24
  28. data/lib/erlang/map.rb +935 -21
  29. data/lib/erlang/nil.rb +73 -10
  30. data/lib/erlang/pid.rb +120 -18
  31. data/lib/erlang/port.rb +123 -0
  32. data/lib/erlang/reference.rb +161 -0
  33. data/lib/erlang/string.rb +175 -3
  34. data/lib/erlang/term.rb +24 -0
  35. data/lib/erlang/terms.rb +324 -8
  36. data/lib/erlang/terms/version.rb +1 -1
  37. data/lib/erlang/trie.rb +364 -0
  38. data/lib/erlang/tuple.rb +1582 -14
  39. data/lib/erlang/undefined.rb +32 -0
  40. metadata +49 -71
  41. data/spec/erlang/export_spec.rb +0 -17
  42. data/spec/erlang/list_spec.rb +0 -39
  43. data/spec/erlang/map_spec.rb +0 -24
  44. data/spec/erlang/nil_spec.rb +0 -18
  45. data/spec/erlang/pid_spec.rb +0 -21
  46. data/spec/erlang/string_spec.rb +0 -11
  47. data/spec/erlang/terms_spec.rb +0 -7
  48. data/spec/erlang/tuple_spec.rb +0 -20
  49. data/spec/spec_helper.rb +0 -7
@@ -0,0 +1,32 @@
1
+ module Erlang
2
+ # Licensing
3
+ # =========
4
+ #
5
+ # Portions taken and modified from https://github.com/hamstergem/hamster
6
+ #
7
+ # Copyright (c) 2009-2014 Simon Harris
8
+ #
9
+ # Permission is hereby granted, free of charge, to any person obtaining
10
+ # a copy of this software and associated documentation files (the
11
+ # "Software"), to deal in the Software without restriction, including
12
+ # without limitation the rights to use, copy, modify, merge, publish,
13
+ # distribute, sublicense, and/or sell copies of the Software, and to
14
+ # permit persons to whom the Software is furnished to do so, subject to
15
+ # the following conditions:
16
+ #
17
+ # The above copyright notice and this permission notice shall be
18
+ # included in all copies or substantial portions of the Software.
19
+ #
20
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27
+ #
28
+ # @private
29
+ module Undefined
30
+ end
31
+ Undefined.freeze
32
+ end
metadata CHANGED
@@ -1,120 +1,107 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: erlang-terms
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Bennett
8
8
  autorequire:
9
- bindir: bin
9
+ bindir: exe
10
10
  cert_chain: []
11
- date: 2014-03-06 00:00:00.000000000 Z
11
+ date: 2017-06-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.3'
19
+ version: '1.15'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.3'
27
- - !ruby/object:Gem::Dependency
28
- name: pry
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - '>='
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - '>='
39
- - !ruby/object:Gem::Version
40
- version: '0'
26
+ version: '1.15'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: rake
43
29
  requirement: !ruby/object:Gem::Requirement
44
30
  requirements:
45
- - - '>='
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - '>='
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: rspec
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - '>='
31
+ - - "~>"
60
32
  - !ruby/object:Gem::Version
61
- version: '0'
33
+ version: '12.0'
62
34
  type: :development
63
35
  prerelease: false
64
36
  version_requirements: !ruby/object:Gem::Requirement
65
37
  requirements:
66
- - - '>='
38
+ - - "~>"
67
39
  - !ruby/object:Gem::Version
68
- version: '0'
40
+ version: '12.0'
69
41
  - !ruby/object:Gem::Dependency
70
- name: simplecov
42
+ name: minitest
71
43
  requirement: !ruby/object:Gem::Requirement
72
44
  requirements:
73
- - - '>='
45
+ - - ">="
74
46
  - !ruby/object:Gem::Version
75
47
  version: '0'
76
48
  type: :development
77
49
  prerelease: false
78
50
  version_requirements: !ruby/object:Gem::Requirement
79
51
  requirements:
80
- - - '>='
52
+ - - ">="
81
53
  - !ruby/object:Gem::Version
82
54
  version: '0'
83
- description: Includes simple classes that represent Erlang's export, list, pid, string,
84
- and tuple.
55
+ description: |2
56
+ Includes simple classes that represent Erlang's atom, binary, bitstring,
57
+ compressed, export, function, list, map, nil, pid, port, reference,
58
+ string, and tuple.
85
59
  email:
86
- - andrew@pagodabox.com
60
+ - andrew@pixid.com
87
61
  executables: []
88
62
  extensions: []
89
63
  extra_rdoc_files: []
90
64
  files:
91
- - .gitignore
92
- - .rspec
93
- - .travis.yml
65
+ - ".coveralls.yml"
66
+ - ".editorconfig"
67
+ - ".gitignore"
68
+ - ".rspec"
69
+ - ".ruby-gemset"
70
+ - ".ruby-version"
71
+ - ".travis.yml"
72
+ - ".yardopts"
73
+ - CHANGELOG.md
94
74
  - Gemfile
95
75
  - LICENSE.txt
96
76
  - README.md
97
77
  - Rakefile
98
78
  - erlang-terms.gemspec
79
+ - lib/erlang-terms.rb
80
+ - lib/erlang/associable.rb
81
+ - lib/erlang/atom.rb
82
+ - lib/erlang/binary.rb
83
+ - lib/erlang/bitstring.rb
84
+ - lib/erlang/cons.rb
85
+ - lib/erlang/enumerable.rb
86
+ - lib/erlang/error.rb
99
87
  - lib/erlang/export.rb
88
+ - lib/erlang/float.rb
89
+ - lib/erlang/function.rb
90
+ - lib/erlang/immutable.rb
100
91
  - lib/erlang/list.rb
101
92
  - lib/erlang/map.rb
102
93
  - lib/erlang/nil.rb
103
94
  - lib/erlang/pid.rb
95
+ - lib/erlang/port.rb
96
+ - lib/erlang/reference.rb
104
97
  - lib/erlang/string.rb
98
+ - lib/erlang/term.rb
105
99
  - lib/erlang/terms.rb
106
100
  - lib/erlang/terms/version.rb
101
+ - lib/erlang/trie.rb
107
102
  - lib/erlang/tuple.rb
108
- - spec/erlang/export_spec.rb
109
- - spec/erlang/list_spec.rb
110
- - spec/erlang/map_spec.rb
111
- - spec/erlang/nil_spec.rb
112
- - spec/erlang/pid_spec.rb
113
- - spec/erlang/string_spec.rb
114
- - spec/erlang/terms_spec.rb
115
- - spec/erlang/tuple_spec.rb
116
- - spec/spec_helper.rb
117
- homepage: https://github.com/potatosalad/erlang-terms
103
+ - lib/erlang/undefined.rb
104
+ homepage: https://github.com/potatosalad/ruby-erlang-terms
118
105
  licenses:
119
106
  - MIT
120
107
  metadata: {}
@@ -124,27 +111,18 @@ require_paths:
124
111
  - lib
125
112
  required_ruby_version: !ruby/object:Gem::Requirement
126
113
  requirements:
127
- - - '>='
114
+ - - ">="
128
115
  - !ruby/object:Gem::Version
129
116
  version: '0'
130
117
  required_rubygems_version: !ruby/object:Gem::Requirement
131
118
  requirements:
132
- - - '>='
119
+ - - ">="
133
120
  - !ruby/object:Gem::Version
134
121
  version: '0'
135
122
  requirements: []
136
123
  rubyforge_project:
137
- rubygems_version: 2.2.1
124
+ rubygems_version: 2.6.11
138
125
  signing_key:
139
126
  specification_version: 4
140
127
  summary: Erlang terms represented in Ruby
141
- test_files:
142
- - spec/erlang/export_spec.rb
143
- - spec/erlang/list_spec.rb
144
- - spec/erlang/map_spec.rb
145
- - spec/erlang/nil_spec.rb
146
- - spec/erlang/pid_spec.rb
147
- - spec/erlang/string_spec.rb
148
- - spec/erlang/terms_spec.rb
149
- - spec/erlang/tuple_spec.rb
150
- - spec/spec_helper.rb
128
+ test_files: []
@@ -1,17 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Erlang::Export do
4
- describe '#inspect' do
5
- subject { Erlang::Export.new(:module, :function, 1) }
6
-
7
- it 'formats as #<Erlang::Export fun module:function/arity>' do
8
- expect(subject.inspect).to eq("#<Erlang::Export fun module:function/1>")
9
- end
10
-
11
- it 'compares with other exports' do
12
- expect(subject).to eq(subject)
13
- expect(subject).to eq(Erlang::Export.new('module', 'function', 1))
14
- expect(subject).to_not eq(Erlang::Export.new('module', 'function', 0))
15
- end
16
- end
17
- end
@@ -1,39 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Erlang::List do
4
- describe '#inspect' do
5
- context 'improper list' do
6
- subject { Erlang::List[:a].tail(:b) }
7
-
8
- it { should be_improper }
9
- it 'formats as #<Erlang::List [:a | :b]>' do
10
- expect(subject.inspect).to eq("#<Erlang::List [:a | :b]>")
11
- end
12
- end
13
-
14
- context 'proper list' do
15
- subject { Erlang::List[:a, :b] }
16
-
17
- it { should_not be_improper }
18
- it 'formats as #<Erlang::List [:a, :b | []]>' do
19
- expect(subject.inspect).to eq("#<Erlang::List [:a, :b | []]>")
20
- end
21
- end
22
- end
23
-
24
- it 'has | [] in pretty_inspect' do
25
- expect(Erlang::List[:a].pretty_inspect).to include("| []")
26
- end
27
-
28
- context '#==' do
29
- subject { Erlang::List[:a, :b] }
30
-
31
- it 'compares with other lists' do
32
- expect(subject).to eq(subject)
33
- expect(subject).to eq(Erlang::List[:a, :b])
34
- expect(subject).to_not eq(Erlang::List[:a, :b].tail(:c))
35
- expect(subject).to eq([:a, :b])
36
- expect(Erlang::List[:a].tail(:c)).to_not eq([:a])
37
- end
38
- end
39
- end
@@ -1,24 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Erlang::Map do
4
- describe '#inspect' do
5
- subject { Erlang::Map[:a, 1, "one", 1.0] }
6
-
7
- it 'formats as #<Erlang::Map #{:a=>1, "one"=>1.0}>' do
8
- expect(subject.inspect).to eq('#<Erlang::Map #{:a=>1, "one"=>1.0}>')
9
- end
10
-
11
- it 'has #{} in pretty_inspect' do
12
- expect(Erlang::Map[].pretty_inspect).to include('#{}')
13
- expect(Erlang::Map[Erlang::Map[], 1].pretty_inspect).to include('#{#{} => 1}')
14
- end
15
- end
16
-
17
- describe '#to_s' do
18
- subject { Erlang::Map[:a, 1, "one", 1.0] }
19
-
20
- it 'formats as #{:a=>1, "one"=>1.0}' do
21
- expect(subject.to_s).to eq('#{:a=>1, "one"=>1.0}')
22
- end
23
- end
24
- end
@@ -1,18 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Erlang::Nil do
4
- describe '#inspect' do
5
- subject { Erlang::Nil.new }
6
-
7
- it 'formats as #<Erlang::Nil []>' do
8
- expect(subject.inspect).to eq("#<Erlang::Nil []>")
9
- end
10
-
11
- it 'compares with other nil (and [])' do
12
- expect(subject).to eq(subject)
13
- expect(subject).to eq(Erlang::Nil.new)
14
- expect(subject).to eq([])
15
- expect(subject).to_not eq([:a])
16
- end
17
- end
18
- end
@@ -1,21 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Erlang::Pid do
4
- describe '#inspect' do
5
- subject { Erlang::Pid.new('nonode@nohost', 100, 5, 1) }
6
-
7
- it 'formats as #<Erlang::Pid <0.100.5> @node="nonode@nohost" @creation=1>' do
8
- expect(subject.inspect).to eq('#<Erlang::Pid <0.100.5> @node="nonode@nohost" @creation=1>')
9
- end
10
-
11
- it 'has <0.100.5> in the pretty_inspect' do
12
- expect(subject.pretty_inspect).to include("<0.100.5>")
13
- end
14
-
15
- it 'compares with other pids' do
16
- expect(subject).to eq(subject)
17
- expect(subject).to eq(Erlang::Pid.new(:'nonode@nohost', 100, 5, 1))
18
- expect(subject).to_not eq(Erlang::Pid.new('nonode@nohost', 100, 5, 0))
19
- end
20
- end
21
- end
@@ -1,11 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Erlang::String do
4
- describe '#inspect' do
5
- subject { Erlang::String.new("test") }
6
-
7
- it 'formats as #<Erlang::String "test">' do
8
- expect(subject.inspect).to eq('#<Erlang::String "test">')
9
- end
10
- end
11
- end
@@ -1,7 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Erlang::Terms do
4
- it 'has a version number' do
5
- expect(Erlang::Terms::VERSION).to_not be_nil
6
- end
7
- end
@@ -1,20 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Erlang::Tuple do
4
- describe '#inspect' do
5
- subject { Erlang::Tuple[:a, 1, "one"] }
6
-
7
- it 'formats as #<Erlang::Tuple {:a, 1, "one"}>' do
8
- expect(subject.inspect).to eq('#<Erlang::Tuple {:a, 1, "one"}>')
9
- end
10
-
11
- it 'has {} in pretty_inspect' do
12
- expect(Erlang::Tuple[].pretty_inspect).to include("{}")
13
- expect(Erlang::Tuple[Erlang::Tuple[]].pretty_inspect).to include("{{}}")
14
- end
15
-
16
- it 'arity equals length' do
17
- expect(subject.arity).to eq(subject.length)
18
- end
19
- end
20
- end
@@ -1,7 +0,0 @@
1
- if ENV["COVERAGE"]
2
- require 'simplecov'
3
- SimpleCov.start
4
- end
5
-
6
- $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
7
- require 'erlang/terms'