Module: Stupidedi::Schema::Generation::Support

Overview

Shared helpers mixed into every generator.

The host class must provide a private #release_code returning the 6-character release string (e.g. "005010") and may set @namespace, the root Ruby module for the emitted code (defaults to "Edi").

Instance Method Summary collapse

Instance Method Details

#namespaceObject

Root module for generated constants, e.g. "Edi". Consumers override this to emit into their own namespace. Validated (and memoized) on first use so an invalid namespace fails before any code is emitted.



15
16
17
# File 'lib/stupidedi/schema/generation/support.rb', line 15

def namespace
  @validated_namespace ||= Generation.validate_namespace!(@namespace || "Edi")
end

#namespace_pathObject

Filesystem/require-path root derived from the namespace ("Edi" -> "edi").



20
21
22
# File 'lib/stupidedi/schema/generation/support.rb', line 20

def namespace_path
  underscore(namespace)
end