Sha256: aa88865ccdc1f5827abb17f36b9a990c59917656c95d565447549782796e705f

Contents?: true

Size: 962 Bytes

Versions: 8

Compression:

Stored size: 962 Bytes

Contents

# encoding: utf-8
require 'erb'
require 'pp'

class FuzzyMatch
  class Result #:nodoc: all
    EXPLANATION = <<-ERB
#####################################################
# SUMMARY
#####################################################

Needle: <%= needle.inspect %>
Match:  <%= winner.inspect %>

#####################################################
# OPTIONS
#####################################################

<%= PP.pp(options, '') %>

<% timeline.each_with_index do |event, index| %>
(<%= index+1 %>) <%= event %>
<% end %>
ERB

    attr_accessor :needle
    attr_accessor :read
    attr_accessor :haystack
    attr_accessor :options
    attr_accessor :groupings
    attr_accessor :identities
    attr_accessor :stop_words
    attr_accessor :winner
    attr_accessor :score
    attr_reader :timeline

    def initialize
      @timeline = []
    end
    
    def explain
      $stdout.puts ::ERB.new(EXPLANATION, 0, '%<').result(binding)
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
cocoapods-dependency-html-0.0.2 vendor/bundle/gems/fuzzy_match-2.0.4/lib/fuzzy_match/result.rb
cocoapods-dependency-html-0.0.1 vendor/bundle/gems/fuzzy_match-2.0.4/lib/fuzzy_match/result.rb
fuzzy_match-2.1.0 lib/fuzzy_match/result.rb
fuzzy_match-2.0.4 lib/fuzzy_match/result.rb
fuzzy_match-2.0.3 lib/fuzzy_match/result.rb
fuzzy_match-2.0.2 lib/fuzzy_match/result.rb
fuzzy_match-2.0.1 lib/fuzzy_match/result.rb
fuzzy_match-2.0.0 lib/fuzzy_match/result.rb