ephemeral 2.3.3 → 2.4.0
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 +4 -4
- data/README.md +1 -1
- data/VERSION +1 -1
- data/ephemeral.gemspec +3 -3
- data/lib/ephemeral/collection.rb +5 -1
- data/spec/ephemeral_spec.rb +6 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ee2d1a6c5446b1241afe7cbccf877bd23a582f5
|
4
|
+
data.tar.gz: 26442e8ca8be978f4c372854c78426b6f7010e2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6cb29ee257320f027766f2f822b557c8d32d17b0d77de4b60184a286eb428fc001389b7d7f966b11ab4f3192cf9cbe7f46a5bae3dd5aa7c34f6e32f464616e64
|
7
|
+
data.tar.gz: fbcb8ba2b373d2363894d9a7f1b8b966798295f4c8b52d4454991f82994c45356c8782b8386ed879e45e3785b2e41bf5d6947f29b2e55c5a87b0abc69351ebe7
|
data/README.md
CHANGED
@@ -53,7 +53,7 @@ Now we can filter inventions on the consumer side:
|
|
53
53
|
|
54
54
|
period = Period.where(:name => 'Early Years')
|
55
55
|
inventions = period.inventions.mechanical
|
56
|
-
favorite = inventions.
|
56
|
+
favorite = inventions.find(:name => 'Doomsday Device')
|
57
57
|
|
58
58
|
More Examples?
|
59
59
|
==============
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.4.0
|
data/ephemeral.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: ephemeral 2.
|
5
|
+
# stub: ephemeral 2.4.0 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "ephemeral"
|
9
|
-
s.version = "2.
|
9
|
+
s.version = "2.4.0"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Corey Ehmke"]
|
14
|
-
s.date = "2014-
|
14
|
+
s.date = "2014-10-28"
|
15
15
|
s.description = "Ephemeral lets you define one-to-many relationships between in-memory objects, with ORM-like support for where clauses and chainable scopes."
|
16
16
|
s.email = "corey@idolhands.com"
|
17
17
|
s.extra_rdoc_files = [
|
data/lib/ephemeral/collection.rb
CHANGED
@@ -32,6 +32,10 @@ module Ephemeral
|
|
32
32
|
Ephemeral::Collection.new(self.klass, results)
|
33
33
|
end
|
34
34
|
|
35
|
+
def find(args={})
|
36
|
+
where(args).first
|
37
|
+
end
|
38
|
+
|
35
39
|
def last
|
36
40
|
self.objects.last
|
37
41
|
end
|
@@ -64,7 +68,7 @@ module Ephemeral
|
|
64
68
|
def attach_scopes
|
65
69
|
eval(self.klass).scopes.each do |k, v|
|
66
70
|
if v.is_a?(Proc)
|
67
|
-
define_singleton_method(k, v)
|
71
|
+
define_singleton_method(k, v)
|
68
72
|
else
|
69
73
|
define_singleton_method k, lambda { self.execute_scope(k)}
|
70
74
|
end
|
data/spec/ephemeral_spec.rb
CHANGED
@@ -119,8 +119,8 @@ describe Ephemeral do
|
|
119
119
|
collector = Collector.new(
|
120
120
|
:name => 'from_api',
|
121
121
|
'rarities' => [
|
122
|
-
{
|
123
|
-
{
|
122
|
+
{name: 'foo'},
|
123
|
+
{name: 'bar'}
|
124
124
|
]
|
125
125
|
)
|
126
126
|
collector.rarities.count.should == 2
|
@@ -133,6 +133,10 @@ describe Ephemeral do
|
|
133
133
|
@collector.antiques.where(:name => 'Trading Cards').should_not be_blank
|
134
134
|
end
|
135
135
|
|
136
|
+
it 'performs a find' do
|
137
|
+
@collector.rarities.where(name: 'Paychecks').first.name.should eq "Paychecks"
|
138
|
+
end
|
139
|
+
|
136
140
|
describe 'scope method' do
|
137
141
|
|
138
142
|
it 'executes a scope' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ephemeral
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Corey Ehmke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|