active_pstore 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ce4d5fd7b68f1d584089e97ec4def1991c31bc0b
4
- data.tar.gz: 35d4299645636ba48b0ee2201eed2c531ca69e1c
3
+ metadata.gz: 125870653562bd257a502f6750c4e2bb792e6b0a
4
+ data.tar.gz: 25311665810359fc3c960c5a7f6818baca48532d
5
5
  SHA512:
6
- metadata.gz: 96b1291e03675054463557a341f2b41ad8318c91973538e3cea7392ac1bc89d523156f6d00b7588a55814d3875e0630b91116920a29d6d4408fa1c51974430dd
7
- data.tar.gz: 1462643017e90750bab55d9cd0a5dd8d4b4e2037b3653dc4505e44a2415bc5858a8eedffff66b60fa662654113ddee50962fc3ddc460dc77d98355ba1546abb1
6
+ metadata.gz: 63d9efc14e56ae15d00e1411983e8326dd1d1d7dac5dae82bb0f894af443e7a6333993e00c03e44f0bab9e8afd8968d9a39e78b3af7c8238a49f67c2b261b902
7
+ data.tar.gz: 398cd85df1d2d39e4f7e65c122c2d6a0784df3ba5f79da8a03132db9e797a8ffa6bd717cc5511f5c64b4c556030897322a95fed2a9aae9069ccbf1c517c21c38
data/README.ja.md CHANGED
@@ -1,19 +1,21 @@
1
- # Active PStore [Active Record](https://github.com/rails/rails/tree/master/activerecord)に似たインターフェイスを持ったライブラリです。
1
+ # Active PStore [![Build Status](https://travis-ci.org/koic/active_pstore.svg)](https://travis-ci.org/koic/active_pstore) [![Code Climate](https://codeclimate.com/github/koic/active_pstore/badges/gpa.svg)](https://codeclimate.com/github/koic/active_pstore) [![Test Coverage](https://codeclimate.com/github/koic/active_pstore/badges/coverage.svg)](https://codeclimate.com/github/koic/active_pstore/coverage) [![Gem Version](https://badge.fury.io/rb/active_pstore.svg)](http://badge.fury.io/rb/active_pstore)
2
+
3
+ [Active Record](https://github.com/rails/rails/tree/master/activerecord)に似たインターフェイスを持ったライブラリです。
2
4
  データの保存には[pstore](http://docs.ruby-lang.org/ja/2.2.0/library/pstore.html)を使います。
3
5
 
4
6
  ## FEATURES/PROBLEMS
5
7
 
6
8
  * それなりに問題を持っています
7
- * トランザクションをサポートしてません
9
+ * トランザクションをサポートしてません (PStoreサポートレベルまで少しなんとかしたい)
8
10
  * データマイグレーションをサポートしてません
9
- * パフォーマンス (特に実装面とか)
11
+ * パフォーマンスへはかなりアマい実装になっています (いずれもう少しなんとかしたい)
10
12
  * これらのことからエンタープライズ要件には向かないです
11
13
 
12
14
  ## SYNOPSIS
13
15
 
14
16
  ### クラス定義とインスタンスの生成
15
17
 
16
- ```
18
+ ```ruby
17
19
  require 'active_pstore'
18
20
 
19
21
  class Artist < ActivePStore::Base
@@ -29,26 +31,26 @@ randy_rhoads = Artist.new('Randy Rhoads')
29
31
 
30
32
  ### データの保存先のファイルパス指定
31
33
 
32
- ```
34
+ ```ruby
33
35
  Artist.establish_connection(database: '/path/to/file')
34
36
  ```
35
37
 
36
38
  ### インスタンスの保存
37
39
 
38
- ```
40
+ ```ruby
39
41
  randy_rhoads.save
40
42
  ```
41
43
 
42
44
  saveメソッドの対象オブジェクトのクラス名がPStoreのキーになります。
43
45
 
44
- ```
46
+ ```ruby
45
47
  database = PStore.new('/path/to/file')
46
48
  database.transaction {|db| artist = db['Artist'] } # fetch instances of Artist class.
47
49
  ```
48
50
 
49
51
  保存時に[SecureRandom.hex](http://docs.ruby-lang.org/ja/2.2.0/class/SecureRandom.html#S_HEX)の値を使ったActivePStore::Base#idが付与されます。
50
52
 
51
- ```
53
+ ```ruby
52
54
  > randy_rhoads.id # => nil
53
55
  > randy_rhoads.save
54
56
  > randy_rhoads.id # => "0b84ece5d5be3bce3ee2101c1c4f6fda"
@@ -56,7 +58,7 @@ database.transaction {|db| artist = db['Artist'] } # fetch instances of Artist c
56
58
 
57
59
  ### 検索系
58
60
 
59
- ```
61
+ ```ruby
60
62
  Artist.all
61
63
  Artist.first
62
64
  Artist.last
@@ -66,7 +68,7 @@ Artist.where(name: 'Randy Rhoads')
66
68
 
67
69
  範囲指定
68
70
 
69
- ```
71
+ ```ruby
70
72
  Artist.where(birth_date: Date.new(1948, 12, 3)..Date.new(1956, 12, 6))
71
73
  ```
72
74
 
data/README.md CHANGED
@@ -1,11 +1,11 @@
1
- # Active PStore [![Build Status](https://travis-ci.org/koic/active-pstore.svg)](https://travis-ci.org/koic/active-pstore) [![Code Climate](https://codeclimate.com/github/koic/active-pstore/badges/gpa.svg)](https://codeclimate.com/github/koic/active-pstore) [![Test Coverage](https://codeclimate.com/github/koic/active-pstore/badges/coverage.svg)](https://codeclimate.com/github/koic/active-pstore/coverage) [![Gem Version](https://badge.fury.io/rb/active_pstore.svg)](http://badge.fury.io/rb/active_pstore)
1
+ # Active PStore [![Build Status](https://travis-ci.org/koic/active_pstore.svg)](https://travis-ci.org/koic/active_pstore) [![Code Climate](https://codeclimate.com/github/koic/active_pstore/badges/gpa.svg)](https://codeclimate.com/github/koic/active_pstore) [![Test Coverage](https://codeclimate.com/github/koic/active_pstore/badges/coverage.svg)](https://codeclimate.com/github/koic/active_pstore/coverage) [![Gem Version](https://badge.fury.io/rb/active_pstore.svg)](http://badge.fury.io/rb/active_pstore)
2
2
 
3
3
  This library has [Active Record](https://github.com/rails/rails/tree/master/activerecord) like interface. Use [pstore](http://docs.ruby-lang.org/en/2.2.0/PStore.html) to store data.
4
4
 
5
5
  ## FEATURES/PROBLEMS
6
6
 
7
7
  * Oh so many problems...
8
- * Transaction NOT supported
8
+ * Transaction NOT supported (caused by implementation)
9
9
  * Data Migration NOT supported
10
10
  * Performance (caused by implementation)
11
11
  * and Not solving the root cause for enterprise...
@@ -14,7 +14,7 @@ This library has [Active Record](https://github.com/rails/rails/tree/master/acti
14
14
 
15
15
  ### class definition and instantiate
16
16
 
17
- ```
17
+ ```ruby
18
18
  require 'active_pstore'
19
19
 
20
20
  class Artist < ActivePStore::Base
@@ -30,26 +30,26 @@ randy_rhoads = Artist.new('Randy Rhoads')
30
30
 
31
31
  ### specify data store path
32
32
 
33
- ```
33
+ ```ruby
34
34
  Artist.establish_connection(database: '/path/to/file')
35
35
  ```
36
36
 
37
37
  ### save
38
38
 
39
- ```
39
+ ```ruby
40
40
  randy_rhoads.save
41
41
  ```
42
42
 
43
43
  database key is string of class name.
44
44
 
45
- ```
45
+ ```ruby
46
46
  database = PStore.new('/path/to/file')
47
47
  database.transaction {|db| artist = db['Artist'] } # fetch instances of Artist class.
48
48
  ```
49
49
 
50
50
  allocate value of ActivePStore::Base#id using [SecureRandom.hex](http://ruby-doc.org/stdlib-2.2.0/libdoc/securerandom//rdoc/SecureRandom.html#method-c-hex).
51
51
 
52
- ```
52
+ ```ruby
53
53
  > foo.id # => nil
54
54
  > randy_rhoads.save
55
55
  > foo.id # => "0b84ece5d5be3bce3ee2101c1c4f6fda"
@@ -57,7 +57,7 @@ allocate value of ActivePStore::Base#id using [SecureRandom.hex](http://ruby-doc
57
57
 
58
58
  ### find series
59
59
 
60
- ```
60
+ ```ruby
61
61
  Artist.all
62
62
  Artist.first
63
63
  Artist.last
@@ -67,7 +67,7 @@ Artist.where(name: 'Randy Rhoads')
67
67
 
68
68
  Range
69
69
 
70
- ```
70
+ ```ruby
71
71
  Artist.where(birth_date: Date.new(1948, 12, 3)..Date.new(1956, 12, 6))
72
72
  ```
73
73
 
@@ -29,5 +29,18 @@ module ActivePStore
29
29
  def method_missing(method_name, *args, &block)
30
30
  @objects.__send__(method_name, *args, &block)
31
31
  end
32
+
33
+ def ==(comparison_object)
34
+ comparison_object.instance_of?(self.class) && self.map(&:id) <=> comparison_object.map(&:id)
35
+ end
36
+ alias :eql? :==
37
+
38
+ def hash
39
+ if id
40
+ id.hash
41
+ else
42
+ super
43
+ end
44
+ end
32
45
  end
33
46
  end
@@ -1,3 +1,3 @@
1
1
  module ActivePStore
2
- VERSION = '0.4.0'
2
+ VERSION = '0.4.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_pstore
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Koichi ITO
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-02 00:00:00.000000000 Z
11
+ date: 2015-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: codeclimate-test-reporter
@@ -80,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
80
  version: '0'
81
81
  requirements: []
82
82
  rubyforge_project:
83
- rubygems_version: 2.4.5
83
+ rubygems_version: 2.4.8
84
84
  signing_key:
85
85
  specification_version: 4
86
86
  summary: This library has Active Record like interface. Use pstore to store data.