lib/unleash/context.rb in unleash-4.3.0 vs lib/unleash/context.rb in unleash-4.4.0
- old
+ new
@@ -31,9 +31,16 @@
else
self.properties.fetch(normalized_name, nil) || self.properties.fetch(name.to_sym)
end
end
+ def include?(name)
+ normalized_name = underscore(name)
+ return self.instance_variable_defined? "@#{normalized_name}" if ATTRS.include? normalized_name.to_sym
+
+ self.properties.include?(normalized_name.to_sym) || self.properties.include?(name.to_sym)
+ end
+
private
# Method to fetch values from hash for two types of keys: string in camelCase and symbol in snake_case
def value_for(key, params, default_value = nil)
params.values_at(key, key.to_sym, underscore(key), underscore(key).to_sym).compact.first || default_value