Class: MarkdownComposer::SourceListBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/markdown_composer/source_list_builder.rb

Instance Method Summary collapse

Constructor Details

#initializeSourceListBuilder

Returns a new instance of SourceListBuilder.



5
6
7
# File 'lib/markdown_composer/source_list_builder.rb', line 5

def initialize
  @sources = []
end

Instance Method Details

#current(markdown = nil, key: "current", html: nil, title: nil, preferred_format: :markdown, metadata: {}) ⇒ Object



9
10
11
# File 'lib/markdown_composer/source_list_builder.rb', line 9

def current(markdown = nil, key: "current", html: nil, title: nil, preferred_format: :markdown, metadata: {})
  add(type: "current", key: key, markdown: markdown, html: html, title: title, preferred_format: preferred_format, metadata: )
end

#explicit(key, markdown = nil, html: nil, title: nil, preferred_format: :markdown, metadata: {}) ⇒ Object



13
14
15
# File 'lib/markdown_composer/source_list_builder.rb', line 13

def explicit(key, markdown = nil, html: nil, title: nil, preferred_format: :markdown, metadata: {})
  add(type: "explicit", key: key, markdown: markdown, html: html, title: title, preferred_format: preferred_format, metadata: )
end

#inherited(key, markdown = nil, html: nil, title: nil, preferred_format: :markdown, metadata: {}) ⇒ Object



17
18
19
# File 'lib/markdown_composer/source_list_builder.rb', line 17

def inherited(key, markdown = nil, html: nil, title: nil, preferred_format: :markdown, metadata: {})
  add(type: "inherited", key: key, markdown: markdown, html: html, title: title, preferred_format: preferred_format, metadata: )
end

#to_aObject



21
22
23
# File 'lib/markdown_composer/source_list_builder.rb', line 21

def to_a
  @sources.map(&:dup)
end