Sha256: 95df84691e697546d1aec8f5c3f5606a943351a0e11a60dcb722ff6212b30911

Contents?: true

Size: 508 Bytes

Versions: 2

Compression:

Stored size: 508 Bytes

Contents

# frozen_string_literal: true

require 'gitignore/version'

require 'http'

module Gitignore
  class Error < StandardError; end

  class << self
    GITIGNORE_HOST = ENV['GITIGNORE_HOST'] || 'https://www.toptal.com/developers/gitignore'

    def list
      response = HTTP.get("#{GITIGNORE_HOST}/api/list")
      response.body.to_s.gsub(/\n/, ',').split(',')
    end

    def generate(envs = [])
      response = HTTP.get("#{GITIGNORE_HOST}/api/#{envs.join(',')}")
      response.body.to_s
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gitignore-cli-0.11.0 lib/gitignore.rb
gitignore-cli-0.10.1 lib/gitignore.rb