Class: Danger::Changelog::ChangelogFile

Inherits:
Object
  • Object
show all
Defined in:
lib/changelog/changelog_file.rb

Overview

A CHANGELOG.md file reader.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filename = 'CHANGELOG.md') ⇒ ChangelogFile

Returns a new instance of ChangelogFile.



7
8
9
10
11
# File 'lib/changelog/changelog_file.rb', line 7

def initialize(filename = 'CHANGELOG.md')
  @filename = filename
  @exists = File.exist?(filename)
  parse if @exists
end

Instance Attribute Details

#bad_linesObject (readonly)

Returns the value of attribute bad_lines.



5
6
7
# File 'lib/changelog/changelog_file.rb', line 5

def bad_lines
  @bad_lines
end

#existsObject (readonly)

Returns the value of attribute exists.



5
6
7
# File 'lib/changelog/changelog_file.rb', line 5

def exists
  @exists
end

#filenameObject (readonly)

Returns the value of attribute filename.



5
6
7
# File 'lib/changelog/changelog_file.rb', line 5

def filename
  @filename
end

Instance Method Details

#bad?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/changelog/changelog_file.rb', line 26

def bad?
  bad_lines? || !(your_contribution_here? || !Danger::Changelog.config.placeholder_line?)
end

#bad_lines?Boolean

Any bad_lines?

Returns:

  • (Boolean)


14
15
16
# File 'lib/changelog/changelog_file.rb', line 14

def bad_lines?
  !!bad_lines && bad_lines.any?
end

#exists?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/changelog/changelog_file.rb', line 18

def exists?
  !!@exists
end

#good?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/changelog/changelog_file.rb', line 30

def good?
  !bad?
end

#your_contribution_here?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/changelog/changelog_file.rb', line 22

def your_contribution_here?
  !!@your_contribution_here
end