Sha256: 8f1617c48cbf4ba06ede4b9834432210a8f784cc55d89fc8dba572b4161494de

Contents?: true

Size: 679 Bytes

Versions: 3

Compression:

Stored size: 679 Bytes

Contents

module APN
  module Config
    extend self

    def option(name, options = {})
      defaults[name] = settings[name] = options[:default]

      class_eval <<-RUBY
        def #{name}
          settings[#{name.inspect}]
        end

        def #{name}=(value)
          settings[#{name.inspect}] = value
        end

        def #{name}?
          #{name}
        end
      RUBY
    end

    def defaults
      @defaults ||= {}
    end

    def settings
      @settings ||= {}
    end

    option :redis_host, :default => 'localhost'
    option :redis_port, :default => 6379
    option :redis_password
    option :logfile
    option :cert_file
    option :cert_password
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
apn-1.0.2 lib/apn/config.rb
apn-1.0.1 lib/apn/config.rb
apn-1.0.0 lib/apn/config.rb