Class: Bonobot::Overload

Inherits:
Object
  • Object
show all
Defined in:
lib/bonobot/overload.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(local_file, engine_file) ⇒ Overload

Returns a new instance of Overload.



7
8
9
10
# File 'lib/bonobot/overload.rb', line 7

def initialize(local_file, engine_file)
  @local_file = local_file
  @engine_file = engine_file
end

Instance Attribute Details

#engine_fileObject (readonly)

Returns the value of attribute engine_file.



5
6
7
# File 'lib/bonobot/overload.rb', line 5

def engine_file
  @engine_file
end

Instance Method Details

#pathObject



12
13
14
# File 'lib/bonobot/overload.rb', line 12

def path
  @local_file.path
end

#statusObject



16
17
18
19
20
21
22
# File 'lib/bonobot/overload.rb', line 16

def status
  return :unused if @engine_file.nil?
  return :missing if @local_file.annotation.nil?
  return :up_to_date if @local_file.annotation == @engine_file.fingerprint

  :out_of_date
end

#to_hashObject



24
25
26
# File 'lib/bonobot/overload.rb', line 24

def to_hash
  instance_values.merge({ "status" => status, "path" => path })
end