Class: Goodcheck::Trigger
- Inherits:
-
Object
- Object
- Goodcheck::Trigger
- Defined in:
- lib/goodcheck/trigger.rb
Instance Attribute Summary collapse
-
#fails ⇒ Object
readonly
Returns the value of attribute fails.
-
#globs ⇒ Object
readonly
Returns the value of attribute globs.
-
#negated ⇒ Object
readonly
Returns the value of attribute negated.
-
#passes ⇒ Object
readonly
Returns the value of attribute passes.
-
#patterns ⇒ Object
readonly
Returns the value of attribute patterns.
Instance Method Summary collapse
- #by_pattern! ⇒ Object
- #by_pattern? ⇒ Boolean
- #fires_for?(path:) ⇒ Boolean
-
#initialize(patterns:, globs:, passes:, fails:, negated:) ⇒ Trigger
constructor
A new instance of Trigger.
- #negated? ⇒ Boolean
- #skips_fail_examples!(flag = true) ⇒ Object
- #skips_fail_examples? ⇒ Boolean
Constructor Details
#initialize(patterns:, globs:, passes:, fails:, negated:) ⇒ Trigger
Returns a new instance of Trigger.
9 10 11 12 13 14 15 16 17 |
# File 'lib/goodcheck/trigger.rb', line 9 def initialize(patterns:, globs:, passes:, fails:, negated:) @patterns = patterns @globs = globs @passes = passes @fails = fails @negated = negated @by_pattern = false @skips_fail_examples = false end |
Instance Attribute Details
#fails ⇒ Object (readonly)
Returns the value of attribute fails.
6 7 8 |
# File 'lib/goodcheck/trigger.rb', line 6 def fails @fails end |
#globs ⇒ Object (readonly)
Returns the value of attribute globs.
4 5 6 |
# File 'lib/goodcheck/trigger.rb', line 4 def globs @globs end |
#negated ⇒ Object (readonly)
Returns the value of attribute negated.
7 8 9 |
# File 'lib/goodcheck/trigger.rb', line 7 def negated @negated end |
#passes ⇒ Object (readonly)
Returns the value of attribute passes.
5 6 7 |
# File 'lib/goodcheck/trigger.rb', line 5 def passes @passes end |
#patterns ⇒ Object (readonly)
Returns the value of attribute patterns.
3 4 5 |
# File 'lib/goodcheck/trigger.rb', line 3 def patterns @patterns end |
Instance Method Details
#by_pattern! ⇒ Object
19 20 21 22 |
# File 'lib/goodcheck/trigger.rb', line 19 def by_pattern! @by_pattern = true self end |
#by_pattern? ⇒ Boolean
24 25 26 27 |
# File 'lib/goodcheck/trigger.rb', line 24 def by_pattern? # True if the trigger is from `pattern` or `not` attribute (compatible mode.) @by_pattern end |
#fires_for?(path:) ⇒ Boolean
42 43 44 |
# File 'lib/goodcheck/trigger.rb', line 42 def fires_for?(path:) globs.any? {|glob| glob.test(path) } end |
#negated? ⇒ Boolean
38 39 40 |
# File 'lib/goodcheck/trigger.rb', line 38 def negated? @negated end |
#skips_fail_examples!(flag = true) ⇒ Object
29 30 31 32 |
# File 'lib/goodcheck/trigger.rb', line 29 def skips_fail_examples!(flag = true) @skips_fail_examples = flag self end |
#skips_fail_examples? ⇒ Boolean
34 35 36 |
# File 'lib/goodcheck/trigger.rb', line 34 def skips_fail_examples? @skips_fail_examples end |