Class: Assets::Evaluator

Inherits:
Object
  • Object
show all
Includes:
Adamantium
Defined in:
lib/assets/evaluator.rb

Overview

Rule evaluator

Instance Method Summary collapse

Instance Method Details

#assetAsset

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return asset

Returns:



13
14
15
16
17
18
19
20
21
22
# File 'lib/assets/evaluator.rb', line 13

def asset
  Asset.new(
    :name       => rule.name,
    :mime       => rule.mime,
    :created_at => Time.now,
    :body       => body,
    :size       => size,
    :sha1       => sha1
  )
end

#bodyString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return body

Returns:

  • (String)


40
41
42
# File 'lib/assets/evaluator.rb', line 40

def body
  rule.body
end

#mimeMime

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return mime

Returns:



61
62
63
# File 'lib/assets/evaluator.rb', line 61

def mime
  rule.mime
end

#sha1String

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return sha1 hexdigest of body

Returns:

  • (String)


30
31
32
# File 'lib/assets/evaluator.rb', line 30

def sha1
  Digest::SHA1.hexdigest(body)
end

#sizeFixnum

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return size in bytes

Returns:

  • (Fixnum)


51
52
53
# File 'lib/assets/evaluator.rb', line 51

def size
  body.bytesize
end