Class: Concordion

Inherits:
Object
  • Object
show all
Includes:
ConcordionUtility
Defined in:
lib/concordion.rb

Constant Summary collapse

@@TEXT_VAR =
"#TEXT"

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ConcordionUtility

#concordion_arguments, #concordion_cmd_attr_exists?, #concordion_cmd_attr_for, #concordion_property_reference, #concordion_variable_name, #has_property_reference?, #instrumentation, #supported_and_instrumented?

Methods included from ConcordionConvenience

#methods_for

Methods included from ConcordionStringUtility

#assignment, #attr_writer_method?, #concordion_assignment, #concordion_method_name, #ends_in_empty_parens?, #escape_single_quotes, #has_arguments?, #has_assignment?, #is_direct_method_call?

Methods included from PluralToSingularUtility

#singular

Methods included from SnakeCaseUtility

#snake_case, #snake_cased_goldmaster_name, #snake_cased_test_name

Methods included from ConcordionConstants

#concordion_command_attributes, #supported?

Constructor Details

#initializeConcordion

Returns a new instance of Concordion.



16
17
18
19
20
21
22
23
# File 'lib/concordion.rb', line 16

def initialize
  @memory = {}
  @lookahead_handler = ConcordionLookaheadHandler.new
  @verifier = ConcordionVerifier.new(self)
  @invoker = ConcordionInvoker.new(self)
  @binder = ConcordionBinder.new(self)
  set_variable(@@TEXT_VAR, @@TEXT_VAR)
end

Instance Attribute Details

#verification_variableObject (readonly)

Returns the value of attribute verification_variable.



14
15
16
# File 'lib/concordion.rb', line 14

def verification_variable
  @verification_variable
end

#verifierObject (readonly)

Returns the value of attribute verifier.



14
15
16
# File 'lib/concordion.rb', line 14

def verifier
  @verifier
end

Class Method Details

.TEXT_VARObject



11
12
13
# File 'lib/concordion.rb', line 11

def self.TEXT_VAR
  @@TEXT_VAR
end

Instance Method Details

#dereference(conc_call) ⇒ Object



33
34
35
36
37
38
39
40
41
42
# File 'lib/concordion.rb', line 33

def dereference(conc_call)
  var_name = concordion_variable_name(conc_call)
  var = get_variable(var_name)

  if !has_property_reference?(conc_call)
    return var
  end

  var.send(concordion_property_reference(conc_call))
end

#evaluate(cpr, test_context, processor) ⇒ Object



45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/concordion.rb', line 45

def evaluate(cpr, test_context, processor)
  @lookahead_handler.handle_lookahead(cpr, test_context, processor)

  return { :result => true } if @binder.bind_if_set_command(cpr) 

  @verifier.update_if_verify_command(cpr)

  sut_rv = @invoker.invoke_sut(cpr, test_context)
  @binder.handle_assignment(cpr, sut_rv)
  conc_rv = @invoker.invoke_concordion(cpr, sut_rv)
  
  conc_rv
end

#get_variable(variable) ⇒ Object



28
29
30
# File 'lib/concordion.rb', line 28

def get_variable(variable)
  @memory[variable]
end

#set_variable(variable, value) ⇒ Object



24
25
26
# File 'lib/concordion.rb', line 24

def set_variable(variable, value)
  @memory[variable] = value
end