DanaDanger-hyrarchy 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/hyrarchy.rb +9 -4
  2. metadata +2 -2
data/lib/hyrarchy.rb CHANGED
@@ -5,7 +5,7 @@ require 'hyrarchy/awesome_nested_set_compatibility'
5
5
  module Hyrarchy
6
6
  # Fudge factor to account for imprecision with floating point approximations
7
7
  # of a node's left and right fractions.
8
- FLOAT_FUDGE_FACTOR = 0.0000000000001 # :nodoc:
8
+ FLOAT_FUDGE_FACTOR = 0.00000000001 # :nodoc:
9
9
 
10
10
  # Mixes Hyrarchy into ActiveRecord.
11
11
  def self.activate!
@@ -101,14 +101,19 @@ module Hyrarchy
101
101
  def next_child_encoded_path(parent_path)
102
102
  if parent_path == Hyrarchy::EncodedPath::ROOT
103
103
  if sibling = roots.last
104
- sibling.send(:encoded_path).next_sibling
104
+ child_path = sibling.send(:encoded_path).next_sibling
105
105
  else
106
- Hyrarchy::EncodedPath::ROOT.first_child
106
+ child_path = Hyrarchy::EncodedPath::ROOT.first_child
107
107
  end
108
108
  else
109
109
  node = find_by_encoded_path(parent_path)
110
- node ? node.send(:next_child_encoded_path) : parent_path.first_child
110
+ child_path = node ?
111
+ node.send(:next_child_encoded_path) : parent_path.first_child
111
112
  end
113
+ while self.exists?(:lft_numer => p.numerator, :lft_denom => p.denominator)
114
+ child_path = p.next_sibling
115
+ end
116
+ child_path
112
117
  end
113
118
 
114
119
  # Returns the node with the specified encoded path.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: DanaDanger-hyrarchy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dana Danger
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-01-11 00:00:00 -08:00
12
+ date: 2009-02-03 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies: []
15
15