compo 0.1.0 → 0.1.1

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: 13ca1304045a3fb0ac403495a4c838b53aeecb65
4
- data.tar.gz: 06039743fc1c5f084a2906d548ecf322b8a12aaf
3
+ metadata.gz: 914e22d4c5fb780ddfb95a6b71ecabf0046200b1
4
+ data.tar.gz: 91fa7096c61860f8aa06b7d773a3c8a490ac1cb6
5
5
  SHA512:
6
- metadata.gz: 6de424684aa210f5f48c2d422dee5e44310ccacf6f2623d180c0f2934fa55ee7191b7a479b56badd9220ef1c0ee2dcb907d3df69e3f5063ea4079e2e8448a823
7
- data.tar.gz: 6fd54c3de144b876874596fcc446e9b6a4f922f0c89fbaf4d2f6f423bc98d7f3fc10c58bc4d01fcc6d2a2d9d3a7c4beb1d7936684780965fe0ae6b9b389ea167
6
+ metadata.gz: b6477ff141c788b2889b06c7674bb0ffcb157880f739e7ab0532a866e917fe4df56c19dffb8794b69caaffb1f011ff463326435460334a95c58813cdea3d2c4c
7
+ data.tar.gz: 42527748f975f4e21bfbf8ca7b3b8cc46cda5304eaf586bd5ea37961c0ff9d998cec64641c8f3e82611248626796fdb1b7a352afb95e2037b459b04e7599e263
data/CHANGELOG CHANGED
@@ -1,2 +1,7 @@
1
+ 0.1.1 (2013-12-27)
2
+ - Avoid a function name clash between #remove_parent on a child and
3
+ #remove_parent on a parent. The latter is now #remove_parent_of.
4
+ #assign_parent is now #assign_parent_to, to match.
5
+
1
6
  0.1.0 (2013-12-26)
2
7
  - Initial version.
data/README.md CHANGED
@@ -1,6 +1,14 @@
1
1
  # Compo
2
2
 
3
- TODO: Write a gem description
3
+ **Compo** is a library providing mixins and base classes for setting up
4
+ composite objects.
5
+
6
+ It implements something similar to the Gang of Four Composite pattern, but with
7
+ the difference that children are identified in their parents by an *ID*,
8
+ such as the index or hash key, that the child is aware of at all times.
9
+
10
+ Compo was designed for the purpose of creating models whose natural composite
11
+ structure can be expressed as URLs made from their recursive ID trails.
4
12
 
5
13
  ## Installation
6
14
 
@@ -34,7 +34,7 @@ module Compo
34
34
  #
35
35
  # @return [Object] The added child if successful; nil otherwise.
36
36
  def add(id, child)
37
- add!(id, child).tap(&method(:assign_parent))
37
+ add!(id, child).tap(&method(:assign_parent_to))
38
38
  end
39
39
 
40
40
  # Removes a child from this Composite directly
@@ -50,7 +50,7 @@ module Compo
50
50
  #
51
51
  # @return [Object] The removed child if successful; nil otherwise.
52
52
  def remove(child)
53
- remove!(child).tap(&method(:remove_parent))
53
+ remove!(child).tap(&method(:remove_parent_of))
54
54
  end
55
55
 
56
56
  # Removes a child from this Composite, given its ID
@@ -66,7 +66,7 @@ module Compo
66
66
  #
67
67
  # @return [Object] The removed child if successful; nil otherwise.
68
68
  def remove_id(id)
69
- remove_id!(id).tap(&method(:remove_parent))
69
+ remove_id!(id).tap(&method(:remove_parent_of))
70
70
  end
71
71
 
72
72
  def_delegator :children, :each
@@ -83,7 +83,7 @@ module Compo
83
83
  # @param child [Object] The child whose parent assignment is being set.
84
84
  #
85
85
  # @return [void]
86
- def assign_parent(child)
86
+ def assign_parent_to(child)
87
87
  child.update_parent(self, id_function(child)) unless child.nil?
88
88
  end
89
89
 
@@ -96,7 +96,7 @@ module Compo
96
96
  # @param child [Object] The child whose parent assignment is being set.
97
97
  #
98
98
  # @return [void]
99
- def remove_parent(child)
99
+ def remove_parent_of(child)
100
100
  child.remove_parent unless child.nil?
101
101
  end
102
102
 
data/lib/compo/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # The current gem version. See CHANGELOG for information.
2
2
  module Compo
3
- VERSION = '0.1.0'
3
+ VERSION = '0.1.1'
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: compo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Windsor
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-26 00:00:00.000000000 Z
11
+ date: 2013-12-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: backports