Sha256: 451054b61957c6b2a18b9df88d2ccea69bca1523116bca206dd4241b87e79271

Contents?: true

Size: 458 Bytes

Versions: 9

Compression:

Stored size: 458 Bytes

Contents

class FillIN::Factory

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

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

  def call
    if !@value.nil? && @value[':']
      step = FillIN::ComplexInput
    elsif @label =~ TAG
      @label = $1
      tag = $2
      step = Pickles.config.step_by_tag(tag) || FillIN::Input
    else
      step = FillIN::Input
    end

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

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
pickles-0.1.8 lib/cucumber/pickles/steps/fill_in/factory.rb
pickles-0.1.7 lib/cucumber/pickles/steps/fill_in/factory.rb
pickles-0.1.6 lib/cucumber/pickles/steps/fill_in/factory.rb
pickles-0.1.5 lib/cucumber/pickles/steps/fill_in/factory.rb
pickles-0.1.4 lib/cucumber/pickles/steps/fill_in/factory.rb
pickles-0.1.3 lib/cucumber/pickles/steps/fill_in/factory.rb
pickles-0.1.2 lib/cucumber/pickles/steps/fill_in/factory.rb
pickles-0.1.1 lib/cucumber/pickles/steps/fill_in/factory.rb
pickles-0.1.0 lib/cucumber/pickles/steps/fill_in/factory.rb