Sha256: f0402d3da32712016ea8cadce251f8ee8bec7b2dd370d4baa695b75315c55800

Contents?: true

Size: 586 Bytes

Versions: 6

Compression:

Stored size: 586 Bytes

Contents

module Rambo
  module RSpec
    class HelperFile
      def initialize(template_path:, file_path:)
        @template_path = template_path
        @file_path     = file_path
      end

      def generate
        write_to_file(template) unless file_already_exists?
      end

      private

      attr_reader :template_path, :file_path

      def file_already_exists?
        File.exist?(file_path)
      end

      def write_to_file(template)
        File.write(file_path, template)
      end

      def template
        @template ||= File.read(template_path)
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rambo_ruby-0.3.0 lib/rambo/rspec/helper_file.rb
rambo_ruby-0.2.3 lib/rambo/rspec/helper_file.rb
rambo_ruby-0.2.2 lib/rambo/rspec/helper_file.rb
rambo_ruby-0.2.1 lib/rambo/rspec/helper_file.rb
rambo_ruby-0.2.0 lib/rambo/rspec/helper_file.rb
rambo_ruby-0.1.0 lib/rspec/helper_file.rb