Class: Spectro::Config

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Singleton
Defined in:
lib/spectro/config.rb

Constant Summary collapse

API_HOSTNAME =
'localhost:9292'

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#mocks_enabledObject

Returns the value of attribute mocks_enabled.



7
8
9
# File 'lib/spectro/config.rb', line 7

def mocks_enabled
  @mocks_enabled
end

Instance Method Details

#api_hostnameString

Returns the API Hostname from the config or the default if missin

Returns:

  • (String)

    the API Hostname



20
21
22
# File 'lib/spectro/config.rb', line 20

def api_hostname
  return @api_hostname || API_HOSTNAME
end

#api_hostname=(hostname) ⇒ String|NilClass

Sets a custom API Hostname

Parameters:

  • hostname (String|NilClass)

    the custom hostname or ‘nil` for the default

Returns:

  • (String|NilClass)


28
29
30
# File 'lib/spectro/config.rb', line 28

def api_hostname= hostname
  @api_hostname = hostname
end

#enable_mocks!Spectro::Config

Sets mocks_enabled to true

Returns:



35
36
37
38
# File 'lib/spectro/config.rb', line 35

def enable_mocks!
  self.mocks_enabled = true
  return self
end

#mocks_enabled?TrueClass, FalseClass

Returns the current mocks policy (enabled or disabled)

Returns:

  • (TrueClass, FalseClass)

    whether mocks are enabled or not



43
44
45
# File 'lib/spectro/config.rb', line 43

def mocks_enabled?
  return !!self.mocks_enabled
end