Class: GoogleImageApi::Configuration

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/google_image_api/configuration.rb

Class Method Summary collapse

Class Method Details

.[](directive) ⇒ Object



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

def self.[](directive)
  instance.send(directive)
end

.directives(*directives) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/google_image_api/configuration.rb', line 7

def self.directives(*directives)
  directives.each do |directive|
    define_method directive do |*args|
      if args.empty?
        return instance_variable_get("@#{directive}")
      else
        instance_variable_set("@#{directive}", args.first)
      end
    end
  end
end