Sha256: 95ca0fee08bc93e736afcdd27033f9bc35d03a287184fac3f73691e2b19807a9
Contents?: true
Size: 920 Bytes
Versions: 1
Compression:
Stored size: 920 Bytes
Contents
module CucumberAnalytics # A mix-in module containing methods used by elements that are nested inside # of other elements. module Nested # The parent object that contains *self* attr_accessor :parent_element # Returns the ancestor of *self* that matches the given type. def get_ancestor(ancestor_type) ancestor = self.parent_element target_type = {:directory => Directory, :feature_file => FeatureFile, :feature => Feature, :test => TestElement, :step => Step, :example => Example }[ancestor_type] raise(ArgumentError, "Unknown ancestor type '#{ancestor_type}'.") if target_type.nil? until ancestor.is_a?(target_type) || ancestor.nil? ancestor = ancestor.parent_element end ancestor end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cucumber_analytics-1.3.0 | lib/cucumber_analytics/nested.rb |