Sha256: a6515fcf59c283960d2d1430d9cdf8b4308d23423c33dfd0e925d78f56155c9a

Contents?: true

Size: 834 Bytes

Versions: 1

Compression:

Stored size: 834 Bytes

Contents

module Scide

  # Global scide options (base path for all projects,
  # shared options).
  class Global
    
    # The path under which all projects reside by default.
    # (Can be overriden at the project level.)
    attr_reader :path

    # Global options shared by all projects.
    attr_reader :options
  
    # Builds global options.
    #
    # ==== Arguments
    # * <tt>contents</tt> - The global options hash.
    def initialize contents
      raise ArgumentError, 'global configuration must be a hash' unless contents.kind_of? Hash

      @options = contents[:options] || {}

      # 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
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
scide-0.0.6 lib/scide/global.rb