Class: CabezaDeTermo::JsonSpec::CanBeAbsentExpectationsRunner

Inherits:
AbstractExpectationsRunner show all
Defined in:
lib/cabeza-de-termo/json-spec/expectations/runner/can-be-absent-expectations-runner.rb

Instance Method Summary collapse

Constructor Details

#initialize(expectations_runner) ⇒ CanBeAbsentExpectationsRunner

Returns a new instance of CanBeAbsentExpectationsRunner.



7
8
9
# File 'lib/cabeza-de-termo/json-spec/expectations/runner/can-be-absent-expectations-runner.rb', line 7

def initialize(expectations_runner)
	@underlaying_runner = expectations_runner
end

Instance Method Details

#accept_walker(expression_walker) ⇒ Object

Walking



25
26
27
# File 'lib/cabeza-de-termo/json-spec/expectations/runner/can-be-absent-expectations-runner.rb', line 25

def accept_walker(expression_walker)
	expression_walker.walk_expectation_runner(self)
end

#accept_walker_with_value_holder(expression_walker, value_holder) ⇒ Object

Raises:



29
30
31
32
33
# File 'lib/cabeza-de-termo/json-spec/expectations/runner/can-be-absent-expectations-runner.rb', line 29

def accept_walker_with_value_holder(expression_walker, value_holder)
	raise SkipBranchSignal.new if value_holder.is_missing_value?

	underlaying_runner.accept_walker_with_value_holder(expression_walker, value_holder)
end

#add(expectation) ⇒ Object

Adding



19
20
21
# File 'lib/cabeza-de-termo/json-spec/expectations/runner/can-be-absent-expectations-runner.rb', line 19

def add(expectation)
	underlaying_runner.add(expectation)
end

#explain_with(expression_walker) ⇒ Object

Yes, this sucks. But I got kind of tired of this library and want to move on to something else.



39
40
41
42
43
44
45
46
47
# File 'lib/cabeza-de-termo/json-spec/expectations/runner/can-be-absent-expectations-runner.rb', line 39

def explain_with(expression_walker)
	expression_walker.during_tab do 
		expression_walker.append_in_new_line('if present')
		expression_walker.cr
		expression_walker.append_tabs

		underlaying_runner.explain_with(expression_walker)
	end
end

#underlaying_runnerObject

Accessing



13
14
15
# File 'lib/cabeza-de-termo/json-spec/expectations/runner/can-be-absent-expectations-runner.rb', line 13

def underlaying_runner
	@underlaying_runner
end