Sha256: 171154e960044564ef3731911731188b79b51b8afe09a43427d997fb4e0fb457

Contents?: true

Size: 604 Bytes

Versions: 1

Compression:

Stored size: 604 Bytes

Contents

require 'method_log/method_finder'
require 'method_log/method_commit'

module MethodLog
  class API
    def initialize(repository:)
      @repository = repository
    end

    def history(method_identifier)
      @repository.commits.map do |commit|
        method_definitions = commit.source_files.inject([]) do |definitions, source_file|
          method_finder = MethodFinder.new(source_file: source_file)
          definitions += Array(method_finder.find(method_identifier))
        end
        MethodCommit.new(commit: commit, method_definition: method_definitions.first)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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