Sha256: 642921b721f4d09be20e37e6c0f5ac9b1a61450eba5b40702895177182e576bd

Contents?: true

Size: 756 Bytes

Versions: 9

Compression:

Stored size: 756 Bytes

Contents

# frozen_string_literal: true

module Nanoc::Int::ProcessingActions
  class Filter < Nanoc::Int::ProcessingAction
    # filter :foo
    # filter :foo, params

    attr_reader :filter_name
    attr_reader :params

    def initialize(filter_name, params)
      @filter_name = filter_name
      @params      = params
    end

    def serialize
      [:filter, @filter_name, Nanoc::Int::Checksummer.calc(@params)]
    end

    def to_s
      "filter #{@filter_name.inspect}, #{@params.inspect}"
    end

    def hash
      self.class.hash ^ filter_name.hash ^ params.hash
    end

    def ==(other)
      self.class == other.class && filter_name == other.filter_name && params == other.params
    end

    def eql?(other)
      self == other
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
nanoc-4.11.0 lib/nanoc/base/entities/processing_actions/filter.rb
nanoc-4.10.4 lib/nanoc/base/entities/processing_actions/filter.rb
nanoc-4.10.3 lib/nanoc/base/entities/processing_actions/filter.rb
nanoc-4.10.2 lib/nanoc/base/entities/processing_actions/filter.rb
nanoc-4.10.1 lib/nanoc/base/entities/processing_actions/filter.rb
nanoc-4.10.0 lib/nanoc/base/entities/processing_actions/filter.rb
nanoc-4.9.9 lib/nanoc/base/entities/processing_actions/filter.rb
nanoc-4.9.8 lib/nanoc/base/entities/processing_actions/filter.rb
nanoc-4.9.7 lib/nanoc/base/entities/processing_actions/filter.rb