Sha256: dcbec5c1a45e95bcd87e3ed87b51a626bdee03c5ff7cb299e32f32cc80c0dc30
Contents?: true
Size: 1.11 KB
Versions: 4
Compression:
Stored size: 1.11 KB
Contents
module CukeModeler # NOT A PART OF THE PUBLIC API # A mix-in module containing methods used by models that are nested inside # of other models. module Nested # The parent model that contains this model attr_accessor :parent_model # Returns the ancestor model of this model that matches the given type. def get_ancestor(ancestor_type) target_classes = classes_for_type(ancestor_type) raise(ArgumentError, "Unknown ancestor type '#{ancestor_type}'.") if target_classes.nil? ancestor = parent_model ancestor = ancestor.parent_model until target_classes.include?(ancestor.class) || ancestor.nil? ancestor end private def classes_for_type(type) { directory: [Directory], feature_file: [FeatureFile], feature: [Feature], test: [Scenario, Outline, Background], background: [Background], scenario: [Scenario], outline: [Outline], step: [Step], table: [Table], example: [Example], row: [Row] }[type] end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
cuke_modeler-3.10.0 | lib/cuke_modeler/nested.rb |
cuke_modeler-3.9.0 | lib/cuke_modeler/nested.rb |
cuke_modeler-3.8.0 | lib/cuke_modeler/nested.rb |
cuke_modeler-3.7.0 | lib/cuke_modeler/nested.rb |