Sha256: a28b326c3dd990451b8911ca116fa7713dfabafcc70f8727c1d92be3110391a7

Contents?: true

Size: 595 Bytes

Versions: 2

Compression:

Stored size: 595 Bytes

Contents

module LinkShrink
  # @author Jonah Ruiz <jonah@pixelhipsters.com>
  # Configurable module for Shrinkers-related settings
  module Config
    extend self

    # @!attribute api_key
    # @return [String] API key to be used
    attr_accessor :api_key

    # Sets API to be used
    # @param api [String or Symbol] api to be used
    def api=(api)
      @api = LinkShrink::Shrinkers.const_get(api).new
    end

    # Returns API used
    #   Uses Google by default
    # @return [LinkShrink::Shrinkers::Google] instance
    def api
      @api || LinkShrink::Shrinkers::Google.new
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
link_shrink-0.0.8 lib/link_shrink/config.rb
link_shrink-0.0.7 lib/link_shrink/config.rb