Class: Command::RequirementsCollector

Inherits:
SetVisitor
  • Object
show all
Defined in:
lib/command-set/structural.rb

Instance Attribute Summary collapse

Attributes inherited from SetVisitor

#command_path, #subject_context

Instance Method Summary collapse

Methods inherited from SetVisitor

#command_out_of_terms, #extra_terms, #leave_from, #set_out_of_terms, #term_without_hop

Constructor Details

#initialize(subject) ⇒ RequirementsCollector

Returns a new instance of RequirementsCollector.



33
34
35
36
# File 'lib/command-set/structural.rb', line 33

def initialize(subject)
  super()
  @subject = subject
end

Instance Attribute Details

#subjectObject (readonly)

Returns the value of attribute subject.



38
39
40
# File 'lib/command-set/structural.rb', line 38

def subject
  @subject
end

Instance Method Details

#arrive_at(terms, node) ⇒ Object



40
41
42
43
44
45
# File 'lib/command-set/structural.rb', line 40

def arrive_at(terms, node)
  @subject.required_fields(node.subject_requirements.uniq, @subject_context)
  node.argument_list.each do |argument|
    @subject.required_fields(argument.subject_requirements.uniq)
  end
end