Sha256: fc89aaebf2586e2c510068776d33c562e49b5d2fbec6bdae50b555ca6c7b0aaf

Contents?: true

Size: 797 Bytes

Versions: 1

Compression:

Stored size: 797 Bytes

Contents

require 'mayday/reader'
require 'colored'

module Mayday
  class UserDefinitions

    def initialize(mayday_file_path)
      @mayday_file_path = mayday_file_path
    end

    def up
      mayday_file do |file|
        Reader.new(file).to_target_integrator.integrate
      end
    end

    def down
      mayday_file do |file|
        Reader.new(file).to_target_integrator.deintegrate
      end
    end

    def benchmark
      mayday_file do |file|
        Reader.new(file).to_target_integrator.benchmark
      end
    end

    def mayday_file
      unless File.exist?(@mayday_file_path)
        puts "No file found at path ./#{@mayday_file_path}".red
        abort
      end

      file = File.open(@mayday_file_path)
      yield file
      file.close
    end
    private :mayday_file

  end 
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mayday-0.0.1 lib/mayday/user_definitions.rb