Class: TRMNLP::Lint::Source

Inherits:
Object
  • Object
show all
Defined in:
lib/trmnlp/lint/source.rb

Overview

The plugin data every lint check examines: markup per view, shared markup, the combined markup string, and the raw settings.yml. Built once and shared across all checks. Settings come straight from Config::Plugin (a single parse); checks read the raw ‘}` templates, which Config::Plugin’s semantic readers render away.

Constant Summary collapse

VIEWS =
%w[full half_horizontal half_vertical quadrant].freeze

Instance Method Summary collapse

Constructor Details

#initialize(config:, paths:) ⇒ Source

Returns a new instance of Source.



13
14
15
16
# File 'lib/trmnlp/lint/source.rb', line 13

def initialize(config:, paths:)
  @config = config
  @paths = paths
end

Instance Method Details

#all_markupObject



31
32
33
# File 'lib/trmnlp/lint/source.rb', line 31

def all_markup
  @all_markup ||= view_markup.values.join + shared_markup
end

#custom_field_definitionsObject



21
# File 'lib/trmnlp/lint/source.rb', line 21

def custom_field_definitions = config.plugin.custom_field_definitions

#custom_field_valuesObject



20
# File 'lib/trmnlp/lint/source.rb', line 20

def custom_field_values = config.project.custom_fields

#plugin_nameObject



18
# File 'lib/trmnlp/lint/source.rb', line 18

def plugin_name = settings['name'].to_s

#settingsObject



19
# File 'lib/trmnlp/lint/source.rb', line 19

def settings = config.plugin.settings

#shared_markupObject



27
28
29
# File 'lib/trmnlp/lint/source.rb', line 27

def shared_markup
  @shared_markup ||= read(paths.shared_template)
end

#view_markupObject



23
24
25
# File 'lib/trmnlp/lint/source.rb', line 23

def view_markup
  @view_markup ||= VIEWS.to_h { |view| [view, read(paths.template(view))] }
end