Class: DataShift::GeneratorBase

Inherits:
Object
  • Object
show all
Includes:
Logging
Defined in:
lib/generators/generator_base.rb

Direct Known Subclasses

ConfigGenerator, CsvGenerator, ExcelGenerator

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Logging

#logdir, #logdir=, #logger, #verbose

Constructor Details

#initializeGeneratorBase

Returns a new instance of GeneratorBase.



15
16
# File 'lib/generators/generator_base.rb', line 15

def initialize
end

Instance Attribute Details

#configurationObject

Returns the value of attribute configuration.



13
14
15
# File 'lib/generators/generator_base.rb', line 13

def configuration
  @configuration
end

Instance Method Details

#generate_with_associations(file_name, klass) ⇒ Object

Prepare to generate with associations but then calls a **derived generate** method i.e abstract to this base class

file_name => Filename for generated template



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/generators/generator_base.rb', line 23

def generate_with_associations(file_name, klass)

  state = DataShift::Configuration.call.with

  DataShift::Configuration.call.with = :all

  generate(file_name, klass)
ensure
  DataShift::Configuration.call.with = state

end