Sha256: c4d5ca75793db62e97522a136d0b5e22fc0dd4bb09bb9871b242f31ca76e6a61

Contents?: true

Size: 912 Bytes

Versions: 12

Compression:

Stored size: 912 Bytes

Contents

module Toolhound
  module Configurable

    # attr_accessor :auto_paginate, :per_page
    attr_writer :dataserver, :port, :username, :password, :timeout

    # Define static methods
    class << self

      def keys
        @keys ||= [
          :dataserver,
          :port,
          :username,
          :password,
          :timeout
        ]
      end
    end

    # Set configuration options using a block
    def configure
      yield self
    end

    # Reset configuration options to default values
    def reset!
      Toolhound::Configurable.keys.each do |key|
        instance_variable_set(:"@#{key}", Toolhound::Default.options[key])
      end
      self
    end
    alias setup reset!

    # def api_endpoint
    #   File.join(@api_endpoint, "")
    # end

    def options
      Hash[Toolhound::Configurable.keys.map{|key| [key, instance_variable_get(:"@#{key}")]}]
    end

  private



  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
toolhound-ruby-1.0.37 lib/toolhound-ruby/configurable.rb
toolhound-ruby-1.0.36 lib/toolhound-ruby/configurable.rb
toolhound-ruby-1.0.35 lib/toolhound-ruby/configurable.rb
toolhound-ruby-1.0.34 lib/toolhound-ruby/configurable.rb
toolhound-ruby-1.0.33 lib/toolhound-ruby/configurable.rb
toolhound-ruby-1.0.32 lib/toolhound-ruby/configurable.rb
toolhound-ruby-1.0.31 lib/toolhound-ruby/configurable.rb
toolhound-ruby-1.0.30 lib/toolhound-ruby/configurable.rb
toolhound-ruby-1.0.29 lib/toolhound-ruby/configurable.rb
toolhound-ruby-1.0.28 lib/toolhound-ruby/configurable.rb
toolhound-ruby-1.0.27 lib/toolhound-ruby/configurable.rb
toolhound-ruby-1.0.26 lib/toolhound-ruby/configurable.rb