-
Notifications
You must be signed in to change notification settings - Fork 16
/
congress.rb
30 lines (24 loc) · 917 Bytes
/
congress.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
require 'congress/client'
module Congress
extend self # rubocop:disable ModuleFunction
attr_accessor :key
def configure
yield self
end
# Alias for Congress::Client.new
#
# @return [Congress::Client]
def new(key = key)
return @client if instance_variable_defined?(:@client) && @client.key == key
@client = Congress::Client.new(key)
end
# Delegate to Congress::Client
def method_missing(method, *args, &block)
return super unless new.respond_to?(method)
new.send(method, *args, &block)
end
# @return [Boolean]
def respond_to?(method, include_private = false) new.respond_to?(method, include_private) end if RUBY_VERSION < '1.9' # rubocop:disable SingleLineMethods
# @return [Boolean]
def respond_to_missing?(method_name, include_private = false) new.respond_to?(method_name, include_private) end if RUBY_VERSION >= '1.9' # rubocop:disable SingleLineMethods
end