Class: Breadboard::Config::EnvConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/breadboard/env_config.rb

Overview

holds site, user, password values for an environment instance

Instance Method Summary collapse

Instance Method Details

#empty?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/breadboard/env_config.rb', line 33

def empty?
  !(site || password || user)
end

#password(pass = nil) ⇒ Object



24
25
26
27
# File 'lib/breadboard/env_config.rb', line 24

def password(pass=nil)
  return @password unless pass
  @password = pass
end

#site(url = nil) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/breadboard/env_config.rb', line 5

def site(url=nil)
  @site = url if url

  return @site if @site.kind_of?(URI)

  if @site
    if @site.respond_to? :call
      URI.parse @site.call
    else
      URI.parse @site
    end
  end
end

#to_sObject



29
30
31
# File 'lib/breadboard/env_config.rb', line 29

def to_s
  @site.to_s
end

#user(username = nil) ⇒ Object



19
20
21
22
# File 'lib/breadboard/env_config.rb', line 19

def user(username=nil)
  return @user unless username
  @user = username
end