Class: Wtf::Doc

Inherits:
Object
  • Object
show all
Defined in:
lib/wtf/doc.rb

Class Method Summary collapse

Class Method Details

.cleanObject



19
20
21
22
23
24
25
26
# File 'lib/wtf/doc.rb', line 19

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

.contentObject Also known as: read_documentation



36
37
38
39
40
41
42
43
# File 'lib/wtf/doc.rb', line 36

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

.current_pathObject



5
6
7
# File 'lib/wtf/doc.rb', line 5

def current_path
  Dir.pwd
end

.has_documentation?Boolean Also known as: is_documented?

Returns:

  • (Boolean)


9
10
11
# File 'lib/wtf/doc.rb', line 9

def has_documentation?
  File.exist?(wtf_file)
end

.not_documentedObject



28
29
30
# File 'lib/wtf/doc.rb', line 28

def not_documented
  "This folder is not documented yet."
end

.write(data) ⇒ Object



32
33
34
# File 'lib/wtf/doc.rb', line 32

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

.wtf_fileObject



15
16
17
# File 'lib/wtf/doc.rb', line 15

def wtf_file
  current_path + '/.wtf'
end