Sha256: e23076f08f24473a078d83524e8b91af9a6f476854eec941aecddc4087605380
Contents?: true
Size: 1 KB
Versions: 1
Compression:
Stored size: 1 KB
Contents
module YARD module RSpecExamples # Handler used to inspect the rspec describe call # used, to catch the class describe declarations and method declarations class RSpecDescribeHandler < YARD::Handlers::Ruby::Base handles method_call(:describe) def process param = statement.parameters.first subject = nil # A class is being declared if param.type == :var_ref && param.children.first.type == :const subject = param.children.first.source end # A class is being declared (with a nested name) if param.type == :const_path_ref subject = param.children.map { |i| i.source }.join("::") end # A method is being declared if param.type == :string_literal && param.source =~ /^"#/ subject = param.source.delete('"|\ ') end ParserTrace.path.push(subject.dup) if subject parse_block(statement.last.last) ParserTrace.path.pop if subject end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
yard-rspec_examples-0.0.1 | lib/yard/rspec_examples/describe_handler.rb |