Class: Reek::ObjectSource
- Inherits:
-
Source
show all
- Defined in:
- lib/reek/adapters/object_source.rb
Overview
Instance Attribute Summary
Attributes inherited from Source
#desc
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Source
#initialize
Constructor Details
This class inherits a constructor from Reek::Source
Class Method Details
.can_parse_objects? ⇒ Boolean
21
22
23
24
25
26
27
28
29
|
# File 'lib/reek/adapters/object_source.rb', line 21
def self.can_parse_objects?
return true if Object.const_defined?(:ParseTree)
begin
require 'parse_tree'
true
rescue LoadError
false
end
end
|
.unify(sexp) ⇒ Object
7
8
9
10
11
12
13
|
# File 'lib/reek/adapters/object_source.rb', line 7
def self.unify(sexp) unifier = Unifier.new
unifier.processors.each do |proc|
proc.unsupported.delete :cfunc end
return unifier.process(sexp[0])
end
|
Instance Method Details
15
16
17
18
19
|
# File 'lib/reek/adapters/object_source.rb', line 15
def configure(sniffer)
super
disabled_config = {Reek::SmellConfiguration::ENABLED_KEY => false}
sniffer.configure(LargeClass, disabled_config)
end
|
#syntax_tree ⇒ Object
31
32
33
34
35
36
37
|
# File 'lib/reek/adapters/object_source.rb', line 31
def syntax_tree
if ObjectSource.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
|