Class: Goodcheck::Trigger

Inherits:
Object
  • Object
show all
Defined in:
lib/goodcheck/trigger.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(patterns:, globs:, passes:, fails:, negated:) ⇒ Trigger

Returns a new instance of Trigger.



9
10
11
12
13
14
15
# File 'lib/goodcheck/trigger.rb', line 9

def initialize(patterns:, globs:, passes:, fails:, negated:)
  @patterns = patterns
  @globs = globs
  @passes = passes
  @fails = fails
  @negated = negated
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



17
18
19
20
# File 'lib/goodcheck/trigger.rb', line 17

def by_pattern!
  @by_pattern = true
  self
end

#by_pattern? ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
25
# File 'lib/goodcheck/trigger.rb', line 22

def by_pattern?
  # True if the trigger is from `pattern` or `not` attribute (compatible mode.)
  @by_pattern
end

#fires_for?(path:) ⇒ Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/goodcheck/trigger.rb', line 40

def fires_for?(path:)
  globs.any? {|glob| glob.test(path) }
end

#negated? ⇒ Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/goodcheck/trigger.rb', line 36

def negated?
  @negated
end

#skips_fail_examples!(flag = true) ⇒ Object



27
28
29
30
# File 'lib/goodcheck/trigger.rb', line 27

def skips_fail_examples!(flag = true)
  @skips_fail_examples = flag
  self
end

#skips_fail_examples? ⇒ Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/goodcheck/trigger.rb', line 32

def skips_fail_examples?
  @skips_fail_examples
end