Sha256: 577e7cb822297cd2b747ce794708d864daa68109aad729f3ae0e5d8b442e6bb7
Contents?: true
Size: 789 Bytes
Versions: 1
Compression:
Stored size: 789 Bytes
Contents
module Slurper class Engine < Struct.new(:story_file) def stories @stories ||= YAML.load(yamlize_story_file).map { |attrs| Slurper::Story.new(attrs) } end 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 protected def yamlize_story_file IO.read(story_file). gsub(/^/, " "). gsub(/ ==.*/, "-").# !ruby/object:Slurper::Story\n attributes:"). gsub(/ description:$/, " description: |") end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
slurper-2.0.0 | lib/slurper/engine.rb |