Sha256: c946dd11d230eb2d907f23dbc2987d72a5118604ef6f2cd767a29e6adb34ea56

Contents?: true

Size: 566 Bytes

Versions: 7

Compression:

Stored size: 566 Bytes

Contents

module Approvals

  class Dotfile
    class << self

      def reset
        File.delete(path) if File.exists?(path)
        touch
      end

      def path
        '.approvals'
      end

      def touch
        FileUtils.touch(path)
      end

      def append(text)
        unless includes?(text)
          write text
        end
      end

      def includes?(text)
        system("cat #{path} | grep -q \"^#{text}$\"")
      end

      def write(text)
        File.open(path, 'a+') do |f|
          f.write "#{text}\n"
        end
      end

    end
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
approvals-0.0.7 lib/approvals/utilities/dotfile.rb
approvals-0.0.6 lib/approvals/utilities/dotfile.rb
approvals-0.0.5 lib/approvals/utilities/dotfile.rb
approvals-0.0.4 lib/approvals/utilities/dotfile.rb
approvals-0.0.3 lib/approvals/utilities/dotfile.rb
approvals-0.0.2 lib/approvals/utilities/dotfile.rb
approvals-0.0.1 lib/approvals/utilities/dotfile.rb