Class: AppArchetype::Template::OutputFile
- Inherits:
-
Object
- Object
- AppArchetype::Template::OutputFile
- Defined in:
- lib/app_archetype/template/plan.rb
Overview
OutputFile represents a plan action, in other words holds a reference to a source file, and what the output is likely to be
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#source_file_path ⇒ Object
readonly
Returns the value of attribute source_file_path.
Instance Method Summary collapse
-
#exist? ⇒ Boolean
Evaluates whether the source file actually exists.
-
#initialize(source_file_path, path) ⇒ OutputFile
constructor
Creates an output file.
-
#source_directory? ⇒ Boolean
Evaluates whether the source file is a directory.
-
#source_erb? ⇒ Boolean
Evaluates whether the source file is a erb template.
-
#source_file? ⇒ Boolean
Evaluates whether the source file is a file as opposed to being a directory.
-
#source_hbs? ⇒ Boolean
Evaluates whether the source file is a handlebars template.
-
#source_template? ⇒ Boolean
Evaluates whether the source file is a template.
Constructor Details
#initialize(source_file_path, path) ⇒ OutputFile
Creates an output file
120 121 122 123 |
# File 'lib/app_archetype/template/plan.rb', line 120 def initialize(source_file_path, path) @source_file_path = source_file_path @path = path end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
112 113 114 |
# File 'lib/app_archetype/template/plan.rb', line 112 def path @path end |
#source_file_path ⇒ Object (readonly)
Returns the value of attribute source_file_path.
112 113 114 |
# File 'lib/app_archetype/template/plan.rb', line 112 def source_file_path @source_file_path end |
Instance Method Details
#exist? ⇒ Boolean
Evaluates whether the source file actually exists
179 180 181 |
# File 'lib/app_archetype/template/plan.rb', line 179 def exist? File.exist?(@path) end |
#source_directory? ⇒ Boolean
Evaluates whether the source file is a directory
130 131 132 |
# File 'lib/app_archetype/template/plan.rb', line 130 def source_directory? File.directory?(@source_file_path) end |
#source_erb? ⇒ Boolean
Evaluates whether the source file is a erb template
139 140 141 |
# File 'lib/app_archetype/template/plan.rb', line 139 def source_erb? File.extname(@source_file_path) == '.erb' end |
#source_file? ⇒ Boolean
Evaluates whether the source file is a file as opposed to being a directory.
170 171 172 |
# File 'lib/app_archetype/template/plan.rb', line 170 def source_file? File.file?(@source_file_path) end |
#source_hbs? ⇒ Boolean
Evaluates whether the source file is a handlebars template
148 149 150 |
# File 'lib/app_archetype/template/plan.rb', line 148 def source_hbs? File.extname(@source_file_path) == '.hbs' end |
#source_template? ⇒ Boolean
Evaluates whether the source file is a template.
This is for cases where one wants to render a hbs or erb file without processing as a template file.
160 161 162 |
# File 'lib/app_archetype/template/plan.rb', line 160 def source_template? File.extname(@source_file_path) == '.template' end |