Class: AnnotateRb::ModelAnnotator::Annotation::MainHeader

Inherits:
Components::Base show all
Defined in:
lib/annotate_rb/model_annotator/annotation/main_header.rb

Constant Summary collapse

PREFIX =

Annotate Models plugin use this header

"== Schema Information"
PREFIX_MD =
"## Schema Information"

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Components::Base

#to_rdoc, #to_yard

Constructor Details

#initialize(version, include_version) ⇒ MainHeader

Returns a new instance of MainHeader.



13
14
15
16
# File 'lib/annotate_rb/model_annotator/annotation/main_header.rb', line 13

def initialize(version, include_version)
  @version = version
  @include_version = include_version
end

Instance Attribute Details

#versionObject (readonly)

Returns the value of attribute version.



11
12
13
# File 'lib/annotate_rb/model_annotator/annotation/main_header.rb', line 11

def version
  @version
end

Instance Method Details

#to_defaultObject



27
28
29
30
31
32
33
34
# File 'lib/annotate_rb/model_annotator/annotation/main_header.rb', line 27

def to_default
  header = "# #{PREFIX}"
  if @include_version && version > 0
    header += "\n# Schema version: #{version}"
  end

  header
end

#to_markdownObject



18
19
20
21
22
23
24
25
# File 'lib/annotate_rb/model_annotator/annotation/main_header.rb', line 18

def to_markdown
  header = "# #{PREFIX_MD}"
  if @include_version && version > 0
    header += "\n# Schema version: #{version}"
  end

  header
end