Sha256: 5a64d4a6c602ced9e313b072e3470209173b96738d3b88794d7bdfcfd426f49e

Contents?: true

Size: 490 Bytes

Versions: 2

Compression:

Stored size: 490 Bytes

Contents

module I18nAdminUtils
  class SearchResult
    attr_accessor :results

    def initialize(hash = {})
      @results = hash
    end

    def total_found
      @results.values.map{|x| x.size}.inject { |sum, x| sum + x }
    end

    def [](key)
      @results[key]
    end

    def []=(key, value)
      @results[key]= value
    end

    def include?(str)
      @results.values.flatten.include?(str)
    end
    def to_s
      @results.values.to_s
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
i18n_admin_utils-0.0.4 lib/i18n_admin_utils/search_result.rb
i18n_admin_utils-0.0.3 lib/i18n_admin_utils/search_result.rb