Class: Wtf::Core
- Inherits:
-
Object
- Object
- Wtf::Core
- Defined in:
- lib/wtf/core.rb
Instance Method Summary collapse
- #clean ⇒ Object
- #content ⇒ Object (also: #read_documentation)
- #current_path ⇒ Object
- #has_documentation? ⇒ Boolean (also: #is_documented?)
- #not_documented ⇒ Object
- #write(data) ⇒ Object
- #wtf_file ⇒ Object
Instance Method Details
#clean ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/wtf/core.rb', line 18 def clean if is_documented? File.delete(wtf_file) true else puts not_documented nil end end |
#content ⇒ Object Also known as: read_documentation
36 37 38 39 40 41 42 43 |
# File 'lib/wtf/core.rb', line 36 def content if is_documented? data = File.read(wtf_file) data else puts not_documented end end |
#current_path ⇒ Object
4 5 6 |
# File 'lib/wtf/core.rb', line 4 def current_path Dir.pwd end |
#has_documentation? ⇒ Boolean Also known as: is_documented?
8 9 10 |
# File 'lib/wtf/core.rb', line 8 def has_documentation? File.exist?(wtf_file) end |
#not_documented ⇒ Object
28 29 30 |
# File 'lib/wtf/core.rb', line 28 def not_documented "This folder is not documented yet. Add a documentation by running: \n\n wtf doc -c 'a description of the folder'" end |
#write(data) ⇒ Object
32 33 34 |
# File 'lib/wtf/core.rb', line 32 def write(data) File.open(wtf_file, 'w') {|f| f.write(data) } end |
#wtf_file ⇒ Object
14 15 16 |
# File 'lib/wtf/core.rb', line 14 def wtf_file current_path + '/.wtf' end |