linda 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: 70d0f9c426b9d5b9aaf4105883f9a5e63a1aecb1
4
- data.tar.gz: a4ff1571d734b2c0d7064edb2c7475a9b7c41584
3
+ metadata.gz: e0d21f85711ad7ff91ac04e9e2a19511f50aa523
4
+ data.tar.gz: 24c7df040039b124cc46b7ad3366d119138c01e3
5
5
  SHA512:
6
- metadata.gz: c24929e587bd7a72822e61d1ddf01d38a7a9194f2b542041d9231fa69a3a82e1e9fec84988d0199a134bc3b50efa08561cebda2b57facd07ac6dae8301118df4
7
- data.tar.gz: b7b1248e760c20aff1fa7736ba205d6f345848d8585066dc999d4d5d15628908ce8320179226a9709fd136dd2bae1656be3470f92519b32032936290671bddc1
6
+ metadata.gz: 246eace4880e3e1f1ab4a56dba6669bc94ea681fd868b6276b4e33a96e1ac4d7cc43ed99eeffd2841ab0bc372ee5f6d5181dc217d125988f1f7606c36e071ccf
7
+ data.tar.gz: 5f18ac034f70d406bfa4814cafac4766962a84aed30aa55ad10ea0eccbc9364152ea0caf8f73e7fcc82b6ffc9f303564cb615ff9cb904b8f0b2e0cb5db16cc6c
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ === 0.0.3 2013-05-20
2
+
3
+ * add tests
4
+ * Tuple#to_json
5
+
1
6
  === 0.0.2 2013-05-19
2
7
 
3
8
  * provide tests
@@ -2,6 +2,20 @@ module Linda
2
2
  module Test
3
3
  module Tuple
4
4
 
5
+ def test_array_tuple
6
+ tuple = target_tuple.new([1,2,:a])
7
+ assert_equal tuple.data, [1,2,:a]
8
+ assert_equal tuple.type, Array
9
+ assert_equal JSON.parse(tuple.to_json), [1,2,"a"]
10
+ end
11
+
12
+ def test_hash_tuple
13
+ tuple = target_tuple.new(:a => 1, :b => 2)
14
+ assert_equal tuple.data, {:a => 1, :b => 2}
15
+ assert_equal tuple.type, Hash
16
+ assert_equal JSON.parse(tuple.to_json), {"a" => 1, "b" => 2}
17
+ end
18
+
5
19
  def test_match_array_tuple
6
20
  tuple = target_tuple.new [1,2,3]
7
21
  assert tuple.match? target_tuple.new [1,2,3]
@@ -6,6 +6,20 @@ module Linda
6
6
  @space = target_tuplespace.new
7
7
  end
8
8
 
9
+ def test_name
10
+ assert_equal @space.name, "__default__"
11
+ assert_equal target_tuplespace.new("foo").name, "foo"
12
+ end
13
+
14
+ def test_tuples
15
+ @space.write [1]
16
+ @space.write [1,2]
17
+ @space.write :a => 10, :b => 20
18
+ @space.write [1,2,"a"]
19
+ assert_equal @space.size, 4
20
+ assert_equal @space.tuples.size, 4
21
+ end
22
+
9
23
  def test_write_read
10
24
  assert_equal @space.size, 0
11
25
  @space.write target_tuple.new [1,2,3]
data/lib/linda/tuple.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require "json"
2
+
1
3
  module Linda
2
4
 
3
5
  class Tuple
@@ -34,6 +36,11 @@ module Linda
34
36
  def to_s
35
37
  @data.to_s
36
38
  end
39
+
40
+ def to_json(*a)
41
+ @data.to_json(*a)
42
+ end
43
+
37
44
  end
38
45
 
39
46
  end
@@ -2,7 +2,7 @@ module Linda
2
2
 
3
3
  class TupleSpace
4
4
  include Enumerable
5
- attr_reader :name
5
+ attr_reader :name, :tuples
6
6
 
7
7
  def initialize(name="__default__")
8
8
  @name = name
data/lib/linda/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Linda
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/linda.gemspec CHANGED
@@ -18,6 +18,8 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
+ spec.add_dependency "json"
22
+
21
23
  spec.add_development_dependency "bundler", "~> 1.3"
22
24
  spec.add_development_dependency "rake"
23
25
  spec.add_development_dependency "minitest"
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: linda
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
  - Sho Hashimoto
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-18 00:00:00.000000000 Z
11
+ date: 2013-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: json
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: bundler
15
29
  requirement: !ruby/object:Gem::Requirement