Sha256: 25c30fddffaa9bf7300696f316844b28c6511b23856e5c43211425af2360314b

Contents?: true

Size: 688 Bytes

Versions: 1

Compression:

Stored size: 688 Bytes

Contents

module I18nAdminUtils
  class SearchResult
    attr_accessor :results

    def initialize(array= [])
      @results = array
    end

    def size
      @results.size
    end

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

    def []=(i, hash)
      @results[i]= hash
    end

    def <<(hash)
      @results << hash
    end

    def +(other)
      SearchResult.new(@results + other.results)
    end

    def include_key?(key)
      @results.any? { |h| h[:key] == key }
    end

    def each(&block)
      @results.each(&block)
    end

    def delete(element)
      @results.delete(element)
    end

    def to_s
      @results.to_s
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
i18n_admin_utils-1.0.0 lib/i18n_admin_utils/search_result.rb