lib/hedgelog/context.rb in hedgelog-0.1.9 vs lib/hedgelog/context.rb in hedgelog-0.1.11
- old
+ new
@@ -3,10 +3,11 @@
class Hedgelog
class Context
def initialize(scrubber, normalizer, data = {})
raise ::ArgumentError, "#{self.class}: argument must be Hash got #{data.class}." unless data.is_a? Hash
+
check_reserved_keys(data)
@data = data
@scrubber = scrubber
@normalizer = normalizer
end
@@ -59,12 +60,10 @@
def to_h
@data
end
- private
-
- def check_reserved_keys(hash)
+ private def check_reserved_keys(hash)
invalid_keys = Hedgelog::RESERVED_KEYS & hash.keys
raise ::ArgumentError, "#{self.class}: The following keys are reserved and cannot be used #{invalid_keys.to_a}." unless invalid_keys.empty?
end
end
end