Sha256: c91679e9e6f020f4af3845169dd469c469c88836b87fceeb6ab0831ef3573cfc

Contents?: true

Size: 817 Bytes

Versions: 1

Compression:

Stored size: 817 Bytes

Contents

module Wtf
  class Core
      
    def current_path
      Dir.pwd
    end

    def has_documentation?
      File.exist?(wtf_file)
    end

    alias :is_documented? :has_documentation?

    def wtf_file
      current_path + '/.wtf'
    end

    def clean
      if is_documented?
        File.delete(wtf_file)
        true
      else
        puts not_documented
        nil
      end
    end

    def not_documented
      "This folder is not documented yet. Add a documentation by running: \n\n wtf -c 'a description of the folder'"
    end

    def write(data)
      File.open(wtf_file, 'w') {|f| f.write(data) }
    end

    def content
      if is_documented?
        data = File.read(wtf_file)
        data
      else
        puts not_documented
      end
    end

    alias :read_documentation :content

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wtf-doc-0.1.2 lib/wtf/core.rb