Class: CheckIn::Factory

Inherits:
Object
  • Object
show all
Defined in:
lib/cucumber/pickles/steps/check_in/factory.rb

Constant Summary collapse

TAG =
/^(.+\S+)?\s*\((.*)\)$/

Instance Method Summary collapse

Constructor Details

#initialize(label, value, within: nil) ⇒ Factory

Returns a new instance of Factory.



5
6
7
8
9
# File 'lib/cucumber/pickles/steps/check_in/factory.rb', line 5

def initialize(label, value, within: nil)
  @label = label
  @value = value
  @within = within
end

Instance Method Details

#callObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/cucumber/pickles/steps/check_in/factory.rb', line 11

def call
  if in_quotes?
    remove_quotes!
  end

  if !@value.nil? && @value[':'] && !in_quotes?
    step = CheckIn::ComplexInput
    # return if text_complex_input(label, value, within)
  elsif @label =~ TAG
    @label = $1
    tag    = $2
    step   = Pickles.config.check_step_by_tag(tag) || CheckIn::Input
  else
    step = CheckIn::Input
  end

  step.new(@label, @value, @within)
end