Class: GreenPepper::ImportExample
- Inherits:
-
Object
- Object
- GreenPepper::ImportExample
- Defined in:
- lib/greenpepper/example/importexample.rb
Constant Summary collapse
- FIRST_DATA_ROW =
1
- DATA_COLUMN =
0
Instance Attribute Summary collapse
-
#imports ⇒ Object
readonly
Returns the value of attribute imports.
Instance Method Summary collapse
- #add(*imports) ⇒ Object
- #execute ⇒ Object
-
#initialize ⇒ ImportExample
constructor
A new instance of ImportExample.
Constructor Details
#initialize ⇒ ImportExample
Returns a new instance of ImportExample.
16 17 18 |
# File 'lib/greenpepper/example/importexample.rb', line 16 def initialize @imports = Array.new end |
Instance Attribute Details
#imports ⇒ Object (readonly)
Returns the value of attribute imports.
11 12 13 |
# File 'lib/greenpepper/example/importexample.rb', line 11 def imports @imports end |
Instance Method Details
#add(*imports) ⇒ Object
20 21 22 |
# File 'lib/greenpepper/example/importexample.rb', line 20 def add(*imports) @imports.concat imports end |
#execute ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/greenpepper/example/importexample.rb', line 24 def execute results = HtmlTableExecutionResults.new @imports.each_with_index do |import, index| begin require import results.add index + FIRST_DATA_ROW, DATA_COLUMN, NoExampleResult.new rescue Exception => e e = e.exception "Failed to import #{import}: #{e.exception}" results.add index + FIRST_DATA_ROW, DATA_COLUMN, WriteExceptionExampleResult.new(e, true) end end results end |