class MxxRu::Generators::ExtCMakeProject::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_PROJECT_NAME

For a case when output_file is undetectable.

UNKNOWN_CMAKELISTS_LOCATION

For a case when project_path is undetectable.

Attributes

project[R]
where[R]

Public Class Methods

new( options ) click to toggle source

Param target_type must be present in @@setup_target_functions.

# File lib/mxx_ru/generators/ext-cmake-prj/g.rb, line 101
def initialize( options )
  @where = try_detect_where( options )
  @project = try_detect_project( options )
end

Public Instance Methods

get_binding() click to toggle source

Returns binding to use in ERb generation.

# File lib/mxx_ru/generators/ext-cmake-prj/g.rb, line 107
def get_binding
  binding
end

Private Instance Methods

try_detect_project( options ) click to toggle source
# File lib/mxx_ru/generators/ext-cmake-prj/g.rb, line 116
def try_detect_project( options )
  options.output_file ?
      File.basename( options.output_file ) :
      DEFAULT_PROJECT_NAME
end
try_detect_where( options ) click to toggle source
# File lib/mxx_ru/generators/ext-cmake-prj/g.rb, line 112
def try_detect_where( options )
  options.where ? options.where : UNKNOWN_CMAKELISTS_LOCATION
end