Class: Bonobot::EngineFile

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, engine) ⇒ EngineFile

Returns a new instance of EngineFile.



7
8
9
10
11
12
13
# File 'lib/bonobot/engine_file.rb', line 7

def initialize(path, engine)
  @path = path
  @root_path = engine.instance.root
  @engine_name = engine_to_name(engine)
  @short_path = path.sub("#{@root_path}/", "")
  @fingerprint = Bonobot::Fingerprint.calculate(path)
end

Instance Attribute Details

#engine_nameObject (readonly)

Returns the value of attribute engine_name.



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

def engine_name
  @engine_name
end

#fingerprintObject (readonly)

Returns the value of attribute fingerprint.



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

def fingerprint
  @fingerprint
end

#pathObject (readonly)

Returns the value of attribute path.



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

def path
  @path
end

#root_pathObject (readonly)

Returns the value of attribute root_path.



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

def root_path
  @root_path
end

#short_pathObject (readonly)

Returns the value of attribute short_path.



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

def short_path
  @short_path
end

Instance Method Details

#to_hashObject



15
16
17
# File 'lib/bonobot/engine_file.rb', line 15

def to_hash
  instance_values.merge({ "fingerprint" => fingerprint })
end