Class: YARD::Handlers::Ruby::Legacy::StepTransformHandler

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

Constant Summary collapse

STEP_TRANSFORM_MATCH =
/^(Transform\s*(\/.+\/)\s+do(?:\s*\|.+\|)?\s*)$/
@@unique_name =
0

Instance Method Summary collapse

Instance Method Details

#processObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/yard/handlers/legacy/step_transform_handler.rb', line 7

def process
  transform = statement.tokens.to_s[STEP_TRANSFORM_MATCH,2]
  @@unique_name = @@unique_name + 1

  instance = StepTransformObject.new(YARD::CodeObjects::Cucumber::CUCUMBER_STEPTRANSFORM_NAMESPACE, "transform_#{@@unique_name}") do |o|
    o.source = "Transform #{transform} do #{statement.block.to_s}\nend"
    o.value = transform
    o.keyword = "Transform"
  end

  obj = register instance
  parse_block :owner => obj

rescue YARD::Handlers::NamespaceMissingError
end