Class: WithClues::Private::CustomClueMethodAnalysis
- Inherits:
-
Object
- Object
- WithClues::Private::CustomClueMethodAnalysis
show all
- Defined in:
- lib/with_clues/private/custom_clue_method_analysis.rb
Defined Under Namespace
Classes: FourArgMethod, Param, TwoArgMethod
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.from_method(unbound_method) ⇒ Object
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/with_clues/private/custom_clue_method_analysis.rb', line 5
def self.from_method(unbound_method)
params = unbound_method.parameters.map { |param_array| Param.new(param_array) }
if params.size == 2
two_arg_method = TwoArgMethod.new(params)
if two_arg_method.valid?
return StandardImplementation.new
end
return BadParams.new(two_arg_method.errors)
elsif params.size == 4
three_arg_method = FourArgMethod.new(params)
if three_arg_method.valid?
return RequiresPageObject.new
end
return BadParams.new(three_arg_method.errors)
end
BadParams.new([
"dump (#{unbound_method.owner}) accepted #{params.size} arguments, not 2 or 4. Got: #{params.map(&:to_s).join(", ")}, should be one positional and either one keyword arg named 'context:' or three keyword args named 'context:', 'page:', and 'captured_logs:'"
])
end
|
Instance Method Details
#raise_exception! ⇒ Object
38
39
40
|
# File 'lib/with_clues/private/custom_clue_method_analysis.rb', line 38
def raise_exception!
raise StandardError.new("Unimplemented condition found inside #from_method")
end
|
#requires_page_object? ⇒ Boolean
34
35
36
|
# File 'lib/with_clues/private/custom_clue_method_analysis.rb', line 34
def requires_page_object?
false
end
|
#standard_implementation? ⇒ Boolean
30
31
32
|
# File 'lib/with_clues/private/custom_clue_method_analysis.rb', line 30
def standard_implementation?
false
end
|