rubyfocus 0.5.4 → 0.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f0e0262c3cf6abfc04f58c73c86f08241fc7173b
4
- data.tar.gz: 902d1bdeb21ef74cfeef68c98aa553099c3be1c3
3
+ metadata.gz: de422e59acb9621c98a7d22857f724261d3265c5
4
+ data.tar.gz: 9a47d0e985e3fc60b40811021d888bafc3e00b72
5
5
  SHA512:
6
- metadata.gz: 471231676b0538b7f5a6efec824d52c05f5d5017d4ff4b230ac8530ae32b669a81a51af08949b0eca6a4a18e69d17951293913ef22d11d8989a162f9e6c5ce05
7
- data.tar.gz: 77bba4659add4bc7d8dc08e818c4361dcc8816e9ae1b8f6bec48f257951f3be21e9caf375ba8fb5920640574e77f18c8a9406d80487198195130cb9d6fd77015
6
+ metadata.gz: ec929d7e0f54bb5c5ddae2be7166ea4ffde03cfd452f0ef0390868cc1db40fcf4bbb7b0fe81b26e2f545eaa713bdef40ea6807e989a1d0f1cd4e0f4e4f11abcd
7
+ data.tar.gz: 4f39da21389954a53a31262fa5cc93df43950e0b51f210e58c6c849a47abc3ce0f2ed85b721d253bf51577c23ea26445568e40ff847bcd0df292b34d0060a009
@@ -38,9 +38,9 @@ class Rubyfocus::Fetcher
38
38
  raise RuntimeError, "Method Fetcher#patch called for abstract class Fetcher."
39
39
  end
40
40
 
41
- # Returns the latest patch
41
+ # Returns the ID of head - the latest patch committed to the database.
42
42
  def head
43
- @head ||= patches.sort.last
43
+ @head ||= (patches.empty? ? base_id : patches.sort.last.to_id)
44
44
  end
45
45
 
46
46
  # Can you reach head from the given ID?
@@ -48,7 +48,7 @@ class Rubyfocus::Fetcher
48
48
  patch_array = patches.select{ |p| p.from_ids.include?(id) }
49
49
  until patch_array.empty?
50
50
  p = patch_array.first
51
- return true if p == self.head
51
+ return true if p.to_id == self.head
52
52
 
53
53
  next_patches = patches.select{ |np| np.from_ids.include? p.to_id }
54
54
  patch_array = patch_array[1..-1] + next_patches
@@ -36,6 +36,7 @@ module Rubyfocus
36
36
  raise ArgumentError, "ItemArray#select called with #{arg.class} argument."
37
37
  end
38
38
  end
39
+ alias_method :find_all, :select
39
40
 
40
41
  # This method should be overriden
41
42
  def array
@@ -16,8 +16,11 @@ class Rubyfocus::RankedItem < Rubyfocus::NamedItem
16
16
  # Is this item contained within another? You may supply an object, string or integer ID, hash of properties,
17
17
  # or proc to run on each item.
18
18
  def contained_within?(object)
19
- object = document.find(object) if [String, Fixnum, Hash, Proc].include?(object.class)
20
- ancestry.include?(object)
19
+ if [String, Fixnum, Hash, Proc].include?(object.class)
20
+ document.find_all(object).any?{ |o| ancestry.include?(o) }
21
+ else
22
+ ancestry.include?(object)
23
+ end
21
24
  end
22
25
 
23
26
  def apply_xml(n)
data/version.txt CHANGED
@@ -1 +1 @@
1
- 0.5.4
1
+ 0.5.5
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubyfocus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan-Yves Ruzicka
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-08 00:00:00.000000000 Z
11
+ date: 2016-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri