Class: CukeSlicer::NestedTagCollection

Inherits:
Object
  • Object
show all
Includes:
Helpers
Defined in:
lib/cuke_slicer/collections/nested_tag_collection.rb

Instance Method Summary collapse

Methods included from Helpers

#is_path?, #is_tag?, #str_regex?, #str_regex_arr?

Constructor Details

#initialize(collection) ⇒ NestedTagCollection

Returns a new instance of NestedTagCollection.



10
11
12
# File 'lib/cuke_slicer/collections/nested_tag_collection.rb', line 10

def initialize collection
  self.nested_collection = collection
end

Instance Method Details

#validateObject



14
15
16
17
18
19
# File 'lib/cuke_slicer/collections/nested_tag_collection.rb', line 14

def validate
  nested_collection.each do |element|
    raise(ArgumentError, "Tag filters cannot be nested more than one level deep.") if element.is_a?(Array)
    raise(ArgumentError, "Filter '#{element}' must be a String or Regexp. Got #{element.class}") unless str_regex?(element)
  end
end