Sha256: 3a15d04acb188f16aa5c327b29900494a87dcb5c1ffd53e5e166b1e1aa6fdba2

Contents?: true

Size: 451 Bytes

Versions: 2

Compression:

Stored size: 451 Bytes

Contents

module Listings
  class CustomFilterView
    attr_reader :listing
    attr_reader :descriptor

    def initialize(listing, descriptor)
      @listing = listing
      @descriptor = descriptor
    end

    def key
      @descriptor.key
    end

    def render?
      false
    end

    def apply_filter(value)
      listing.data_source.transform_items do |items|
        listing.instance_exec items, value, &@descriptor.proc
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
listings-0.1.6 lib/listings/custom_filter_view.rb
listings-0.1.5 lib/listings/custom_filter_view.rb