class MxxRu::Generators::Externals::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_FILE

For a case when output_file is undetectable.

Attributes

externals_file[R]

Name of externals file

Public Class Methods

new( options ) click to toggle source
# File lib/mxx_ru/generators/externals/g.rb, line 92
def initialize( options )
  @externals_file = try_detect_externals_file( options )
end

Public Instance Methods

get_binding() click to toggle source

Returns binding to use in ERb generation.

# File lib/mxx_ru/generators/externals/g.rb, line 97
def get_binding
  binding
end

Private Instance Methods

try_detect_externals_file( options ) click to toggle source

Try to setup name of externals file.

If –output-file specified then its value used. Otherwise value 'externals.rb' is used.

# File lib/mxx_ru/generators/externals/g.rb, line 107
def try_detect_externals_file( options )
  options.output_file ?
      File.basename( options.output_file ) :
      DEFAULT_FILE
end