Class: YARD::Handlers::Ruby::StepDefinitionHandler

Inherits:
Base
  • Object
show all
Defined in:
lib/yard/handlers/step_definition_handler.rb

Overview

Finds and processes all the step definitions defined in the ruby source

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.generate_unique_idObject



52
53
54
# File 'lib/yard/handlers/step_definition_handler.rb', line 52

def self.generate_unique_id
  @step_definition_count = @step_definition_count.to_i + 1
end

Instance Method Details

#pending_command_statement?(line) ⇒ Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/yard/handlers/step_definition_handler.rb', line 35

def pending_command_statement?(line)
  (line.type == :command || line.type == :vcall) && line.first.source == pending_keyword
end

#pending_keywordObject



31
32
33
# File 'lib/yard/handlers/step_definition_handler.rb', line 31

def pending_keyword
  "skip"
end

#pending_keyword_used?(block) ⇒ Boolean

Returns:

  • (Boolean)


39
40
41
42
# File 'lib/yard/handlers/step_definition_handler.rb', line 39

def pending_keyword_used?(block)
  code_in_block = block.last
  code_in_block.find { |line| pending_command_statement?(line) }
end

#step_definition_nameObject



48
49
50
# File 'lib/yard/handlers/step_definition_handler.rb', line 48

def step_definition_name
  "step_definition#{self.class.generate_unique_id}"
end

#step_transform_namespaceObject



44
45
46
# File 'lib/yard/handlers/step_definition_handler.rb', line 44

def step_transform_namespace
  YARD::CodeObjects::Cucumber::CUCUMBER_STEPTRANSFORM_NAMESPACE
end