Class: PlatformosCheck::PlatformosLiquid::Documentation

Inherits:
Object
  • Object
show all
Defined in:
lib/platformos_check/platformos_liquid/documentation.rb,
lib/platformos_check/platformos_liquid/documentation/markdown_template.rb

Defined Under Namespace

Classes: MarkdownTemplate

Class Method Summary collapse

Class Method Details

.filter_doc(filter_name) ⇒ Object



9
10
11
# File 'lib/platformos_check/platformos_liquid/documentation.rb', line 9

def filter_doc(filter_name)
  render_doc(SourceIndex.filters.find { |entry| entry.name == filter_name })
end

.object_doc(object_name) ⇒ Object



13
14
15
# File 'lib/platformos_check/platformos_liquid/documentation.rb', line 13

def object_doc(object_name)
  render_doc(SourceIndex.objects.find { |entry| entry.name == object_name })
end

.object_property_doc(object_name, property_name) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'lib/platformos_check/platformos_liquid/documentation.rb', line 21

def object_property_doc(object_name, property_name)
  property_entry = SourceIndex
                   .objects
                   .find { |entry| entry.name == object_name }
                   &.properties
                   &.find { |prop| prop.name == property_name }

  render_doc(property_entry)
end

.render_doc(entry) ⇒ Object



31
32
33
34
35
# File 'lib/platformos_check/platformos_liquid/documentation.rb', line 31

def render_doc(entry)
  return nil unless entry

  markdown_template.render(entry)
end

.tag_doc(tag_name) ⇒ Object



17
18
19
# File 'lib/platformos_check/platformos_liquid/documentation.rb', line 17

def tag_doc(tag_name)
  render_doc(SourceIndex.tags.find { |entry| entry.name == tag_name })
end