Class: Synthesis::ExpectationReportFormat::Dot::DotProcessor

Inherits:
SexpProcessor
  • Object
show all
Defined in:
lib/synthesis/formatter/dot.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDotProcessor

Returns a new instance of DotProcessor.



67
68
69
70
71
72
# File 'lib/synthesis/formatter/dot.rb', line 67

def initialize
  super
  self.strict = false
  self.auto_shift_type = true
  @ancestors = []
end

Instance Attribute Details

#klazzObject (readonly)

Returns the value of attribute klazz.



58
59
60
# File 'lib/synthesis/formatter/dot.rb', line 58

def klazz
  @klazz
end

#methodObject

Returns the value of attribute method.



57
58
59
# File 'lib/synthesis/formatter/dot.rb', line 57

def method
  @method
end

Class Method Details

.process(exp, method) ⇒ Object



60
61
62
63
64
65
# File 'lib/synthesis/formatter/dot.rb', line 60

def self.process(exp, method)
  analyzer = self.new
  analyzer.method = method
  analyzer.process(exp)
  analyzer.klazz
end

Instance Method Details

#process_class(exp) ⇒ Object



82
83
84
85
86
87
88
# File 'lib/synthesis/formatter/dot.rb', line 82

def process_class(exp)
  name = exp.shift
  @ancestors.push name
  result = s(:class, name, exp.shift, process(exp.shift))
  @ancestors.pop
  result
end

#process_defn(exp) ⇒ Object



90
91
92
93
94
# File 'lib/synthesis/formatter/dot.rb', line 90

def process_defn(exp)
  name = exp.shift
  @klazz = @ancestors * '::' if name == method.to_sym
  s(:defn, name, process(exp.shift))
end

#process_defs(exp) ⇒ Object



96
97
98
99
100
101
# File 'lib/synthesis/formatter/dot.rb', line 96

def process_defs(exp)
  selff = exp.shift
  name = exp.shift
  @klazz = @ancestors * '::' if name == method.to_sym
  s(:defs, selff, name, process(exp.shift))
end

#process_module(exp) ⇒ Object



74
75
76
77
78
79
80
# File 'lib/synthesis/formatter/dot.rb', line 74

def process_module(exp)
  name = exp.shift
  @ancestors.push name
  result = s(:module, name, process(exp.shift))
  @ancestors.pop
  result
end