Class: LeanCloud::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/lean_cloud/configuration.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration



11
12
13
14
15
16
17
# File 'lib/lean_cloud/configuration.rb', line 11

def initialize
  @@options = {
    :http_adapter => Faraday,
    :app_id       => nil,
    :app_key      => nil
  }
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &blk) ⇒ Object (private)



25
26
27
28
29
30
31
32
33
# File 'lib/lean_cloud/configuration.rb', line 25

def method_missing(name, *args, &blk)
  if name.to_s =~ /=$/
    @@options[$`.to_sym] = args.first
  elsif @@options.key?(name)
    @@options[name]
  else
    super
  end
end

Class Method Details

.instanceObject



6
7
8
# File 'lib/lean_cloud/configuration.rb', line 6

def instance
  @instance ||= new
end

Instance Method Details

#respond_to?(name, include_private = false) ⇒ Boolean



19
20
21
# File 'lib/lean_cloud/configuration.rb', line 19

def respond_to?(name, include_private = false)
  super || @@options.key?(name.to_sym)
end