Class: CukeSniffer::FeatureRuleTarget

Inherits:
RuleTarget
  • Object
show all
Defined in:
lib/cuke_sniffer/feature_rules_evaluator.rb

Overview

Author

Robert Cochran ([email protected])

Copyright

Copyright © 2014 Robert Cochran

License

Distributes under the MIT License

Parent class for Feature and Scenario objects holds shared attributes and rules. Extends CukeSniffer::RuleTarget

Direct Known Subclasses

Feature, Scenario

Constant Summary

Constants included from RuleConfig

RuleConfig::ERROR, RuleConfig::FATAL, RuleConfig::INFO, RuleConfig::RULES, RuleConfig::WARNING

Constants included from Constants

Constants::COMMENT_REGEX, Constants::DATE_REGEX, Constants::DEFAULT_OUTPUT_FILE_NAME, Constants::FILE_IGNORE_LIST, Constants::HOOK_REGEX, Constants::HOOK_STYLES, Constants::MARKUP_SOURCE, Constants::SCENARIO_TITLE_STYLES, Constants::STEP_DEFINITION_REGEX, Constants::STEP_REGEX, Constants::STEP_STYLES, Constants::TAG_REGEX, Constants::THRESHOLDS

Instance Attribute Summary collapse

Attributes inherited from RuleTarget

#location, #rules_hash, #score, #type

Instance Method Summary collapse

Methods inherited from RuleTarget

#good?, #is_comment?, #problem_percentage, #store_rule, #store_rule_many_times

Constructor Details

#initialize(location) ⇒ FeatureRuleTarget

Location must be in the format of “file_pathfile_name.rb:line_number”



21
22
23
24
25
# File 'lib/cuke_sniffer/feature_rules_evaluator.rb', line 21

def initialize(location)
  @name = ""
  @tags = []
  super(location)
end

Instance Attribute Details

#nameObject

string: Name of the Feature or Scenario



18
19
20
# File 'lib/cuke_sniffer/feature_rules_evaluator.rb', line 18

def name
  @name
end

#tagsObject

string array: Contains all tags attached to a Feature or Scenario



15
16
17
# File 'lib/cuke_sniffer/feature_rules_evaluator.rb', line 15

def tags
  @tags
end

Instance Method Details

#==(comparison_object) ⇒ Object

:nodoc:



27
28
29
30
31
# File 'lib/cuke_sniffer/feature_rules_evaluator.rb', line 27

def == (comparison_object) # :nodoc:
  super(comparison_object) &&
  comparison_object.name == name &&
  comparison_object.tags == tags
end

#is_comment_and_tag?(line) ⇒ Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/cuke_sniffer/feature_rules_evaluator.rb', line 33

def is_comment_and_tag?(line)
  true if line =~ /^\#.*\@.*$/
end