Class: Censys::Search::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/censys/search/result.rb

Direct Known Subclasses

Certificate, IPv4, Website

Instance Method Summary collapse

Constructor Details

#initialize(attributes, api) ⇒ Result

Initializes the search result.

Parameters:

  • attributes (Hash{String => Object})
  • api (API)


13
14
15
16
# File 'lib/censys/search/result.rb', line 13

def initialize(attributes, api)
  @attributes = attributes
  @api        = api
end

Instance Method Details

#[](name) ⇒ Object

Provides arbitrary access to the result fields.

Parameters:

  • name (String)

    The dot-separated field name.

Returns:

  • (Object)


46
47
48
# File 'lib/censys/search/result.rb', line 46

def [](name)
  @attributes[name]
end

#field?(name) ⇒ Boolean

Determines whether the field exists.

Parameters:

  • name (String)

Returns:

  • (Boolean)


34
35
36
# File 'lib/censys/search/result.rb', line 34

def field?(name)
  @attributes.key?(name)
end

#fieldsArray<String>

The field names.

Returns:

  • (Array<String>)


23
24
25
# File 'lib/censys/search/result.rb', line 23

def fields
  @attributes.keys
end