Class: Bonobot::LocalFile

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, root) ⇒ LocalFile

Returns a new instance of LocalFile.



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

def initialize(path, root)
  @path = path.sub("#{root}/", "")
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



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

def path
  @path
end

Instance Method Details

#annotationObject



11
12
13
14
15
# File 'lib/bonobot/local_file.rb', line 11

def annotation
  File.readlines(@path).map do |line|
    line.sub(/# bonobot_fingerprint:/, "").sub("<%", "").sub("%>", "").strip if line.match?(/# bonobot_fingerprint:/) || line.match?(/<%# bonobot_fingerprint:/)
  end.compact.first.presence
end