Sha256: 9b1f827443778fcad290db7c20f2df67e711b66deb96a897e9417365ef6d6509

Contents?: true

Size: 386 Bytes

Versions: 1

Compression:

Stored size: 386 Bytes

Contents

module MethodLog
  class SourceFile
    attr_reader :path
    attr_reader :source

    def initialize(path:, source:)
      @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

1 entries across 1 versions & 1 rubygems

Version Path
method_log-0.0.1 lib/method_log/source_file.rb