Class: CodeMiner::SexpFormatter
- Inherits:
-
Object
- Object
- CodeMiner::SexpFormatter
- Defined in:
- lib/codeminer/sexp_processor.rb
Instance Attribute Summary collapse
-
#exp ⇒ Object
readonly
Returns the value of attribute exp.
Instance Method Summary collapse
- #each ⇒ Object
- #format(*nodes, children) ⇒ Object
-
#initialize(exp, parser) ⇒ SexpFormatter
constructor
A new instance of SexpFormatter.
- #src_extract ⇒ Object
- #to_sexp ⇒ Object
- #type ⇒ Object
- #value ⇒ Object
Constructor Details
#initialize(exp, parser) ⇒ SexpFormatter
Returns a new instance of SexpFormatter.
59 60 61 62 |
# File 'lib/codeminer/sexp_processor.rb', line 59 def initialize(exp, parser) @exp = exp @parser = parser end |
Instance Attribute Details
#exp ⇒ Object (readonly)
Returns the value of attribute exp.
57 58 59 |
# File 'lib/codeminer/sexp_processor.rb', line 57 def exp @exp end |
Instance Method Details
#each ⇒ Object
72 73 74 |
# File 'lib/codeminer/sexp_processor.rb', line 72 def each exp.each end |
#format(*nodes, children) ⇒ Object
88 89 90 |
# File 'lib/codeminer/sexp_processor.rb', line 88 def format(*nodes, children) CodeMiner::Sexp.new([*nodes, *children.map{|e| @parser.to_sexp(e)}], exp) end |
#src_extract ⇒ Object
76 77 78 |
# File 'lib/codeminer/sexp_processor.rb', line 76 def src_extract exp.src_extract end |
#to_sexp ⇒ Object
80 81 82 83 84 85 86 |
# File 'lib/codeminer/sexp_processor.rb', line 80 def to_sexp if exp.respond_to?(:each) format(type, *value, each) else exp end end |
#type ⇒ Object
64 65 66 |
# File 'lib/codeminer/sexp_processor.rb', line 64 def type exp.type end |
#value ⇒ Object
68 69 70 |
# File 'lib/codeminer/sexp_processor.rb', line 68 def value exp.value end |