lib/pelusa/lint/demeter_law.rb in pelusa-0.1.1 vs lib/pelusa/lint/demeter_law.rb in pelusa-0.2.0

- old
+ new

@@ -23,13 +23,19 @@ end def iterate_lines!(klass) iterator = Iterator.new do |node| if node.is_a?(Rubinius::AST::Send) && node.receiver.is_a?(Rubinius::AST::Send) - @violations << node.line + @violations << node.line unless white_listed?(node.receiver.name) end end Array(klass).each(&iterator) + end + + def white_listed? method + [Class, Fixnum, Enumerable].any? do |enclosing_module| + enclosing_module.instance_methods.any? {|instance_method| instance_method == method } + end end end end end