Class: Nanoc::Core::OutdatednessStatus Private

Inherits:
Object
  • Object
show all
Defined in:
lib/nanoc/core/outdatedness_status.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(reasons: [], props: Nanoc::Core::DependencyProps.new) ⇒ OutdatednessStatus

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of OutdatednessStatus.



10
11
12
13
# File 'lib/nanoc/core/outdatedness_status.rb', line 10

def initialize(reasons: [], props: Nanoc::Core::DependencyProps.new)
  @reasons = reasons
  @props = props
end

Instance Attribute Details

#propsObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



8
9
10
# File 'lib/nanoc/core/outdatedness_status.rb', line 8

def props
  @props
end

#reasonsObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



7
8
9
# File 'lib/nanoc/core/outdatedness_status.rb', line 7

def reasons
  @reasons
end

Instance Method Details

#inspectObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



31
32
33
# File 'lib/nanoc/core/outdatedness_status.rb', line 31

def inspect
  "<#{self.class} reasons=#{@reasons.inspect} props=#{@props.inspect}>"
end

#update(reason) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



24
25
26
27
28
29
# File 'lib/nanoc/core/outdatedness_status.rb', line 24

def update(reason)
  self.class.new(
    reasons: @reasons + [reason],
    props: @props.merge(reason.props),
  )
end

#useful_to_apply?(rule) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


15
16
17
18
19
20
21
22
# File 'lib/nanoc/core/outdatedness_status.rb', line 15

def useful_to_apply?(rule)
  return true if rule.affects_raw_content? && !@props.raw_content?
  return true if rule.affects_attributes? && !@props.attributes?
  return true if rule.affects_compiled_content? && !@props.compiled_content?
  return true if rule.affects_path? && !@props.path?

  false
end