class MethodLog::SourceFile

Attributes

path[R]
sha[R]

Public Class Methods

new(options = {}) click to toggle source
# File lib/method_log/source_file.rb, line 6
def initialize(options = {})
  @path = options[:path]
  @source = options[:source]
  @repository = options[:repository]
  @sha = options[:sha]
end

Public Instance Methods

==(other) click to toggle source
# File lib/method_log/source_file.rb, line 17
def ==(other)
  (path == other.path) && (source == other.source)
end
hash() click to toggle source
# File lib/method_log/source_file.rb, line 21
def hash
  @sha || [path, source].hash
end
snippet(range) click to toggle source
# File lib/method_log/source_file.rb, line 25
def snippet(range)
  lines = source.split($/)[range].join($/)
end
source() click to toggle source
# File lib/method_log/source_file.rb, line 13
def source
  @source ||= @repository.lookup(@sha).text
end