Class: Shelltoad::Configuration
- Inherits:
-
Object
- Object
- Shelltoad::Configuration
- Defined in:
- lib/shelltoad/configuration.rb
Class Method Summary collapse
- .account ⇒ Object
- .browser ⇒ Object
- .instance ⇒ Object
-
.key ⇒ Object
Class methods.
- .project_id ⇒ Object
- .secure? ⇒ Boolean
Instance Method Summary collapse
- #account ⇒ Object
- #browser ⇒ Object
-
#initialize ⇒ Configuration
constructor
API.
- #key ⇒ Object
- #project_id ⇒ Object
- #secure ⇒ Object
Constructor Details
#initialize ⇒ Configuration
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
.account ⇒ Object
23 24 25 |
# File 'lib/shelltoad/configuration.rb', line 23 def self.account self.instance.account end |
.browser ⇒ Object
27 28 29 |
# File 'lib/shelltoad/configuration.rb', line 27 def self.browser self.instance.browser end |
.instance ⇒ Object
31 32 33 |
# File 'lib/shelltoad/configuration.rb', line 31 def self.instance @instance ||= self.new end |
.key ⇒ Object
Class methods
11 12 13 |
# File 'lib/shelltoad/configuration.rb', line 11 def self.key self.instance.key end |
.project_id ⇒ Object
15 16 17 |
# File 'lib/shelltoad/configuration.rb', line 15 def self.project_id self.instance.project_id end |
.secure? ⇒ Boolean
19 20 21 |
# File 'lib/shelltoad/configuration.rb', line 19 def self.secure? self.instance.secure end |
Instance Method Details
#account ⇒ Object
55 56 57 |
# File 'lib/shelltoad/configuration.rb', line 55 def account (@config["account"] || @config["project"]) || raise(::Shelltoad::BaseException, "account option not specified in .shelltoadrc") end |
#browser ⇒ Object
63 64 65 |
# File 'lib/shelltoad/configuration.rb', line 63 def browser @config["browser"] || "sensible-browser" end |
#key ⇒ Object
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_id ⇒ Object
51 52 53 |
# File 'lib/shelltoad/configuration.rb', line 51 def project_id @config["project_id"] end |
#secure ⇒ Object
59 60 61 |
# File 'lib/shelltoad/configuration.rb', line 59 def secure @config["secure"] # false by default end |