Sha256: 211d6054d78f4e60085fe17b38b5f5e91f638ba286e19a90f427643235130185

Contents?: true

Size: 674 Bytes

Versions: 13

Compression:

Stored size: 674 Bytes

Contents

module Picky

  module Backends

    class Backend

      attr_reader :inverted,
                  :weights,
                  :similarity,
                  :configuration

      def initialize options = {}
        @inverted      = options[:inverted]
        @weights       = options[:weights]
        @similarity    = options[:similarity]
        @configuration = options[:configuration]
      end

      def extract_lambda_or thing, *args
        thing && (thing.respond_to?(:call) && thing.call(*args) || thing)
      end

      #
      #
      def to_s
        "#{self.class}(#{[inverted, weights, similarity, configuration].join(', ')})"
      end

    end

  end

end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
picky-3.5.4 lib/picky/backends/backend.rb
picky-3.5.3 lib/picky/backends/backend.rb
picky-3.5.2 lib/picky/backends/backend.rb
picky-3.5.1 lib/picky/backends/backend.rb
picky-3.5.0 lib/picky/backends/backend.rb
picky-3.4.3 lib/picky/backends/backend.rb
picky-3.4.2 lib/picky/backends/backend.rb
picky-3.4.1 lib/picky/backends/backend.rb
picky-3.4.0 lib/picky/backends/backend.rb
picky-3.3.3 lib/picky/backends/backend.rb
picky-3.3.2 lib/picky/backends/backend.rb
picky-3.3.1 lib/picky/backends/backend.rb
picky-3.3.0 lib/picky/backends/backend.rb