Class: Hookit::Resource::Template
- Defined in:
- lib/hookit/resource/template.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(name) ⇒ Template
constructor
A new instance of Template.
- #run(action) ⇒ Object
Methods inherited from Base
#action, actions, #can_run?, default_action, #default_action, field, #not_if, #only_if
Constructor Details
#initialize(name) ⇒ Template
Returns a new instance of Template.
21 22 23 24 25 |
# File 'lib/hookit/resource/template.rb', line 21 def initialize(name) path name unless path source "#{::File.basename(name)}.erb" super end |
Instance Method Details
#run(action) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/hookit/resource/template.rb', line 27 def run(action) case action when :create create! chown! chmod! when :create_if_missing create_if_missing! chown! chmod! when :delete delete! when :touch touch! end end |