Class: FigFig

Inherits:
Object
  • Object
show all
Defined in:
lib/fig_fig.rb,
lib/fig_fig/version.rb

Overview

Top level class of the FigTree gem

Defined Under Namespace

Classes: ConfigurationContainer

Constant Summary collapse

MissingConfigurationError =
Class.new StandardError
DuplicateParameterDefinitionError =
Class.new StandardError
CannotModifyLockedParameterError =
Class.new StandardError
InvalidLockOptionError =
Class.new StandardError
ConfigurationAlreadyDefinedError =
Class.new StandardError
VERSION =
"0.2.0"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configurationObject

Returns the value of attribute configuration.



10
11
12
# File 'lib/fig_fig.rb', line 10

def configuration
  @configuration
end

Class Method Details

.configure(reset: nil) {|configuration| ... } ⇒ Object

And we define a wrapper for the configuration block, that we’ll use to set up our set of options



14
15
16
17
18
19
20
21
# File 'lib/fig_fig.rb', line 14

def configure(reset: nil)
  self.reset if reset
  raise ConfigurationAlreadyDefinedError if @configuration
  @configuration = ConfigurationContainer.new
  @configuration.configuring = true
  yield configuration if block_given?
  @configuration.configuring = false
end

.method_missing(method_name, *args, &blk) ⇒ Object



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

def method_missing(method_name, *args, &blk)
  return super unless configuration.respond_to? method_name
  configuration.send method_name, *args, &blk
end

.resetObject



27
28
29
# File 'lib/fig_fig.rb', line 27

def reset
  @configuration = nil
end

.respond_to_missing?(method, _include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/fig_fig.rb', line 36

def respond_to_missing?(method, _include_private = false)
  configuration.respond_to?(method) || super
end