Skip to content

Commit 3aa55f1

Browse files
committed
RUBY-266 - expose execution profiles through cluster object
* Minor tweaks to make generated docs cleaner.
1 parent 78c483e commit 3aa55f1

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

lib/cassandra/cluster.rb

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,16 @@ def protocol_version
161161
@connection_options.protocol_version
162162
end
163163

164+
# @param name [String] Name of profile to retrieve
165+
# @return [Cassandra::Execution::Profile] execution profile of the given name
166+
def execution_profile(name)
167+
@profile_manager.profiles[name]
168+
end
169+
164170
# @return [Hash<String, Cassandra::Execution::Profile>] the collection of execution profiles
165171
def execution_profiles
166-
@profile_manager.profiles
172+
# Return a dup of the hash to prevent the user from adding/removing profiles from the profile-manager.
173+
@profile_manager.profiles.dup
167174
end
168175

169176
# @!method refresh_schema_async
@@ -288,12 +295,6 @@ def close
288295
close_async.get
289296
end
290297

291-
# @param name [String] Name of profile to retrieve
292-
# @return [Cassandra::Execution::Profile] execution profile of the given name.
293-
def execution_profile(name)
294-
@profile_manager.profiles[name]
295-
end
296-
297298
# @private
298299
def inspect
299300
"#<#{self.class.name}:0x#{object_id.to_s(16)} " \

lib/cassandra/execution/profile_manager.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ def distance(host)
5959

6060
# NOTE: It's only safe to call add_profile when setting up the cluster object. In particular,
6161
# this is only ok before calling Driver#connect.
62-
# @private
6362
def add_profile(name, profile)
6463
@profiles[name] = profile
6564
@load_balancing_policies << profile.load_balancing_policy if profile.load_balancing_policy

0 commit comments

Comments
 (0)