class MxxRu::Generators::BinaryUnittest::TemplateParams
Class to be used in ERb template generation.
Usage:
template_params = TemplateParams.new( target_type, options ) template = ERb.new( IO.read( some_template_file ) ) result = template.generate( template.get_binding )
Constants
- DEFAULT_UNITTEST_PROJECT
For a case when output_file is undetectable.
- YOUR_PROJECT_PATH
For a case when project_path is undetectable.
Attributes
path_name[R]
Path name.
unittest_project[R]
Name of unit test project file.
Public Class Methods
new( options )
click to toggle source
Param target_type must be present in @@setup_target_functions.
# File lib/mxx_ru/generators/bin-unittest/g.rb, line 103 def initialize( options ) @path_name = try_detect_path_name( options ) @unittest_project = try_detect_unittest_project( options ) end
Public Instance Methods
get_binding()
click to toggle source
Returns binding to use in ERb generation.
# File lib/mxx_ru/generators/bin-unittest/g.rb, line 109 def get_binding binding end
Private Instance Methods
try_detect_path_name( options )
click to toggle source
Try to setup name of path_name
from options.
If project_path specified target name is gotten from it. Otherwise if –output-file specified then name is constructed from it. Otherwise value 'your project path' is used.
# File lib/mxx_ru/generators/bin-unittest/g.rb, line 120 def try_detect_path_name( options ) if options.project_path options.project_path elsif options.output_file File.dirname( options.output_file ) else YOUR_PROJECT_PATH end end
try_detect_unittest_project( options )
click to toggle source
Try to setup name of unit test project file from options.
If –output-file specified then its value used. Otherwise value 'prj.ut.rb' is used.
# File lib/mxx_ru/generators/bin-unittest/g.rb, line 135 def try_detect_unittest_project( options ) options.output_file ? File.basename( options.output_file ) : DEFAULT_UNITTEST_PROJECT end