null_object_associations 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: 42ed17ebcb3c8119a15a3227ab0acdbd53746279
4
- data.tar.gz: 8dd023dfe401178588dffc056bec59c9dcbfb49f
3
+ metadata.gz: ec54733cb9a19b534fc4e4e1367225b47efb8b0c
4
+ data.tar.gz: 428d02802a7b92e6b05d2c9bd2ac92baf3a4b04e
5
5
  SHA512:
6
- metadata.gz: 9aaf5d16541f12a758d2d36fa1f7ffcd446401e1e399554c90804a3ed73919dd678828b7ccfafdbefe9b3334b6c141f8d6feab463ac8c03c10314c9d4a840c4b
7
- data.tar.gz: 84392edd48d1884ad0e8dbd2651403326d1f0789d3e289039678524ca7d9e1ced2da8e19b43391cc75d6f85d40cba560a6f89382a382bfb15b655f5b979400b8
6
+ metadata.gz: 006600669387070cb0e165d96dd8095495f3a41c2b5ed1d3ec9e5eb95ca84689b2650024fa59c14f736df66ed3be188161c09f5fa525b1f2ff5bd38b68f16a27
7
+ data.tar.gz: 11ca8d6c59624e178102cb0acc4ebd0ad9caa62c797029f5de9e2e8ad4ad89a5f44f1f47832a585ec245c7988dcc00d6337909a1834915783ffa53565e01944e
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # NullObjectAssociations
2
2
 
3
- TODO: Write a gem description
3
+ Return empty arrays or nil for associations. A nice little addition to null objects. Especially nice for those used in Rails.
4
4
 
5
5
  ## Installation
6
6
 
@@ -20,7 +20,19 @@ Or install it yourself as:
20
20
 
21
21
  ## Usage
22
22
 
23
- TODO: Write usage instructions here
23
+ ```
24
+ class NullUser
25
+ include NullObjectAssociations
26
+
27
+ has_many :friends
28
+ has_many :cousins, respond_to: [:pluck, :completed]
29
+ has_many :cars, respond_to: :any
30
+ has_and_belongs_to_many :accounts, respond_to: [:pluck, :completed]
31
+ has_one :house
32
+ belongs_to :spouse
33
+ end
34
+ ```
35
+
24
36
 
25
37
  ## Contributing
26
38
 
@@ -1,3 +1,3 @@
1
1
  module NullObjectAssociations
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -43,9 +43,9 @@ module NullObjectAssociations
43
43
  def build_associations(actions)
44
44
  empty_array = []
45
45
 
46
- empty_array.tap do |a|
46
+ empty_array.tap do |empty_arr|
47
47
  actions.each do |action|
48
- empty_array.define_singleton_method(action) do
48
+ empty_arr.define_singleton_method(action) do
49
49
  []
50
50
  end
51
51
  end
@@ -9,6 +9,7 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["Karmen Blake"]
10
10
  spec.email = ["dudeblake@gmail.com"]
11
11
  spec.summary = %q{Handle associations in your null objects.}
12
+ spec.description = %q{Return empty arrays or nil for associations.}
12
13
  spec.homepage = "https://github.com/kblake/null_object_associations"
13
14
  spec.license = "MIT"
14
15
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: null_object_associations
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
  - Karmen Blake
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-15 00:00:00.000000000 Z
11
+ date: 2015-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -38,7 +38,7 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
- description:
41
+ description: Return empty arrays or nil for associations.
42
42
  email:
43
43
  - dudeblake@gmail.com
44
44
  executables: []