Class: Packnga::DocumentTask
- Inherits:
-
Object
- Object
- Packnga::DocumentTask
- Includes:
- Rake::DSL
- Defined in:
- lib/packnga/document-task.rb
Overview
This class creates tasks for document. They generate YARD document or references.
Instance Method Summary collapse
-
#base_dir=(dir) ⇒ Object
Sets base directory for documents.
-
#initialize(spec) {|_self| ... } ⇒ DocumentTask
constructor
Defines tasks to generate YARD documentation and to translate references.
-
#original_language=(language) ⇒ Object
Sets original language which you wrote document.
-
#reference {|@reference_task| ... } ⇒ Object
Runs block to tasks for references.
-
#translate_language=(language) ⇒ Object
Sets a translate language for document.
-
#translate_languages=(languages) ⇒ Object
Sets translate languages for document.
-
#yard {|@yard_task| ... } ⇒ Object
Runs block to task for YARD documentation.
Constructor Details
#initialize(spec) {|_self| ... } ⇒ DocumentTask
Defines tasks to generate YARD documentation and to translate references.
33 34 35 36 37 38 39 40 |
# File 'lib/packnga/document-task.rb', line 33 def initialize(spec) @spec = spec @yard_task = YARDTask.new(@spec) @reference_task = ReferenceTask.new(@spec) self.base_dir = "doc" yield(self) if block_given? define end |
Instance Method Details
#base_dir=(dir) ⇒ Object
Sets base directory for documents. Default value is “doc”.
44 45 46 47 48 |
# File 'lib/packnga/document-task.rb', line 44 def base_dir=(dir) dir = Pathname.new(dir) @yard_task.base_dir = dir @reference_task.base_dir = dir end |
#original_language=(language) ⇒ Object
Sets original language which you wrote document. Default value is “en” (as English). Specified value is used to define language for translation.
58 59 60 |
# File 'lib/packnga/document-task.rb', line 58 def original_language=(language) @reference_task.original_language = language end |
#reference {|@reference_task| ... } ⇒ Object
Runs block to tasks for references.
116 117 118 |
# File 'lib/packnga/document-task.rb', line 116 def reference yield(@reference_task) end |
#translate_language=(language) ⇒ Object
Sets a translate language for document. This method receives String as language code.
If the language specified by #original_language= isn’t English, its default value is one. Otherwise, it is not specified.
83 84 85 |
# File 'lib/packnga/document-task.rb', line 83 def translate_language=(language) self.translate_languages = [language] end |
#translate_languages=(languages) ⇒ Object
Sets translate languages for document. This method receives Array of Strings as each language code.
If the language specified by #original_language= isn’t English, its default value is one. Otherwise, it is not specified.
106 107 108 |
# File 'lib/packnga/document-task.rb', line 106 def translate_languages=(languages) @reference_task.translate_languages = languages end |
#yard {|@yard_task| ... } ⇒ Object
Runs block to task for YARD documentation.
111 112 113 |
# File 'lib/packnga/document-task.rb', line 111 def yard yield(@yard_task) end |