Sha256: 60b191585fe92cc1a9feee98b4f9dd86b937288af96b4b090780f207e741999e

Contents?: true

Size: 394 Bytes

Versions: 3

Compression:

Stored size: 394 Bytes

Contents

module MethodLog
  class SourceFile
    attr_reader :path
    attr_reader :source

    def initialize(path: nil, source: nil)
      @path = path
      @source = source
    end

    def ==(other)
      (path == other.path) && (source == other.source)
    end

    def hash
      [path, source].hash
    end

    def snippet(range)
      lines = source.split($/)[range].join($/)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
method_log-0.0.4 lib/method_log/source_file.rb
method_log-0.0.3 lib/method_log/source_file.rb
method_log-0.0.2 lib/method_log/source_file.rb