Class: Propose::AtomFinder

Inherits:
Object
  • Object
show all
Includes:
Visitor
Defined in:
lib/propose/atom_finder.rb

Overview

Finds all atoms in a parse tree.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Visitor

#visit

Constructor Details

#initialize(formula) ⇒ AtomFinder

Returns a new instance of AtomFinder.



10
11
12
13
# File 'lib/propose/atom_finder.rb', line 10

def initialize(formula)
  @atoms = Set.new
  visit(formula)
end

Instance Attribute Details

#atomsObject (readonly)

Returns the value of attribute atoms.



8
9
10
# File 'lib/propose/atom_finder.rb', line 8

def atoms
  @atoms
end

Instance Method Details

#visit_atom(atom) ⇒ Object



15
16
17
# File 'lib/propose/atom_finder.rb', line 15

def visit_atom(atom)
  @atoms << atom
end