Class: CabezaDeTermo::JsonSpec::JsonEachField
- Inherits:
-
JsonExpression
- Object
- JsonExpression
- CabezaDeTermo::JsonSpec::JsonEachField
- Defined in:
- lib/cabeza-de-termo/json-spec/expressions/json-each-field.rb
Overview
A JsonExpression that represents what each item in a JsonList must expect.
Instance Method Summary collapse
-
#accept_walker(expression_walker) ⇒ Object
Walking expressions.
- #expect(type, &block) ⇒ Object
- #expect_a(type, &block) ⇒ Object
- #expect_an(type, &block) ⇒ Object
-
#expect_name ⇒ Object
Answer the [JsonFieldName] so it can receive expectations.
-
#initialize(parent_expression) ⇒ JsonEachField
constructor
A new instance of JsonEachField.
-
#name_expression ⇒ Object
Accessing.
- #value_expression ⇒ Object
Methods inherited from JsonExpression
#add_default_expectations, #add_expectation, #add_expectation_from_library, #default_expectations, #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) ⇒ JsonEachField
Returns a new instance of JsonEachField.
9 10 11 12 13 14 |
# File 'lib/cabeza-de-termo/json-spec/expressions/json-each-field.rb', line 9 def initialize(parent_expression) super(parent_expression) @name_expression = new_json_field_name_expression @value_expression = nil 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
53 54 55 |
# File 'lib/cabeza-de-termo/json-spec/expressions/json-each-field.rb', line 53 def accept_walker(expression_walker) expression_walker.walk_json_each_field(self) end |
#expect(type, &block) ⇒ Object
35 36 37 |
# File 'lib/cabeza-de-termo/json-spec/expressions/json-each-field.rb', line 35 def expect(type, &block) expect_a(type, &block) end |
#expect_a(type, &block) ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/cabeza-de-termo/json-spec/expressions/json-each-field.rb', line 43 def expect_a(type, &block) @value_expression = new_expression_for(type) CdT.bind_block_evaluation_to @value_expression, &block unless block.nil? @value_expression end |
#expect_an(type, &block) ⇒ Object
39 40 41 |
# File 'lib/cabeza-de-termo/json-spec/expressions/json-each-field.rb', line 39 def expect_an(type, &block) expect_a(type, &block) end |
#expect_name ⇒ Object
Answer the [JsonFieldName] so it can receive expectations.
31 32 33 |
# File 'lib/cabeza-de-termo/json-spec/expressions/json-each-field.rb', line 31 def expect_name() @name_expression end |
#name_expression ⇒ Object
Accessing
18 19 20 |
# File 'lib/cabeza-de-termo/json-spec/expressions/json-each-field.rb', line 18 def name_expression() @name_expression end |
#value_expression ⇒ Object
22 23 24 |
# File 'lib/cabeza-de-termo/json-spec/expressions/json-each-field.rb', line 22 def value_expression() @value_expression end |