ephemeral 2.3.3 → 2.4.0

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: 9a3bce2dc6d4288da899c3fa37f6b920df46c9db
4
- data.tar.gz: 335a48eb5678c0870b66ff4509343996d9174e55
3
+ metadata.gz: 1ee2d1a6c5446b1241afe7cbccf877bd23a582f5
4
+ data.tar.gz: 26442e8ca8be978f4c372854c78426b6f7010e2a
5
5
  SHA512:
6
- metadata.gz: f3e15a40eb7749518cefbb6459a901ffe0ca370f9384dfa18743fec003b8bb97597bbaa08cc6ac2aadb6706bf726cbe05bb6526cc203977fefb4d05fbee89f4d
7
- data.tar.gz: b3b965c2325c0fe40b38d00c280392d011465fee4e2d4c1e27c6274429c0a76411bc7a66aa494741aa53de257bad2cd716a474424a251e70528d5d75a4029d4c
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.where(:name => 'Doomsday Device')
56
+ favorite = inventions.find(:name => 'Doomsday Device')
57
57
 
58
58
  More Examples?
59
59
  ==============
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.3.3
1
+ 2.4.0
@@ -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.3.3 ruby lib
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.3.3"
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-07-19"
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 = [
@@ -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
@@ -119,8 +119,8 @@ describe Ephemeral do
119
119
  collector = Collector.new(
120
120
  :name => 'from_api',
121
121
  'rarities' => [
122
- {'name' => 'foo'},
123
- {'name' => 'bar'}
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.3.3
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-07-19 00:00:00.000000000 Z
11
+ date: 2014-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport