Sha256: e25d78dd67a51d3bd725cfff6453adb244daccb2c36682692ca467590bbd6ff8

Contents?: true

Size: 722 Bytes

Versions: 10

Compression:

Stored size: 722 Bytes

Contents

require 'yaml'

module Semi
  class Config
    
    attr_reader :defaults
    attr_reader :files
    attr_reader :validators
    attr_reader :commands

    def initialize(path=nil)
      @defaults = {}
      @validators = {}
      @files = []
      @commands = {}

      if path
        self.load(path)
      end
    end

    def load(path)
      data = YAML.load_file(path)
      if data.key? 'defaults'
        @defaults = data['defaults']
      end

      if data.key? 'validate'
        @validators = data['validate']
      end

      if data.key? 'files'
        @files = data['files']
      end

      if data.key? 'commands'
        @commands = data['commands']
      end
      
      return data
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
semi-0.4.0 lib/semi/config.rb
semi-0.3.6 lib/semi/config.rb
semi-0.3.5 lib/semi/config.rb
semi-0.3.3 lib/semi/config.rb
semi-0.3.2 lib/semi/config.rb
semi-0.3.1 lib/semi/config.rb
semi-0.3.0 lib/semi/config.rb
semi-0.2.1 lib/semi/config.rb
semi-0.2.0 lib/semi/config.rb
semi-0.1.3 lib/semi/config.rb