Class: YARD::Handlers::Ruby::StepDefinitionHandler
- Inherits:
-
Base
- Object
- Base
- YARD::Handlers::Ruby::StepDefinitionHandler
- Defined in:
- lib/yard/handlers/step_definition_handler.rb
Constant Summary collapse
- @@unique_name =
0
Instance Method Summary collapse
-
#find_steps_defined_in_block(block) ⇒ Object
Step Definitions can contain defined steps within them.
Instance Method Details
#find_steps_defined_in_block(block) ⇒ Object
Step Definitions can contain defined steps within them. While it is likely that they could not very easily be parsed because of variables that are only calculated at runtime, it would be nice to at least list those in use within a step definition and if you can find a match, go ahead and make it
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/yard/handlers/step_definition_handler.rb', line 28 def find_steps_defined_in_block(block) #log.debug "#{block} #{block.class}" block.each_with_index do |token,index| #log.debug "Token #{token.class} #{token.text}" if token.is_a?(YARD::Parser::Ruby::Legacy::RubyToken::TkCONSTANT) && token.text =~ /^(given|when|then|and)$/i && block[index + 2].is_a?(YARD::Parser::Ruby::Legacy::RubyToken::TkSTRING) log.debug "Step found in Step Definition: #{block[index + 2].text} " end end end |