Class: AppArchetype::Template::OutputFile

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initialize(source_file_path, path) ⇒ OutputFile

Creates an output file

Parameters:



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

#pathObject (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_pathObject (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

Returns:

  • (Boolean)


167
168
169
# File 'lib/app_archetype/template/plan.rb', line 167

def exist?
  File.exist?(@path)
end

#source_directory?Boolean

Evaluates whether the source file is a directory

Returns:

  • (Boolean)


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

Returns:

  • (Boolean)


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.

Returns:

  • (Boolean)


158
159
160
# File 'lib/app_archetype/template/plan.rb', line 158

def source_file?
  File.file?(@source_file_path)
end

#source_hbs?Boolean

Evaluates whether the source file is a handlebars template

Returns:

  • (Boolean)


148
149
150
# File 'lib/app_archetype/template/plan.rb', line 148

def source_hbs?
  File.extname(@source_file_path) == '.hbs'
end