Class: Reek::ObjectSource
Overview
:nodoc:
Class Method Summary collapse
-
.unify(sexp) ⇒ Object
:nodoc:.
Instance Method Summary collapse
Methods inherited from Source
from_f, from_io, from_object, from_path, from_pathlist, from_s, #full_report, #has_smell?, #initialize, #report, #smelly?, #to_s, #to_source
Constructor Details
This class inherits a constructor from Reek::Source
Class Method Details
.unify(sexp) ⇒ Object
:nodoc:
15 16 17 18 19 20 21 |
# File 'lib/reek/object_source.rb', line 15 def self.unify(sexp) # :nodoc: unifier = Unifier.new unifier.processors.each do |proc| proc.unsupported.delete :cfunc # HACK end return unifier.process(sexp[0]) end |
Instance Method Details
#can_parse_objects? ⇒ Boolean
23 24 25 26 27 28 29 30 31 |
# File 'lib/reek/object_source.rb', line 23 def can_parse_objects? return true if Object.const_defined?(:ParseTree) begin require 'parse_tree' true rescue LoadError false end end |
#generate_syntax_tree ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/reek/object_source.rb', line 33 def generate_syntax_tree if can_parse_objects? ObjectSource.unify(ParseTree.new.parse_tree(@source)) else throw ArgumentError.new('You must install the ParseTree gem to use this feature') end end |