From 9a1cf6291e0d89fce80aafc0c63de01017f8bb9c Mon Sep 17 00:00:00 2001 From: Ivan Povalyukhin Date: Tue, 17 Mar 2015 22:13:58 -0700 Subject: [PATCH] [private-methods-in-controllers] prevents split helper-methods to become actions in the Rails controllers --- lib/split/encapsulated_helper.rb | 3 +++ lib/split/helper.rb | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/split/encapsulated_helper.rb b/lib/split/encapsulated_helper.rb index a78f9877..28d17f76 100644 --- a/lib/split/encapsulated_helper.rb +++ b/lib/split/encapsulated_helper.rb @@ -14,9 +14,12 @@ module EncapsulatedHelper class ContextShim include Split::Helper + public :ab_test, :finished + def initialize(context) @context = context end + def ab_user @ab_user ||= Split::Persistence.adapter.new(@context) end diff --git a/lib/split/helper.rb b/lib/split/helper.rb index 4a90a171..a9348e1e 100644 --- a/lib/split/helper.rb +++ b/lib/split/helper.rb @@ -1,5 +1,6 @@ module Split module Helper + module_function def ab_test(metric_descriptor, control = nil, *alternatives) begin @@ -130,8 +131,6 @@ def active_experiments return experiment_pairs end - protected - def normalize_metric(metric_descriptor) if Hash === metric_descriptor experiment_name = metric_descriptor.keys.first