Class: Nuri::Master::GoalGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/nuri/master.rb

Overview

Helper classes/modules

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeGoalGenerator

Returns a new instance of GoalGenerator.



682
683
684
# File 'lib/nuri/master.rb', line 682

def initialize
	@results = Sfp::Helper::Constraint.and('goal')
end

Instance Attribute Details

#resultsObject (readonly)

Returns the value of attribute results.



680
681
682
# File 'lib/nuri/master.rb', line 680

def results
  @results
end

Instance Method Details

#visit(name, value, parent) ⇒ Object



686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
# File 'lib/nuri/master.rb', line 686

def visit(name, value, parent)
	return false if name[0,1] == '_'

	if value.is_a?(Hash)
		return true if value['_context'] == 'object'

		if parent.has_key?('_finals') and parent['_finals'].index(name).nil?
			if value['_context'] == 'set'
				@results[parent.ref.push(name)] = Sfp::Helper::Constraint.equals(value['_values'])
			elsif value['_context'] == 'null'
				# HACK! This should not be commented => null value should not be ignored.
				#@results[parent.ref.push(name)] = Sfp::Helper::Constraint.equals(value)
			end
		end
		return false
	end
	if parent.has_key?('_finals') and parent['_finals'].index(name).nil?
		@results[ parent.ref.push(name) ] = Sfp::Helper::Constraint.equals(value)
	end
	false
end