Class: Cucumber::Glue::Hook

Inherits:
Object
  • Object
show all
Defined in:
lib/cucumber/glue/hook.rb

Overview

TODO: Kill pointless wrapper for Before, After and AfterStep hooks with fire

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(registry, tag_expressions, proc) ⇒ Hook



11
12
13
14
15
16
17
# File 'lib/cucumber/glue/hook.rb', line 11

def initialize(registry, tag_expressions, proc)
  @registry = registry
  @tag_expressions = tag_expressions
  @proc = proc
  @location = Cucumber::Core::Ast::Location.from_source_location(*@proc.source_location)
  warn_for_old_style_tag_expressions(tag_expressions)
end

Instance Attribute Details

#locationObject (readonly)

Returns the value of attribute location



9
10
11
# File 'lib/cucumber/glue/hook.rb', line 9

def location
  @location
end

#tag_expressionsObject (readonly)

Returns the value of attribute tag_expressions



9
10
11
# File 'lib/cucumber/glue/hook.rb', line 9

def tag_expressions
  @tag_expressions
end

Instance Method Details

#invoke(pseudo_method, arguments, &block) ⇒ Object



19
20
21
22
23
24
25
26
27
28
# File 'lib/cucumber/glue/hook.rb', line 19

def invoke(pseudo_method, arguments, &block)
  check_arity = false
  InvokeInWorld.cucumber_instance_exec_in(
    @registry.current_world,
    check_arity,
    pseudo_method,
    *[arguments, block].flatten.compact,
    &@proc
  )
end