Class: Thor::Actions::CreateFile
- Defined in:
- lib/thor/actions/create_file.rb
Overview
AddFile is a subset of Template, which instead of rendering a file with ERB, it gets the content from the user.
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
:nodoc:.
Attributes inherited from Templater
#base, #destination, #given_destination, #relative_destination, #source
Instance Method Summary collapse
-
#initialize(base, destination, data, log_status) ⇒ CreateFile
constructor
A new instance of CreateFile.
- #render ⇒ Object
Methods inherited from Templater
#exists?, #identical?, #invoke!, #revoke!
Constructor Details
#initialize(base, destination, data, log_status) ⇒ CreateFile
Returns a new instance of CreateFile.
34 35 36 37 |
# File 'lib/thor/actions/create_file.rb', line 34 def initialize(base, destination, data, log_status) super(base, nil, destination, log_status) @data = data end |
Instance Attribute Details
#data ⇒ Object (readonly)
:nodoc:
32 33 34 |
# File 'lib/thor/actions/create_file.rb', line 32 def data @data end |
Instance Method Details
#render ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/thor/actions/create_file.rb', line 39 def render @render ||= if data.is_a?(Proc) data.call else data end end |