Class: Anemone::Page

Inherits:
Object show all
Defined in:
lib/hoodie/rash.rb

Instance Method Summary collapse

Instance Method Details

#to_hashObject



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/hoodie/rash.rb', line 101

def to_hash
  file  = ::File.basename(@url.to_s)
  key   = ::File.basename(file, '.*').downcase.to_sym
  type  = ::File.extname(file)[1..-1].downcase.to_sym
  id    = Hoodie::Obfuscate.befuddle(file, Digest::MD5.hexdigest(body.to_s))
  utime = Time.now.to_i
  key = { key => { type => {
    id:             id,
    file:           file,
    key:            key,
    type:           type,
    url:            @url.to_s,
    links:          links.map(&:to_s),
    code:           @code,
    visited:        @visited,
    depth:          @depth,
    referer:        @referer.to_s,
    fetched:        @fetched,
    utime:          utime,
    md5_digest:     Digest::MD5.hexdigest(body.to_s),
    sha256_digest:  Digest::SHA256.hexdigest(body.to_s)
  } } }
end