Class: Mooncell::Configuration Private

Inherits:
Object
  • Object
show all
Defined in:
lib/mooncell/configuration.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ Configuration

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Configuration.

Since:

  • 0.1.0



11
12
13
14
# File 'lib/mooncell/configuration.rb', line 11

def initialize(&block)
  @settings = Concurrent::Map.new
  instance_eval(&block)
end

Instance Method Details

#app(app) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Set App

Parameters:

Since:

  • 0.1.0



41
42
43
# File 'lib/mooncell/configuration.rb', line 41

def app(app)
  apps[app.app_name] = app.new
end

#appsObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0



31
32
33
# File 'lib/mooncell/configuration.rb', line 31

def apps
  settings.fetch_or_store(:apps, {})
end

#protocol(name = nil) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Set or get application protocol

Parameters:

  • name (String|NilClass) (defaults to: nil)

    the protocol name

Since:

  • 0.1.0



22
23
24
25
26
27
# File 'lib/mooncell/configuration.rb', line 22

def protocol(name = nil)
  # TODO: Support multiple protocol each server
  return settings[:protocol] if name.nil?

  settings[:protocol] = name.to_s
end