Class: Otc::Configuration

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

Defined Under Namespace

Classes: MissingError

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.domainnameObject

Returns the value of attribute domainname.



6
7
8
# File 'lib/otc/configuration.rb', line 6

def domainname
  @domainname
end

.passwordObject

Returns the value of attribute password.



6
7
8
# File 'lib/otc/configuration.rb', line 6

def password
  @password
end

.projectObject

Returns the value of attribute project.



6
7
8
# File 'lib/otc/configuration.rb', line 6

def project
  @project
end

.regionObject

Returns the value of attribute region.



6
7
8
# File 'lib/otc/configuration.rb', line 6

def region
  @region
end

.usernameObject

Returns the value of attribute username.



6
7
8
# File 'lib/otc/configuration.rb', line 6

def username
  @username
end

Class Method Details

.configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



8
9
10
# File 'lib/otc/configuration.rb', line 8

def configure
  yield self
end

.method_missing(m, *args, &block) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/otc/configuration.rb', line 20

def method_missing(m, *args, &block)
  m_as_string = m.to_s

  if m_as_string.end_with?("!")
    method = m_as_string.split("!").first.to_sym

    if self.respond_to?(method)
      send(method).tap do |result|
        raise MissingError, "missing configuration #{method}" if result.nil?
      end
    else
      super
    end
  else
    super
  end
end

.resetObject



12
13
14
15
16
17
18
# File 'lib/otc/configuration.rb', line 12

def reset
  @project = nil
  @username = nil
  @password = nil
  @region = nil
  @domainname = nil
end