class RSpecDescribeHandler
Handler used to inspect the rspec describe call used, to catch the class describe declarations and method declarations
Attributes
current_class[RW]
current_method[RW]
Public Class Methods
current_path()
click to toggle source
# File lib/yard-examples-from-rspec.rb, line 36 def current_path return "#{@current_class}##{@current_method}" end
Public Instance Methods
process()
click to toggle source
# File lib/yard-examples-from-rspec.rb, line 44 def process param = statement.parameters.first # A class is being declared if param.type == :var_ref && param.children.first.type == :const self.class.current_class = param.children.first.source end # A class is being declared (with a nested name) if param.type == :const_path_ref self.class.current_class = param.children.map{|i| i.source}.join("::") end # A method is being declared if param.type == :string_literal && param.source =~ /^"#/ self.class.current_method = param.source.delete('#|"|\ ') end parse_block(statement.last.last) end