Class: Docset::Base
- Inherits:
-
Object
- Object
- Docset::Base
- Defined in:
- lib/docset/base.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #add_content(from, to = '') ⇒ Object
- #add_document(from, to = '') ⇒ Object
- #add_index(name, type, path) ⇒ Object
- #add_plist(plist) ⇒ Object
-
#initialize(path) ⇒ Base
constructor
A new instance of Base.
- #write_content(to, content) ⇒ Object
- #write_document(to, document) ⇒ Object
Constructor Details
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
5 6 7 |
# File 'lib/docset/base.rb', line 5 def path @path end |
Instance Method Details
#add_content(from, to = '') ⇒ Object
14 15 16 17 18 |
# File 'lib/docset/base.rb', line 14 def add_content(from, to = '') dest_path = File.join(contents_path, to) FileUtils.mkdir_p(File.dirname(dest_path)) FileUtils.cp_r(from, dest_path) end |
#add_document(from, to = '') ⇒ Object
20 21 22 23 24 |
# File 'lib/docset/base.rb', line 20 def add_document(from, to = '') dest_path = File.join(documents_path, to) FileUtils.mkdir_p(File.dirname(dest_path)) FileUtils.cp_r(from, dest_path) end |
#add_index(name, type, path) ⇒ Object
26 27 28 |
# File 'lib/docset/base.rb', line 26 def add_index(name, type, path) @db.add_index(name, type, path) end |
#add_plist(plist) ⇒ Object
30 31 32 |
# File 'lib/docset/base.rb', line 30 def add_plist(plist) File.write(plist_path, plist.to_s) end |
#write_content(to, content) ⇒ Object
34 35 36 37 38 |
# File 'lib/docset/base.rb', line 34 def write_content(to, content) dest_path = File.join(contents_path, to) FileUtils.mkdir_p(File.dirname(dest_path)) File.write(dest_path, content) end |
#write_document(to, document) ⇒ Object
40 41 42 43 44 |
# File 'lib/docset/base.rb', line 40 def write_document(to, document) dest_path = File.join(documents_path, to) FileUtils.mkdir_p(File.dirname(dest_path)) File.write(dest_path, document) end |