Class: Scide::Global
- Inherits:
-
Object
- Object
- Scide::Global
- Defined in:
- lib/scide/global.rb
Overview
Global scide options (base path for all projects, shared options).
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Global options shared by all projects.
-
#path ⇒ Object
readonly
The path under which all projects reside by default.
Instance Method Summary collapse
-
#initialize(contents) ⇒ Global
constructor
Builds global options.
Constructor Details
#initialize(contents) ⇒ Global
Builds global options.
Arguments
-
contents
- The global options hash.
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/scide/global.rb', line 18 def initialize contents raise ArgumentError, 'global configuration must be a hash' unless contents.kind_of? Hash raise ArgumentError, 'global options must be a hash' unless contents[:options].nil? or contents[:options].kind_of?(Hash) @options = contents[:options].try(:dup) || {} # default to home directory @path = contents[:path].try(:to_s) || File.('~') # expand from home directory unless absolute @path = File.join File.('~'), @path unless @path.match /^\// end |
Instance Attribute Details
#options ⇒ Object (readonly)
Global options shared by all projects.
12 13 14 |
# File 'lib/scide/global.rb', line 12 def @options end |
#path ⇒ Object (readonly)
The path under which all projects reside by default. (Can be overriden at the project level.)
9 10 11 |
# File 'lib/scide/global.rb', line 9 def path @path end |