Class: Middleman::Presentation::IgnoreFile

Inherits:
Object
  • Object
show all
Defined in:
lib/middleman-presentation-core/ignore_file.rb

Overview

The ignore file uses to ignore slides

See Also:

  • [Transformers[Transformers::IgnoreSlides]

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ IgnoreFile

Returns a new instance of IgnoreFile.



18
19
20
21
22
23
# File 'lib/middleman-presentation-core/ignore_file.rb', line 18

def initialize(path)
  @unignore = @ignore = /^!$/
  @path = path

  parse_file(path) if File.exist? path
end

Instance Method Details

#ignore?(slide) ⇒ Boolean

Returns:

  • (Boolean)


25
26
27
28
29
# File 'lib/middleman-presentation-core/ignore_file.rb', line 25

def ignore?(slide)
  return false unless File.exist? path

  slide.match?(ignore) && !slide.match?(unignore)
end