~ubuntu-branches/ubuntu/wily/cucumber/wily-proposed

« back to all changes in this revision

Viewing changes to lib/cucumber/ast/multiline_argument.rb

  • Committer: Package Import Robot
  • Author(s): Cédric Boutillier, Antonio Terceiro, Cédric Boutillier
  • Date: 2015-06-20 16:52:32 UTC
  • mfrom: (1.1.7)
  • Revision ID: package-import@ubuntu.com-20150620165232-hznc8mxma08er27p
Tags: 2.0.0-1
[ Antonio Terceiro ]
* debian/cucumber.pod: fix typo in manpage (Closes: #767215)

[ Cédric Boutillier ]
* Imported Upstream version 2.0.0
* rename the file in debian/missing-source to remove -min suffix, and make
  lintian happy
* reproducibility: use last changelog date to build the manpage
* update 0004-Update_default_binary_path.patch
* drop 0001-Remove-rubygems-bundler-stuff-from-spec_helper.patch, not needed
  anymore
* build-depend on pry
* depend on ruby-cucumber-core

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
require 'gherkin/rubify'
2
 
 
3
 
module Cucumber
4
 
  module Ast
5
 
    module MultilineArgument
6
 
 
7
 
      class << self
8
 
        include Gherkin::Rubify
9
 
 
10
 
        def from(argument)
11
 
          return unless argument
12
 
          return argument if argument.respond_to?(:to_step_definition_arg)
13
 
 
14
 
          case(rubify(argument))
15
 
          when String
16
 
            # TODO: this duplicates work that gherkin does. We should really pass the string to gherkin and let it parse it.
17
 
            Ast::DocString.new(argument, '')
18
 
          when Gherkin::Formatter::Model::DocString
19
 
            Ast::DocString.new(argument.value, argument.content_type)
20
 
          when Array
21
 
            Ast::Table.new(argument.map{|row| row.cells})
22
 
          else
23
 
            raise ArgumentError, "Don't know how to convert #{argument} into a MultilineArgument"
24
 
          end
25
 
        end
26
 
 
27
 
      end
28
 
    end
29
 
  end
30
 
end