Class: Thor::Tree::File
- Includes:
- Actions
- Defined in:
- lib/thor/tree/file.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(args, options = {}, config = {}) ⇒ File
constructor
A new instance of File.
Constructor Details
#initialize(args, options = {}, config = {}) ⇒ File
Returns a new instance of File.
29 30 31 32 33 34 35 36 |
# File 'lib/thor/tree/file.rb', line 29 def initialize(args, = {}, config = {}) @_path = Path.new args[0].to_s @_filename = @_path.basename .merge! (args[1]) super self.destination_root = Writer.root_path File.template_variables.each { |key, value| instance_variable_set key, value } end |
Class Method Details
.===(args) ⇒ Object
7 8 9 10 |
# File 'lib/thor/tree/file.rb', line 7 def ===(args) args.is_a?(String) || args.is_a?(Hash) && !args.empty? && args.keys.first.start_with?(':') end |
.set_template_variable(key, value) ⇒ Object
12 13 14 15 |
# File 'lib/thor/tree/file.rb', line 12 def set_template_variable(key, value) @_template_variables ||= {} @_template_variables[key] = value end |
.template_variables ⇒ Object
17 18 19 |
# File 'lib/thor/tree/file.rb', line 17 def template_variables @_template_variables || {} end |