Class: RubyCoded::Commands::MarkdownProvider

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_coded/commands/markdown_provider.rb

Overview

Converts markdown command files into command definitions.

Instance Method Summary collapse

Constructor Details

#initialize(project_root:) ⇒ MarkdownProvider

Returns a new instance of MarkdownProvider.



10
11
12
# File 'lib/ruby_coded/commands/markdown_provider.rb', line 10

def initialize(project_root:)
  @loader = MarkdownLoader.new(project_root: project_root)
end

Instance Method Details

#definitionsObject



14
15
16
# File 'lib/ruby_coded/commands/markdown_provider.rb', line 14

def definitions
  load_report[:definitions]
end

#load_reportObject



18
19
20
21
22
23
24
25
# File 'lib/ruby_coded/commands/markdown_provider.rb', line 18

def load_report
  report = @loader.load_report
  {
    definitions: build_definitions(report[:entries]),
    invalid_count: report[:invalid_count],
    invalid_files: report[:invalid_files]
  }
end