lib/yard-contracts/contract_handler.rb in yard-contracts-0.1.2 vs lib/yard-contracts/contract_handler.rb in yard-contracts-0.1.3

- old
+ new

@@ -2,11 +2,11 @@ # a Ripper regression in the standard library! Very annoying. # To use YARD you must downgrade to 2.1 temporarily until 2.2 is patched. # https://github.com/lsegal/yard/issues/825 require 'yard' -#require 'contracts/formatters' +# require 'contracts/formatters' require 'contracts/builtin_contracts' require 'yard-contracts/formatters' # Run the plugin handler by supplying it to yard with the --plugin flag # @@ -34,10 +34,10 @@ break node if node.line > contract_last_line && node.def? end ## Hacky way to test for class methods ## TODO: What about module methods? Probably broken. - scope = def_method_ast.source.match(/ self\./) ? :class : :instance + scope = def_method_ast.source.match(/def +self\./) ? :class : :instance name = def_method_ast.method_name true params = def_method_ast.parameters # YARD::Parser::Ruby::ParameterNode contracts = statement.parameters # YARD::Parser::Ruby::AstNode ret = Contracts::Formatters::ParamContracts.new(params, contracts).return