Class: Tdc::Generators::GenerationContext

Inherits:
Object
  • Object
show all
Defined in:
lib/tdc/generators/generation_context.rb

Overview

Knows all the parameters that define the context for generation.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(current_catalog:, data_definition:) ⇒ GenerationContext

Returns a new instance of GenerationContext.



11
12
13
14
15
# File 'lib/tdc/generators/generation_context.rb', line 11

def initialize(current_catalog:, data_definition:)
  @current_catalog = current_catalog
  @data_definition = data_definition
  @updating = false
end

Instance Attribute Details

#current_catalogObject (readonly)

Returns the value of attribute current_catalog.



9
10
11
# File 'lib/tdc/generators/generation_context.rb', line 9

def current_catalog
  @current_catalog
end

#data_definitionObject (readonly)

Returns the value of attribute data_definition.



9
10
11
# File 'lib/tdc/generators/generation_context.rb', line 9

def data_definition
  @data_definition
end

Instance Method Details

#updating?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/tdc/generators/generation_context.rb', line 17

def updating?
  @updating
end

#with_updatingObject



21
22
23
24
25
26
# File 'lib/tdc/generators/generation_context.rb', line 21

def with_updating
  @updating = true
  yield
ensure
  @updating = false
end