mementus 0.1.4 → 0.1.5

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZjI1MGJjNDU2MzUzMTM4ZDliYTFhYWJiODdmOTdmOWIzOThhNTUzZA==
4
+ MWI0NjU5MGU1MTEyMzgzYTk4MDUxZmUxNzczNGU5MDNjZDI2YjkyYg==
5
5
  data.tar.gz: !binary |-
6
- N2UyODk0M2JkOGYzOThkNzY2NDM4OWIyNTAyOTI5ZDE3MTY5M2QyZQ==
6
+ Nzg5MjNkYTgzMjE2MjI0MmQ2YTZmN2UwZTQ0MzJiNWQ3MGI3MDI0ZQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- Y2VjZGFlYTUwM2EyOGU1OGY3ZjdhNjgwZGUyMTBlZGUwZDhjN2IwZjNiZTNl
10
- Nzk2ZGRmODE0ZDZmODFkMjQyNjE5ZDA3ZjlhMzEyNmFkNzY3MjQ3YzAzMTg5
11
- ZjJmYzVmNjViY2FhOGVkMmVhYTIzNzlhM2I4YmNjNGQxY2E4ZDI=
9
+ YmY5MDFkOTRkMWE5YzQ2NWUwZWFkZTA2MzM0YzY4MWU3ODNkYzk4N2UzODY2
10
+ OTMxNDYxY2NmZTBmNjBhMzI3ZjBiMDc0ZTg5MTc0ZGE0YmM4ODYwYzQ1NWRh
11
+ MDg2NTIxMTQzYjdmYWE5ZDUwYTg0Mzk2NzhlYTdjODBhZTRiOTY=
12
12
  data.tar.gz: !binary |-
13
- NzMxZDhhOGY3MWY5NTFjMWM2ZjJjMTkxNjA0ZWM2ZDhlZjQyZjUxNmE3NjYx
14
- MTA2ZDUxMzYwNWQ0MWU4NjcxN2Y4ODY0MGQyNjdiNjRhYmNmM2Q0YjRhMzY0
15
- Nzg1MmZmMjBjM2E3ZDAyOTIxM2ZmZTZmMDM5M2RjM2ZkNmI2MGM=
13
+ NDFkMDkzNjY4MTI4OGQ0NTU3NTcwMDE1M2YyNDRjM2EzY2UzZTVmNDY4NTIx
14
+ ZGFkN2RjNjEyMjM1MzMxYjhiNDZhY2VjNmRlMmZjYmYwNWEzOTExYWNmMWEw
15
+ YzU2OGQyZDMxNGJjYzhjNzg5OTY2YjBlZGI2MDVlNWM2ZWQ2YTQ=
@@ -0,0 +1,10 @@
1
+ module Axiom
2
+ module Adapter
3
+ class Memory
4
+ # Patch for missing hash check in Axiom memory adapter
5
+ def has_key?(key)
6
+ schema.has_key?(key)
7
+ end
8
+ end
9
+ end
10
+ end
@@ -82,7 +82,11 @@ module Mementus
82
82
  end
83
83
 
84
84
  def self.collection
85
- @@local_storage[name_to_sym]
85
+ if @@local_storage.has_key?(name_to_sym)
86
+ @@local_storage[name_to_sym]
87
+ else
88
+ Axiom::Relation.new(self.new.schema_tuple)
89
+ end
86
90
  end
87
91
 
88
92
  # TODO: fix incomplete scope chaining
@@ -1,3 +1,3 @@
1
1
  module Mementus
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
data/lib/mementus.rb CHANGED
@@ -2,6 +2,6 @@ require 'virtus'
2
2
  require 'axiom-memory-adapter'
3
3
 
4
4
  require_relative 'mementus/version'
5
+ require_relative 'mementus/adapter'
5
6
  require_relative 'mementus/relation'
6
7
  require_relative 'mementus/model'
7
-
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ describe Mementus::Model do
4
+
5
+ describe "Empty" do
6
+
7
+ class EmptyItem < Mementus::Model
8
+ attribute :id, String
9
+ end
10
+
11
+ it "returns an empty collection when no items found" do
12
+ expect(EmptyItem.all).to be_instance_of(Array)
13
+ expect(EmptyItem.all.count).to eq 0
14
+ end
15
+
16
+ end
17
+
18
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mementus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - maetl
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-10 00:00:00.000000000 Z
11
+ date: 2014-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: virtus
@@ -94,12 +94,14 @@ files:
94
94
  - README.md
95
95
  - Rakefile
96
96
  - lib/mementus.rb
97
+ - lib/mementus/adapter.rb
97
98
  - lib/mementus/model.rb
98
99
  - lib/mementus/relation.rb
99
100
  - lib/mementus/version.rb
100
101
  - mementus.gemspec
101
102
  - spec/attribute_spec.rb
102
103
  - spec/collection_spec.rb
104
+ - spec/empty_spec.rb
103
105
  - spec/mapping_spec.rb
104
106
  - spec/scopes_spec.rb
105
107
  - spec/spec_helper.rb
@@ -130,6 +132,7 @@ summary: In-memory data model
130
132
  test_files:
131
133
  - spec/attribute_spec.rb
132
134
  - spec/collection_spec.rb
135
+ - spec/empty_spec.rb
133
136
  - spec/mapping_spec.rb
134
137
  - spec/scopes_spec.rb
135
138
  - spec/spec_helper.rb