Class: GoogleApi::Configuration
- Inherits:
-
Object
- Object
- GoogleApi::Configuration
- Defined in:
- lib/google_api/configuration.rb
Instance Method Summary collapse
- #configure(&block) ⇒ Object
-
#initialize(config = {}) ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize(config = {}) ⇒ Configuration
Returns a new instance of Configuration.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/google_api/configuration.rb', line 4 def initialize(config = {}) config.each do |key, value| eval <<-METHOD def #{key}=(value) @#{key} = value end def #{key}(value = nil, &block) if block_given? @#{key}.instance_eval(&block) end if value.nil? return @#{key} end self.#{key} = value end METHOD self.send("#{key}=", value) end end |
Instance Method Details
#configure(&block) ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/google_api/configuration.rb', line 28 def configure(&block) if block_given? yield self end self end |