fitquery 0.4.0 → 0.5.0

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- M2Q0NDlkMGJhZGMzODY0MmJiYTU4N2M2OTRlNjc2NWJkNmQ0Yzg4Nw==
4
+ MzIzZWNiZjdmNTllY2E0YzE1MDljYTJlZDdhZjdhNDllMDY4ODgyNg==
5
5
  data.tar.gz: !binary |-
6
- Y2JlZmVmMDM1M2RhNTQ5MTljMjI0YjMxZjllYzVjNzljNzZiYzZjZA==
6
+ NTBjYTYxZDY5MzI4ZmY1YzUwMzRkZjdlMDY4NDljYmY0OTgxNzlkZA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZjljOWU0NzRjNzk2N2M0NWEzY2NmMjZiM2Y1M2I2NDYzNjRkZTBhODJhMGVj
10
- OTU5N2FmNzRjZGMxMGQxZjJlMjE5ODM1NDMzMGMyZjlhMjRhZDUxODdlMWYw
11
- MzU2MzZkNTYwNWJjMjBiYjQzZDIwNTAyMjZhNTM5YzkxOWI5YmQ=
9
+ MmE3YjVkYTllMzJkY2JjNGY0MDQyMDg4NTFhNGQ0ZWI5YmEwNjM0ZTcwNjdj
10
+ ODZiMzNkYjI1ZjdmODUyNmQ3ZGM4ZmJlN2RhOWU2MWFhMGZjNDQxN2E0MDYx
11
+ YWM1ZjYwMTg2ZDRlYWYzYWE0OGMzNjc2MGE0ZTgzZDY1ZGI1ODE=
12
12
  data.tar.gz: !binary |-
13
- ZjZlOTA0N2U5ZDFhMWYyZTA3MGRiMDA2MTQ4ODVlZGJkYzdhNDFjODcxMzVj
14
- MWM2M2Y2YmM0MTdhZjY1OWJjODZkNjIyMmU4ODFiOTkzNTNkYzM5OTMyMDlm
15
- MmExNGJhZjBiMzYxZmNkNzNlYjNiYjRiYTJjOTEzZTM3YmVkZDM=
13
+ YjBjMDhlZWY4ZjQ4Njk1YmVmMDlhZDgxNmYyOTAwMzIyZWJlZDJlNWUyZTVi
14
+ YjExYjYzMzY3NmVhZmEyMTg1YjllZmU1ZmEyZDdmZTkyYmEyYWQwNWQzM2Nj
15
+ MGE1ODU2ODdkNDRjZjU3M2VjNGUwZTgwNGM3M2JlODE4MmNlMGM=
@@ -16,13 +16,14 @@ require 'find'
16
16
  # @attr_reader [Rexml::Document] properties The properties XML document of this node.
17
17
  # @attr_reader [SortedSet<String>] explicit_tags The set of tags that have been explicitly set on this node.
18
18
  class FitnesseNode
19
+ include Enumerable
19
20
  attr_reader :root, :parent, :children, :path, :path_as_array, :name, :properties, :explicit_tags
20
21
 
21
22
 
22
23
  def initialize(root, parent, name)
23
24
  @root = root
24
25
  @parent = parent
25
- @children = []
26
+ @children = {}
26
27
  @is_root = name == :root
27
28
  @name = name.to_s
28
29
  @path = name == :root ? parent.path : Pathname.new(parent.path.join(name))
@@ -47,7 +48,7 @@ class FitnesseNode
47
48
  rel_path = sub.relative_path_from(@root.path)
48
49
  next if @root.blacklist.any? {|blacklisted| rel_path.fnmatch?(blacklisted) }
49
50
  child_node = FitnesseNode.new(@root, self, sub.basename)
50
- @children.push(child_node) unless child_node.nil?
51
+ @children[child_node.name] = child_node unless child_node.nil?
51
52
  end
52
53
  end
53
54
 
@@ -56,7 +57,7 @@ class FitnesseNode
56
57
  def traverse(order = :pre, &block)
57
58
  yield self if order == :pre
58
59
  unless @children.nil?
59
- @children.each do |child|
60
+ @children.each_value do |child|
60
61
  child.traverse(&block)
61
62
  end
62
63
  end
@@ -78,7 +79,7 @@ class FitnesseNode
78
79
  catch(:prune) do
79
80
  yield self
80
81
  unless @children.nil?
81
- @children.each do |child|
82
+ @children.each_value do |child|
82
83
  child.find(&block)
83
84
  end
84
85
  end
@@ -153,10 +154,11 @@ class FitnesseNode
153
154
  @properties.nil? ? false : (@properties.get_elements('/properties/Static').count > 0)
154
155
  end
155
156
 
156
- # @return [Boolean] Is this node runable? I.e. is it either a test or a suite which is not skipped?
157
- def runable?
157
+ # @return [Boolean] Is this node runnable? I.e. is it either a test or a suite which is not skipped?
158
+ def runnable?
158
159
  !static? && !effectively_skipped? && (test? || suite?)
159
160
  end
161
+ alias runable? runnable?
160
162
 
161
163
  # Determine whether this node has a particular tag on it.
162
164
  # @param tag [String,Regexp] The tag to find. If a string, the search will be case insensitive.
@@ -63,8 +63,8 @@ class FitnesseRoot
63
63
  find {|node|
64
64
  next if node.root?
65
65
  full_name = node.path_as_array
66
- Find.prune unless (full_name - name_as_array).empty?
67
66
  return node if full_name == name_as_array
67
+ Find.prune unless (full_name - name_as_array).empty?
68
68
  }
69
69
  end
70
70
  end
@@ -1,3 +1,3 @@
1
1
  module Fitquery
2
- VERSION = '0.4.0'
2
+ VERSION = '0.5.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fitquery
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tony Peguero