Class: GreenPepper::ImportExampleFactory
- Inherits:
-
ExampleFactory
- Object
- ExampleFactory
- GreenPepper::ImportExampleFactory
- Defined in:
- lib/greenpepper/factory/importexamplefactory.rb
Instance Method Summary collapse
Methods inherited from ExampleFactory
Instance Method Details
#create_example(table) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/greenpepper/factory/importexamplefactory.rb', line 15 def create_example(table) return nil unless support? table text_regex = /\A\s*([^\s]*)\s*\Z/ example = ImportExample.new table[1..-1].each do |row| text_regex === row[0] example.add $1 end return example end |
#support?(table) ⇒ Boolean
11 12 13 |
# File 'lib/greenpepper/factory/importexamplefactory.rb', line 11 def support?(table) /^\s*import\s*$/i === table[0][0] end |