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')))
COMMONS =
JSON.parse(File.read(File.join(__dir__, '../data/commons.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



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

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

Instance Attribute Details

#hashString (readonly)

Returns the hash (as provided).

Examples:

'5f4dcc3b5aa765d61d8327deb882cf99'

Returns:

  • (String)

    the hash (as provided)



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

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



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

def type
  @type
end