lib/field_test.rb in field_test-0.5.5 vs lib/field_test.rb in field_test-0.6.0
- old
+ new
@@ -5,17 +5,17 @@
# ext
require "field_test/ext"
# modules
-require "field_test/experiment"
-require "field_test/helpers"
-require "field_test/participant"
-require "field_test/version"
+require_relative "field_test/experiment"
+require_relative "field_test/helpers"
+require_relative "field_test/participant"
+require_relative "field_test/version"
# integrations
-require "field_test/engine" if defined?(Rails)
+require_relative "field_test/engine" if defined?(Rails)
module FieldTest
class Error < StandardError; end
class ExperimentNotFound < Error; end
class UnknownParticipant < Error; end
@@ -27,10 +27,10 @@
path = defined?(Rails) ? Rails.root : File
path.join("config", "field_test.yml")
end
def self.config
- @config ||= YAML.load(ERB.new(File.read(config_path)).result)
+ @config ||= YAML.safe_load(ERB.new(File.read(config_path)).result, permitted_classes: [Date, Time], aliases: true)
end
def self.excluded_ips
@excluded_ips ||= Array(config["exclude"] && config["exclude"]["ips"]).map { |ip| IPAddr.new(ip) }
end