Class: Scide::Global

Inherits:
Object
  • Object
show all
Defined in:
lib/scide/global.rb

Overview

Global scide options (base path for all projects, shared options).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(contents) ⇒ Global

Builds global options.

Arguments

  • contents - The global options hash.

Raises:

  • (ArgumentError)


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_path('~')
  # expand from home directory unless absolute
  @path = File.join File.expand_path('~'), @path unless @path.match /^\//
end

Instance Attribute Details

#optionsObject (readonly)

Global options shared by all projects.



12
13
14
# File 'lib/scide/global.rb', line 12

def options
  @options
end

#pathObject (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