acts_as_dag 2.0.3 → 2.0.4

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: 7bcebac2ff3f393559762ee5da1f36408e9d4c3e
4
- data.tar.gz: 0c6f633ebccda6d8853fed068984282cddfd99b6
3
+ metadata.gz: a9811f8fe46b37783ba3668be42a552611127175
4
+ data.tar.gz: 408ebd1239ac16da5d7d298e9e18d9a9e93fcfb1
5
5
  SHA512:
6
- metadata.gz: d61ad62ba250b48f83618a4ce98c61ae9692efc12c87f9a8dc473eb4b286d72478e88167314937f6737b5fcc7fefcda03fd568023762c4ee5c53f3640dd4ba5f
7
- data.tar.gz: 6651e2c85bd7c9057cb8ec628ff046b99e4523a16e1244fde30356e99e8ae9e5f20266c04bcbbe8ea9c17f031edcd5ca40375d82f192125e6703b20eadae1651
6
+ metadata.gz: b9b67b40f5f0cac839662b2adeb4cd405e3d88de5bf59829ce72c8d994b08b91f8a87973055472bade3604d83c3bb7a8bef9f7996d43d960b4a7cfa2ae14f76a
7
+ data.tar.gz: 994578a50819239073d05589a3de5d28c77e5cd3c5aa02ed3eec4cc05b371722be2a361d1b59743144cd44ffcd53f8e728332acd130d35e81c6f727b3801207a
data/README.md CHANGED
@@ -82,7 +82,7 @@ subtree_ids Returns a list of all ids in the record's subtree
82
82
 
83
83
  ```
84
84
  roots Nodes without parents
85
- leafs Nodes without children
85
+ leaves Nodes without children
86
86
  ancestors_of(node) Ancestors of node, node can be either a record or an id
87
87
  children_of(node) Children of node, node can be either a record or an id
88
88
  descendants_of(node) Descendants of node, node can be either a record or an id
@@ -1,4 +1,3 @@
1
-
2
1
  # Load the acts_as_dag files
3
2
  require 'acts_as_dag/acts_as_dag'
4
3
  require 'acts_as_dag/version'
@@ -83,7 +83,7 @@ module ActsAsDAG
83
83
 
84
84
  # NOTE: Use select to prevent ActiveRecord::ReadOnlyRecord if the returned records are modified
85
85
  scope :roots, lambda { joins(:parent_links).where(link_class.table_name => {:parent_id => nil}) }
86
- scope :leafs, lambda { joins("LEFT OUTER JOIN #{link_class.table_name} ON #{table_name}.id = parent_id").where(link_class.table_name => {:child_id => nil}).uniq }
86
+ scope :leaves, lambda { joins("LEFT OUTER JOIN #{link_class.table_name} ON #{table_name}.id = parent_id").where(link_class.table_name => {:child_id => nil}).uniq }
87
87
  scope :children, lambda { joins(:parent_links).where.not(link_class.table_name => {:parent_id => nil}).uniq }
88
88
  scope :parent_records, lambda { joins(:child_links).where.not(link_class.table_name => {:child_id => nil}).uniq }
89
89
 
@@ -2,6 +2,11 @@ module ActsAsDAG
2
2
  module Deprecated
3
3
 
4
4
  module ClassMethods
5
+ # Deprecated misspelled method name
6
+ def leafs
7
+ leaves
8
+ end
9
+
5
10
  # Reorganizes the entire class of records based on their name, first resetting the hierarchy, then reoganizing
6
11
  # Can pass a list of categories and only those will be reorganized
7
12
  def reorganize(categories_to_reorganize = self.all)
@@ -1,3 +1,3 @@
1
1
  module ActsAsDAG
2
- VERSION = '2.0.3'
2
+ VERSION = '2.0.4'
3
3
  end
@@ -737,20 +737,20 @@ describe 'acts_as_dag' do
737
737
  end
738
738
  end
739
739
 
740
- describe '::leafs' do
740
+ describe '::leaves' do
741
741
  it "returns all leaf nodes" do
742
742
  mom.add_child(suzy)
743
- expect(klass.leafs).to include(suzy)
743
+ expect(klass.leaves).to include(suzy)
744
744
  end
745
745
 
746
746
  it "doesn't return non-leaf nodes" do
747
747
  mom.add_child(suzy)
748
- expect(klass.leafs).not_to include(mom)
748
+ expect(klass.leaves).not_to include(mom)
749
749
  end
750
750
 
751
751
  it "doesn't mark returned records as readonly" do
752
752
  mom.add_child(suzy)
753
- expect(klass.leafs.none?(&:readonly?)).to be_truthy
753
+ expect(klass.leaves.none?(&:readonly?)).to be_truthy
754
754
  end
755
755
  end
756
756
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_dag
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3
4
+ version: 2.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicholas Jakobsen
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-05-20 00:00:00.000000000 Z
12
+ date: 2015-06-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord