Class: Retest::Command::Base
- Inherits:
-
Object
- Object
- Retest::Command::Base
show all
- Defined in:
- lib/retest/command/base.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(all: false, file_system: FileSystem, command: nil) ⇒ Base
Returns a new instance of Base.
9
10
11
12
|
# File 'lib/retest/command/base.rb', line 9
def initialize(all: false, file_system: FileSystem, command: nil)
@file_system = file_system
@command = command || default_command(all: all)
end
|
Instance Attribute Details
#command ⇒ Object
Returns the value of attribute command.
7
8
9
|
# File 'lib/retest/command/base.rb', line 7
def command
@command
end
|
#file_system ⇒ Object
Returns the value of attribute file_system.
7
8
9
|
# File 'lib/retest/command/base.rb', line 7
def file_system
@file_system
end
|
Instance Method Details
#eql?(other) ⇒ Boolean
Also known as:
==
18
19
20
|
# File 'lib/retest/command/base.rb', line 18
def eql?(other)
hash == other.hash
end
|
47
48
49
|
# File 'lib/retest/command/base.rb', line 47
def format_batch(*files)
raise_multiple_test_not_supported
end
|
#hardcoded? ⇒ Boolean
35
36
37
|
# File 'lib/retest/command/base.rb', line 35
def hardcoded?
!has_changed? && !has_test?
end
|
#has_changed? ⇒ Boolean
39
40
41
|
# File 'lib/retest/command/base.rb', line 39
def has_changed?
command.include?('<changed>')
end
|
#has_test? ⇒ Boolean
43
44
45
|
# File 'lib/retest/command/base.rb', line 43
def has_test?
command.include?('<test>')
end
|
#hash ⇒ Object
23
24
25
|
# File 'lib/retest/command/base.rb', line 23
def hash
[self.class, file_system, command].hash
end
|
#switch_to(type) ⇒ Object
27
28
29
30
31
32
33
|
# File 'lib/retest/command/base.rb', line 27
def switch_to(type)
case type.to_s
when 'all' then clone(command: all_command)
when 'batched' then clone(command: batched_command)
else raise ArgumentError, "unknown type to switch to: #{type}"
end
end
|
#to_s ⇒ Object
14
15
16
|
# File 'lib/retest/command/base.rb', line 14
def to_s
all ? all_command : batched_command
end
|