Class: Slurper::Engine
- Inherits:
-
Struct
- Object
- Struct
- Slurper::Engine
- Defined in:
- lib/slurper/engine.rb
Instance Attribute Summary collapse
-
#story_file ⇒ Object
Returns the value of attribute story_file.
Instance Method Summary collapse
Instance Attribute Details
#story_file ⇒ Object
Returns the value of attribute story_file
2 3 4 |
# File 'lib/slurper/engine.rb', line 2 def story_file @story_file end |
Instance Method Details
#process ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/slurper/engine.rb', line 8 def process puts "Validating story content" stories.each(&:valid?) puts "Preparing to slurp #{stories.size} stories into Tracker..." stories.each_with_index do |story, index| if story.save puts "#{index+1}. #{story.name}" else puts "Slurp failed. #{story.error_message}" end end end |
#stories ⇒ Object
4 5 6 |
# File 'lib/slurper/engine.rb', line 4 def stories @stories ||= YAML.load(yamlize_story_file).map { |attrs| Slurper::Story.new(attrs) } end |