class Ironment::Truster
Public Class Methods
new(options = {})
click to toggle source
# File lib/ironment/truster.rb, line 16 def initialize(options = {}) @config = options[:config] || Config.new end
Public Instance Methods
trust(runcom)
click to toggle source
# File lib/ironment/truster.rb, line 36 def trust(runcom) @config[runcom.file] = runcom.sha1sum end
untrust(runcom)
click to toggle source
# File lib/ironment/truster.rb, line 40 def untrust(runcom) @config[runcom.file] = nil end
validate(runcom)
click to toggle source
# File lib/ironment/truster.rb, line 20 def validate(runcom) expected_sha1sum = @config[runcom.file] if expected_sha1sum.nil? raise NotTrusted, runcom end real_sha1sum = runcom.sha1sum unless expected_sha1sum == real_sha1sum raise Modified, runcom end true end