Class: Shelltoad::Configuration

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

API



39
40
41
42
43
44
45
# File 'lib/shelltoad/configuration.rb', line 39

def initialize
  if File.exists?(".shelltoadrc")
    @config = YAML.load(File.new(".shelltoadrc"))
  else
    raise ::Shelltoad::NoConfigfile, "No .shelltoadrc file under current directory"
  end
end

Class Method Details

.accountObject



23
24
25
# File 'lib/shelltoad/configuration.rb', line 23

def self.
  self.instance.
end

.browserObject



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

def self.browser
  self.instance.browser
end

.instanceObject



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

def self.instance
  @instance ||= self.new
end

.keyObject

Class methods



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

def self.key
  self.instance.key
end

.project_idObject



15
16
17
# File 'lib/shelltoad/configuration.rb', line 15

def self.project_id
  self.instance.project_id
end

.secure?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/shelltoad/configuration.rb', line 19

def self.secure?
  self.instance.secure
end

Instance Method Details

#accountObject



55
56
57
# File 'lib/shelltoad/configuration.rb', line 55

def 
  (@config["account"] || @config["project"]) || raise(::Shelltoad::BaseException, "account option not specified in .shelltoadrc")
end

#browserObject



63
64
65
# File 'lib/shelltoad/configuration.rb', line 63

def browser
  @config["browser"] || "sensible-browser"
end

#keyObject



47
48
49
# File 'lib/shelltoad/configuration.rb', line 47

def key
  @config["key"] || raise(::Shelltoad::NoApiKey, "key option not specified in .shelltoadrc")
end

#project_idObject



51
52
53
# File 'lib/shelltoad/configuration.rb', line 51

def project_id
  @config["project_id"]
end

#secureObject



59
60
61
# File 'lib/shelltoad/configuration.rb', line 59

def secure
  @config["secure"] # false by default
end