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.



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

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

Instance Attribute Details

#filter_nameObject (readonly)

filter :foo filter :foo, params



10
11
12
# File 'lib/nanoc/core/processing_actions/filter.rb', line 10

def filter_name
  @filter_name
end

#paramsObject (readonly)

Returns the value of attribute params.



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

def params
  @params
end

Instance Method Details

#==(other) ⇒ Object



30
31
32
# File 'lib/nanoc/core/processing_actions/filter.rb', line 30

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

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/nanoc/core/processing_actions/filter.rb', line 34

def eql?(other)
  self == other
end

#hashObject



26
27
28
# File 'lib/nanoc/core/processing_actions/filter.rb', line 26

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

#serializeObject



18
19
20
# File 'lib/nanoc/core/processing_actions/filter.rb', line 18

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

#to_sObject



22
23
24
# File 'lib/nanoc/core/processing_actions/filter.rb', line 22

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