lib/featureflow/feature.rb in featureflow-0.5.0 vs lib/featureflow/feature.rb in featureflow-0.5.1
- old
+ new
@@ -1,10 +1,10 @@
module Featureflow
class Feature
def self.create(key, failover_variant = 'off')
raise ArgumentError, 'Parameter key must be a String' unless valid_key?(key)
- raise ArgumentError, 'Parameter default_variant must be a String' unless valid_key?(failover_variant) || failover_variant.is_a?(NilClass)
+ raise ArgumentError, 'Parameter failover_variant must be a String containing only letters, numbers, hyphens or underscores' unless valid_key?(failover_variant) || failover_variant.is_a?(NilClass)
{
key: key,
failover_variant: failover_variant,
variants: [{
key: 'on',
@@ -18,7 +18,7 @@
end
end
end
def valid_key?(value)
- value.is_a?(String) && !value.empty? && /^[a-z\-\_0-9]+$/.match?(value)
+ value.is_a?(String) && !value.empty? && value =~ /^[a-z\-\_0-9]+$/
end