Class: Nanoc::Core::ProcessingActions::Snapshot

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ContractsSupport

enabled?, included, setup_once, warn_about_performance

Methods inherited from Nanoc::Core::ProcessingAction

#inspect

Constructor Details

#initialize(snapshot_names, paths) ⇒ Snapshot

Returns a new instance of Snapshot.



16
17
18
19
# File 'lib/nanoc/core/processing_actions/snapshot.rb', line 16

def initialize(snapshot_names, paths)
  @snapshot_names = snapshot_names
  @paths = paths
end

Instance Attribute Details

#pathsObject (readonly)

Returns the value of attribute paths.



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

def paths
  @paths
end

#snapshot_namesObject (readonly)

Returns the value of attribute snapshot_names.



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

def snapshot_names
  @snapshot_names
end

Instance Method Details

#==(other) ⇒ Object



40
41
42
# File 'lib/nanoc/core/processing_actions/snapshot.rb', line 40

def ==(other)
  self.class == other.class && snapshot_names == other.snapshot_names && paths == other.paths
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/nanoc/core/processing_actions/snapshot.rb', line 44

def eql?(other)
  self == other
end

#hashObject



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

def hash
  self.class.hash ^ snapshot_names.hash ^ paths.hash
end

#serializeObject



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

def serialize
  [:snapshot, @snapshot_names, true, @paths]
end

#to_sObject



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

def to_s
  "snapshot #{@snapshot_names.inspect}, paths: #{@paths.inspect}"
end

#update(snapshot_names: [], paths: []) ⇒ Object



27
28
29
# File 'lib/nanoc/core/processing_actions/snapshot.rb', line 27

def update(snapshot_names: [], paths: [])
  self.class.new(@snapshot_names + snapshot_names.to_a, @paths + paths.to_a)
end