Class: Ehpt::CreateStories

Inherits:
Base
  • Object
show all
Defined in:
lib/ehpt/create_stories.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#data, #errors, #warnings

Instance Method Summary collapse

Methods inherited from Base

#add_error, #add_warning, call, #error?, #success?, #warning?

Constructor Details

#initialize(csv_file) ⇒ CreateStories

Returns a new instance of CreateStories.



5
6
7
8
# File 'lib/ehpt/create_stories.rb', line 5

def initialize(csv_file)
  @csv_file = csv_file
  super
end

Instance Attribute Details

#csv_fileObject (readonly)

Returns the value of attribute csv_file.



3
4
5
# File 'lib/ehpt/create_stories.rb', line 3

def csv_file
  @csv_file
end

Instance Method Details

#callObject



10
11
12
13
14
15
# File 'lib/ehpt/create_stories.rb', line 10

def call
  validate_csv_file!
  create_stories unless error?
rescue StandardError => e
  add_error(e.message)
end