Class: Nanoc::Core::ProcessingActions::Filter

Inherits:
Nanoc::Core::ProcessingAction show all
Defined in:
lib/nanoc/core/processing_actions/filter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Nanoc::Core::ProcessingAction

#inspect

Constructor Details

#initialize(filter_name, params) ⇒ Filter

Returns a new instance of Filter.



15
16
17
18
# File 'lib/nanoc/core/processing_actions/filter.rb', line 15

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

Instance Attribute Details

#filter_nameObject (readonly)

filter :foo filter :foo, params



12
13
14
# File 'lib/nanoc/core/processing_actions/filter.rb', line 12

def filter_name
  @filter_name
end

#paramsObject (readonly)

Returns the value of attribute params.



13
14
15
# File 'lib/nanoc/core/processing_actions/filter.rb', line 13

def params
  @params
end

Instance Method Details

#==(other) ⇒ Object



32
33
34
# File 'lib/nanoc/core/processing_actions/filter.rb', line 32

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

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/nanoc/core/processing_actions/filter.rb', line 36

def eql?(other)
  self == other
end

#hashObject



28
29
30
# File 'lib/nanoc/core/processing_actions/filter.rb', line 28

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

#serializeObject



20
21
22
# File 'lib/nanoc/core/processing_actions/filter.rb', line 20

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

#to_sObject



24
25
26
# File 'lib/nanoc/core/processing_actions/filter.rb', line 24

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