lib/censys/document.rb in censu-0.1.2 vs lib/censys/document.rb in censu-0.1.3
- old
+ new
@@ -8,10 +8,25 @@
def initialize(attributes)
@attributes = attributes
end
#
+ # Provides arbitrary access to the attributes
+ #
+ # @param [String] name
+ # The dot-separated field name.
+ #
+ # @return [Object]
+ #
+ def [](name)
+ keys = name.split(".")
+ dig(*keys)
+ end
+
+ #
# Dig attributes
+ #
+ # @param [Array<String>] keys
#
# @return [Object]
#
def dig(*keys)
@attributes.dig(*keys)