Class: OpenAPISourceTools::WriteTask
- Inherits:
-
Object
- Object
- OpenAPISourceTools::WriteTask
- Includes:
- TaskInterface
- Defined in:
- lib/openapi/sourcetools/task.rb
Overview
A task that provides contents to be written to a named file. Optionaly the file may be made executable.
Instance Attribute Summary collapse
-
#contents ⇒ Object
readonly
Returns the value of attribute contents.
-
#executable ⇒ Object
readonly
Returns the value of attribute executable.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #generate(_context_binding) ⇒ Object
-
#initialize(name, contents, executable = false) ⇒ WriteTask
constructor
A new instance of WriteTask.
- #output_name ⇒ Object
Methods included from TaskInterface
Constructor Details
#initialize(name, contents, executable = false) ⇒ WriteTask
Returns a new instance of WriteTask.
97 98 99 100 101 102 |
# File 'lib/openapi/sourcetools/task.rb', line 97 def initialize(name, contents, executable = false) raise ArgumentError, 'name and contents must be given' if name.nil? || contents.nil? @name = name @contents = contents @executable = executable end |
Instance Attribute Details
#contents ⇒ Object (readonly)
Returns the value of attribute contents.
95 96 97 |
# File 'lib/openapi/sourcetools/task.rb', line 95 def contents @contents end |
#executable ⇒ Object (readonly)
Returns the value of attribute executable.
95 96 97 |
# File 'lib/openapi/sourcetools/task.rb', line 95 def executable @executable end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
95 96 97 |
# File 'lib/openapi/sourcetools/task.rb', line 95 def name @name end |
Instance Method Details
#generate(_context_binding) ⇒ Object
104 105 106 |
# File 'lib/openapi/sourcetools/task.rb', line 104 def generate(_context_binding) @contents end |
#output_name ⇒ Object
108 109 110 |
# File 'lib/openapi/sourcetools/task.rb', line 108 def output_name @name end |