Class: Mihari::HTML
- Inherits:
-
Object
- Object
- Mihari::HTML
- Defined in:
- lib/mihari/html.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #exists? ⇒ Boolean
-
#initialize(path) ⇒ HTML
constructor
A new instance of HTML.
- #md5 ⇒ Object
- #mmh3 ⇒ Object
- #sha256 ⇒ Object
Constructor Details
#initialize(path) ⇒ HTML
Returns a new instance of HTML.
10 11 12 |
# File 'lib/mihari/html.rb', line 10 def initialize(path) @path = path end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
8 9 10 |
# File 'lib/mihari/html.rb', line 8 def path @path end |
Instance Method Details
#exists? ⇒ Boolean
14 15 16 17 18 |
# File 'lib/mihari/html.rb', line 14 def exists? return false unless path File.exist? path end |
#md5 ⇒ Object
24 25 26 |
# File 'lib/mihari/html.rb', line 24 def md5 Digest::MD5.hexdigest data end |
#mmh3 ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/mihari/html.rb', line 28 def mmh3 hash = MurmurHash3::V32.str_hash(data) if (hash & 0x80000000).zero? hash else -((hash ^ 0xFFFFFFFF) + 1) end end |
#sha256 ⇒ Object
20 21 22 |
# File 'lib/mihari/html.rb', line 20 def sha256 Digest::SHA256.hexdigest data end |