Class: CodeMiner::Sexp
- Inherits:
-
Object
- Object
- CodeMiner::Sexp
- Includes:
- CodeMiner::SourceExtract::Usage
- Defined in:
- lib/codeminer/sexp_processor.rb
Instance Attribute Summary collapse
-
#exp ⇒ Object
readonly
Returns the value of attribute exp.
-
#file ⇒ Object
readonly
Returns the value of attribute file.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #each ⇒ Object
-
#initialize(expressions, exp) ⇒ Sexp
constructor
A new instance of Sexp.
- #inspect ⇒ Object (also: #to_s)
- #length ⇒ Object
-
#method_missing(meth, *args) ⇒ Object
TODO: kill this and delegate properly.
- #src_extract ⇒ Object
- #to_a ⇒ Object
Methods included from CodeMiner::SourceExtract::Usage
#adjust_src, #column, #column=, #end_column, #end_column=, #end_line, #end_line=, #line, #line=, #src
Constructor Details
#initialize(expressions, exp) ⇒ Sexp
Returns a new instance of Sexp.
9 10 11 12 |
# File 'lib/codeminer/sexp_processor.rb', line 9 def initialize(expressions, exp) @expressions = expressions @exp = exp end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args) ⇒ Object
TODO: kill this and delegate properly
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/codeminer/sexp_processor.rb', line 15 def method_missing(meth, *args) if @exp.respond_to?(meth) @exp.send(meth, *args) elsif @expressions.respond_to?(meth) @expressions.send(meth, *args) elsif @exp.exp.respond_to?(meth) @exp.exp.send(meth, *args) else super end end |
Instance Attribute Details
#exp ⇒ Object (readonly)
Returns the value of attribute exp.
7 8 9 |
# File 'lib/codeminer/sexp_processor.rb', line 7 def exp @exp end |
#file ⇒ Object (readonly)
Returns the value of attribute file.
7 8 9 |
# File 'lib/codeminer/sexp_processor.rb', line 7 def file @file end |
Instance Method Details
#==(other) ⇒ Object
49 50 51 |
# File 'lib/codeminer/sexp_processor.rb', line 49 def ==(other) @expressions == other end |
#each ⇒ Object
31 32 33 |
# File 'lib/codeminer/sexp_processor.rb', line 31 def each @exp.each end |
#inspect ⇒ Object Also known as: to_s
43 44 45 |
# File 'lib/codeminer/sexp_processor.rb', line 43 def inspect "s(#{to_a.map(&:inspect).join(', ')})" end |
#length ⇒ Object
35 36 37 |
# File 'lib/codeminer/sexp_processor.rb', line 35 def length @expressions.length end |
#src_extract ⇒ Object
27 28 29 |
# File 'lib/codeminer/sexp_processor.rb', line 27 def src_extract @exp.src_extract end |
#to_a ⇒ Object
39 40 41 |
# File 'lib/codeminer/sexp_processor.rb', line 39 def to_a @expressions end |