Sha256: 13be99f3cb7b6311b59275df3b06a457c1859767053348910626e3d5f033a0e5

Contents?: true

Size: 788 Bytes

Versions: 2

Compression:

Stored size: 788 Bytes

Contents

# Copyright:: (c) Autotelik Media Ltd 2015
# Author ::   Tom Statter
# License::   MIT
#
# Details::  Base class for generators, which provide services to describe a Model in an external format
#
module DataShift

  class GeneratorBase

    include DataShift::Logging

    attr_accessor :configuration

    def initialize
    end

    # 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
    #
    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

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
datashift-0.40.1 lib/generators/generator_base.rb
datashift-0.40.0 lib/generators/generator_base.rb