Module: Ravioli

Defined in:
lib/ravioli.rb,
lib/ravioli/builder.rb,
lib/ravioli/railtie.rb,
lib/ravioli/version.rb,
lib/ravioli/configuration.rb,
lib/ravioli/staging_inquirer.rb

Overview

The root namespace for all of Ravioli, and owner of two handly configuration-related class methods

Defined Under Namespace

Modules: RailsConfig, StagingInquirer Classes: BuildError, Builder, Configuration, KeyMissingError, ParseError, Railtie

Constant Summary collapse

VERSION =
"0.2.6"

Class Method Summary collapse

Class Method Details

.build(namespace: nil, class_name: "Configuration", strict: false) {|builder| ... } ⇒ Object

Forwards arguments to a Builder. See Ravioli::Builder#new for complete documentation.

Parameters:

  • namespace (String, Module, Class) (defaults to: nil)

    the name of, or a direct reference to, the module or class your Configuration class should namespace itself within

  • class_name (String) (defaults to: "Configuration")

    the name of the namespace’s Configuration class

  • strict (boolean) (defaults to: false)

    whether or not the Builder instance should throw errors when there are errors loading configuration files or encrypted credentials

Yields:

  • (builder)


20
21
22
23
24
25
26
27
28
29
# File 'lib/ravioli.rb', line 20

def build(namespace: nil, class_name: "Configuration", strict: false, &block)
  builder = Builder.new(
    class_name: class_name,
    hijack: true,
    namespace: namespace,
    strict: strict,
  )
  yield builder if block
  builder.build!
end

.configurationsObject

Returns a list of all of the configuration instances



32
33
34
# File 'lib/ravioli.rb', line 32

def configurations
  @configurations ||= []
end

.defaultObject

Returns the most-recently configured Ravioli instance that has been built with build.



37
38
39
# File 'lib/ravioli.rb', line 37

def default
  configurations.last
end