locabulary 0.3.0 → 0.3.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: 80199b69498270b4694e29cb3db82b69753f5fdc
4
- data.tar.gz: 83d0db6b94721969a38108fb3a49174479a60495
3
+ metadata.gz: 399c1a9f7cf3a7365116f94bd18cefa4c5ccd240
4
+ data.tar.gz: 9399cbc0fcd7b6a8d8b1839b79225e3061bd5fb5
5
5
  SHA512:
6
- metadata.gz: 31460d7740cdec062a7b0375c76d0293fd3c5dc05ff955794dfdf06d9925c4b264f2b38eb227e363594805d26c5b31b31eabe08d0c6a5f43fce5e3485e2b6110
7
- data.tar.gz: eb01d291687cb61ad41f7f8ee53745a34d1fdb519c9a1ef87b30b39e5ce8d6e81e524da1f7d6c43c67211a1351c64e108d256ec499f3ce0943c960264a54b51d
6
+ metadata.gz: 74c9bb11679cea1e9c2831a995607426db1494028a5b147171e24233b11fe1378221769bb210c3f8f1e6331960502cdbf24b61f6167f3b3836da31baeffe312b
7
+ data.tar.gz: e1a7b89c4e1583ecbb29e2b0137fa3422d9b33ec4e2ec3afd6ac2f228f48a11afecc5ffcb4daa32d334196e73ca213b44957c79f02aa9402eac2505840823b3c
@@ -32,7 +32,13 @@ module Locabulary
32
32
  @children = []
33
33
  end
34
34
 
35
- attr_reader :children
35
+ def children
36
+ @children.sort
37
+ end
38
+
39
+ def add_child(*input)
40
+ @children += input
41
+ end
36
42
 
37
43
  HIERARCHY_SEPARATOR = '::'.freeze
38
44
  def slugs
@@ -1,3 +1,3 @@
1
1
  module Locabulary
2
- VERSION = '0.3.0'.freeze
2
+ VERSION = '0.3.1'.freeze
3
3
  end
data/lib/locabulary.rb CHANGED
@@ -54,7 +54,7 @@ module Locabulary
54
54
  def associate_parents_and_childrens_for(hierarchy_graph_keys, items, predicate_name)
55
55
  items.each do |item|
56
56
  begin
57
- hierarchy_graph_keys.fetch(item.parent_term_label).children << item unless item.parent_slugs.empty?
57
+ hierarchy_graph_keys.fetch(item.parent_term_label).add_child(item) unless item.parent_slugs.empty?
58
58
  rescue KeyError => error
59
59
  raise Exceptions::MissingHierarchicalParentError.new(predicate_name, error)
60
60
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: locabulary
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Friesen