Class: Couchbase::ConfigProfiles::Profiles

Inherits:
Object
  • Object
show all
Defined in:
lib/couchbase/config_profiles.rb,
/code/couchbase-ruby-client/lib/couchbase/config_profiles.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeProfiles

Returns a new instance of Profiles.



22
23
24
25
# File 'lib/couchbase/config_profiles.rb', line 22

def initialize
  @profiles = {}
  register_profile("wan_development", DevelopmentProfile.new)
end

Instance Attribute Details

#profilesObject (readonly)

Returns the value of attribute profiles.



20
21
22
# File 'lib/couchbase/config_profiles.rb', line 20

def profiles
  @profiles
end

Instance Method Details

#apply(profile_name, options) ⇒ Object

Raises:

  • (ArgumentError)


31
32
33
34
35
# File 'lib/couchbase/config_profiles.rb', line 31

def apply(profile_name, options)
  raise ArgumentError, "#{profile_name} is not a registered profile" unless @profiles.key?(profile_name)

  @profiles[profile_name].apply(options)
end

#register_profile(name, profile) ⇒ Object



27
28
29
# File 'lib/couchbase/config_profiles.rb', line 27

def register_profile(name, profile)
  @profiles[name] = profile
end