Class: LeanCloud::Configuration

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



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

def initialize
  {
    :http_adapter => Faraday,
    :app_id       => nil,
    :app_key      => nil
  }.each {|k, v| self[k] = v}
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 =~ /=$/
    self[$`.to_sym] = args.first
  elsif self.key?(name)
    self[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

Returns:

  • (Boolean)


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

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