Class: HashIdentifier

Inherits:
Object
  • Object
show all
Includes:
Version
Defined in:
lib/haiti.rb,
lib/haiti/hash.rb

Overview

The global Hash Identifier class

Defined Under Namespace

Classes: Chf

Constant Summary collapse

PROTOTYPES =
JSON.parse(File.read(File.join(__dir__, '../data/prototypes.json')))

Constants included from Version

Version::VERSION

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ HashIdentifier

A new instance of hash identifier

Parameters:

  • hash (String)

    the hash to identify



26
27
28
29
# File 'lib/haiti.rb', line 26

def initialize(hash)
  @hash = hash
  @type = identify(hash)
end

Instance Attribute Details

#hashString (readonly)

Returns the hash (as provided)

Examples:

'5f4dcc3b5aa765d61d8327deb882cf99'

Returns:

  • (String)

    the hash (as provided)



18
19
20
# File 'lib/haiti.rb', line 18

def hash
  @hash
end

#typeArray<Chf> (readonly)

Returns list of Chf objects, representing the identified hashes

Returns:

  • (Array<Chf>)

    list of Chf objects, representing the identified hashes



22
23
24
# File 'lib/haiti.rb', line 22

def type
  @type
end