Sha256: 67209bec04d76f9840011e0c315cd3523cd3412ed693a072bc5467e5c35f2cfd

Contents?: true

Size: 479 Bytes

Versions: 18

Compression:

Stored size: 479 Bytes

Contents

require 'yaml'

module Instapusher
  module Configuration
    extend self

    @_settings = {}
    attr_reader :_settings

    def load(filename=nil)
      filename ||= File.join(ENV['HOME'], '.instapusher')

      unless File.exist? filename
        File.new(filename, File::CREAT|File::TRUNC|File::RDWR, 0644).close
      end

      @_settings = YAML::load_file(filename) || {}
    end

    def method_missing(name, *args, &block)
      @_settings[name.to_s]
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
instapusher-0.0.21 lib/instapusher/configuration.rb
instapusher-0.0.20 lib/instapusher/configuration.rb
instapusher-0.0.19 lib/instapusher/configuration.rb
instapusher-0.0.18 lib/instapusher/configuration.rb
instapusher-0.0.17 lib/instapusher/configuration.rb
instapusher-0.0.16 lib/instapusher/configuration.rb
instapusher-0.0.15 lib/instapusher/configuration.rb
instapusher-0.0.14 lib/instapusher/configuration.rb
instapusher-0.0.13 lib/instapusher/configuration.rb
instapusher-0.0.12 lib/instapusher/configuration.rb
instapusher-0.0.11 lib/instapusher/configuration.rb
instapusher-0.0.10 lib/instapusher/configuration.rb
instapusher-0.0.9 lib/instapusher/configuration.rb
instapusher-0.0.8 lib/instapusher/configuration.rb
instapusher-0.0.7 lib/instapusher/configuration.rb
instapusher-0.0.6 lib/instapusher/configuration.rb
instapusher-0.0.5 lib/instapusher/configuration.rb
instapusher-0.0.4 lib/instapusher/configuration.rb