erlang-terms 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: bd479ee089887c3af964c5fc23c5ef4d1bec8072
4
+ data.tar.gz: 05cea00a4d7663b1ab9e80114fa8404acd891471
5
+ SHA512:
6
+ metadata.gz: 5b2e3165e979b23f2fcf83e1018c3ddc306967a0f5634146a1476ee94e0ba2af9854b1c5778aa09dccd3c0ec369281dd0034374c48493dfe31d32adcfd92403e
7
+ data.tar.gz: ca3941286ddadff6b183a027f81690cad2c041d07d4e760f08ffa1cc3eeb1b2b6e018a153c5ec439fca653f37ca2807ddc17aa0715a89842d4a74b96fea94934
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .rvmrc
6
+ .yardoc
7
+ Gemfile.lock
8
+ InstalledFiles
9
+ _yardoc
10
+ coverage
11
+ doc/
12
+ lib/bundler/man
13
+ pkg
14
+ rdoc
15
+ spec/reports
16
+ test/tmp
17
+ test/version_tmp
18
+ tmp
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in erlang-terms.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Andrew Bennett
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Erlang::Terms
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'erlang-terms'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install erlang-terms
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => [:spec]
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'erlang/terms/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "erlang-terms"
8
+ spec.version = Erlang::Terms::VERSION
9
+ spec.authors = ["Andrew Bennett"]
10
+ spec.email = ["andrew@pagodabox.com"]
11
+ spec.description = %q{Includes simple classes that represent Erlang's export, list, pid, string, and tuple.}
12
+ spec.summary = %q{Erlang terms represented in Ruby}
13
+ spec.homepage = "https://github.com/potatosalad/erlang-terms"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "pry"
23
+ spec.add_development_dependency "rake"
24
+ spec.add_development_dependency "rspec"
25
+ spec.add_development_dependency "simplecov"
26
+ end
@@ -0,0 +1,16 @@
1
+ module Erlang
2
+ class Export
3
+ attr_accessor :mod, :function, :arity
4
+
5
+ def initialize(mod, function, arity)
6
+ self.mod = mod
7
+ self.function = function
8
+ self.arity = arity
9
+ end
10
+
11
+ # @return [String] the nicely formatted version of the message
12
+ def inspect
13
+ "#<#{self.class.name} fun #{mod}:#{function}/#{arity}>"
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,21 @@
1
+ module Erlang
2
+ class List < ::Array
3
+ attr_writer :tail
4
+
5
+ def improper?
6
+ tail != []
7
+ end
8
+
9
+ def tail
10
+ @tail ||= []
11
+ end
12
+
13
+ def inspect
14
+ "#<#{self.class.name} #{super[0..-2]} | #{tail.inspect}]>"
15
+ end
16
+
17
+ def pretty_inspect
18
+ "#<#{self.class.name} #{super[0..-3]} | #{tail.inspect}]>\n"
19
+ end
20
+ end
21
+ end
data/lib/erlang/pid.rb ADDED
@@ -0,0 +1,23 @@
1
+ module Erlang
2
+ class Pid
3
+ attr_accessor :node, :id, :serial, :creation
4
+
5
+ def initialize(node, id, serial = 0, creation = 0)
6
+ self.node = node
7
+ self.id = id
8
+ self.serial = serial
9
+ self.creation = creation
10
+ end
11
+
12
+ # @return [String] the nicely formatted version of the message
13
+ def inspect
14
+ "#<#{self.class.name} <0.#{id}.#{serial}> @node=#{node.inspect} @creation=#{creation.inspect}>"
15
+ end
16
+
17
+ def pretty_inspect
18
+ "#<#{self.class.name} <0.#{id}.#{serial}>\n" <<
19
+ " @node=#{node.inspect}\n" <<
20
+ " @creation=#{creation.inspect}>"
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,7 @@
1
+ module Erlang
2
+ class String < ::String
3
+ def inspect
4
+ "#<#{self.class.name} #{super}>"
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,12 @@
1
+ require "erlang/terms/version"
2
+
3
+ module Erlang
4
+ module Terms
5
+ end
6
+ end
7
+
8
+ require "erlang/export"
9
+ require "erlang/list"
10
+ require "erlang/pid"
11
+ require "erlang/string"
12
+ require "erlang/tuple"
@@ -0,0 +1,5 @@
1
+ module Erlang
2
+ module Terms
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,11 @@
1
+ module Erlang
2
+ class Tuple < ::Array
3
+ def inspect
4
+ "#<#{self.class.name} {#{super[1..-2]}}>"
5
+ end
6
+
7
+ def pretty_inspect
8
+ "#<#{self.class.name} {#{super[1..-3]}}>\n"
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
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
+ end
11
+ end
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+
3
+ describe Erlang::List do
4
+ describe '#inspect' do
5
+ context 'improper list' do
6
+ subject { Erlang::List[:a].tap { |list| list.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
+ end
@@ -0,0 +1,11 @@
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
+ end
11
+ end
@@ -0,0 +1,11 @@
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
@@ -0,0 +1,7 @@
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
@@ -0,0 +1,11 @@
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
+ end
11
+ end
@@ -0,0 +1,7 @@
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'
metadata ADDED
@@ -0,0 +1,144 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: erlang-terms
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Andrew Bennett
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-03-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
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'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ 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
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: simplecov
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: Includes simple classes that represent Erlang's export, list, pid, string,
84
+ and tuple.
85
+ email:
86
+ - andrew@pagodabox.com
87
+ executables: []
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - .gitignore
92
+ - .rspec
93
+ - .travis.yml
94
+ - Gemfile
95
+ - LICENSE.txt
96
+ - README.md
97
+ - Rakefile
98
+ - erlang-terms.gemspec
99
+ - lib/erlang/export.rb
100
+ - lib/erlang/list.rb
101
+ - lib/erlang/pid.rb
102
+ - lib/erlang/string.rb
103
+ - lib/erlang/terms.rb
104
+ - lib/erlang/terms/version.rb
105
+ - lib/erlang/tuple.rb
106
+ - spec/erlang/export_spec.rb
107
+ - spec/erlang/list_spec.rb
108
+ - spec/erlang/pid_spec.rb
109
+ - spec/erlang/string_spec.rb
110
+ - spec/erlang/terms_spec.rb
111
+ - spec/erlang/tuple_spec.rb
112
+ - spec/spec_helper.rb
113
+ homepage: https://github.com/potatosalad/erlang-terms
114
+ licenses:
115
+ - MIT
116
+ metadata: {}
117
+ post_install_message:
118
+ rdoc_options: []
119
+ require_paths:
120
+ - lib
121
+ required_ruby_version: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ required_rubygems_version: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - '>='
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
131
+ requirements: []
132
+ rubyforge_project:
133
+ rubygems_version: 2.0.2
134
+ signing_key:
135
+ specification_version: 4
136
+ summary: Erlang terms represented in Ruby
137
+ test_files:
138
+ - spec/erlang/export_spec.rb
139
+ - spec/erlang/list_spec.rb
140
+ - spec/erlang/pid_spec.rb
141
+ - spec/erlang/string_spec.rb
142
+ - spec/erlang/terms_spec.rb
143
+ - spec/erlang/tuple_spec.rb
144
+ - spec/spec_helper.rb