Class: CabezaDeTermo::JsonSpec::JsonList

Inherits:
JsonExpression show all
Defined in:
lib/cabeza-de-termo/json-spec/expressions/json-list.rb

Overview

A JsonExpression representing a list in a json parse tree.

Instance Method Summary collapse

Methods inherited from JsonExpression

#add_default_expectations, #add_expectation, #add_expectation_from_library, #default_expectations_for, #expectations_library, #expectations_runner, #is_a_modifier_library_method?, #is_an_expectations_library_method?, #json_spec, #method_missing, #new_any_of_expression, #new_anything_expression, #new_each_field, #new_expectations_runner, #new_expression_for, #new_json_each_expression, #new_json_field_name_expression, #new_list_expression, #new_named_field_expression, #new_object_expression, #new_scalar_expression, #parent_expression, #perform_modifier_from_library, #run_modifier, #set_expectations_runner, #set_parent_expression, #to_be_as_defined_by, #to_be_as_defined_in

Constructor Details

#initialize(parent_expression) ⇒ JsonList

Returns a new instance of JsonList.



9
10
11
12
13
# File 'lib/cabeza-de-termo/json-spec/expressions/json-list.rb', line 9

def initialize(parent_expression)
	@each_expression = new_json_each_expression

	super(parent_expression)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class CabezaDeTermo::JsonSpec::JsonExpression

Instance Method Details

#accept_walker(expression_walker) ⇒ Object

Walking expressions



35
36
37
# File 'lib/cabeza-de-termo/json-spec/expressions/json-list.rb', line 35

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

#default_expectationsObject



15
16
17
# File 'lib/cabeza-de-termo/json-spec/expressions/json-list.rb', line 15

def default_expectations()
	default_expectations_for(:lists)
end

#each(&block) ⇒ Object

Defining Expectations



27
28
29
30
31
# File 'lib/cabeza-de-termo/json-spec/expressions/json-list.rb', line 27

def each(&block)
	CdT.bind_block_evaluation_to each_expression, &block unless block.nil? 

	each_expression
end

#each_expressionObject

Accessing



21
22
23
# File 'lib/cabeza-de-termo/json-spec/expressions/json-list.rb', line 21

def each_expression()
	@each_expression
end