Module: YARD::Templates::Helpers::BaseHelper

Defined in:
lib/yard-rest-plugin/base_helper.rb

Instance Method Summary collapse

Instance Method Details

#index_objects(list) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/yard-rest-plugin/base_helper.rb', line 16

def index_objects(list)
  res = reject_module(list)
  res = reject_without_url(res)
  res = reject_without_topic(res)
  res = reject_overall(res)

  res
end

#reject_module(list) ⇒ Object



25
26
27
# File 'lib/yard-rest-plugin/base_helper.rb', line 25

def reject_module(list)
  list.reject { |object| [:root, :module].include?(object.type) }
end

#reject_overall(list) ⇒ Object



37
38
39
# File 'lib/yard-rest-plugin/base_helper.rb', line 37

def reject_overall(list)
  list.reject { |object| object.has_tag?('overall') }
end

#reject_without_topic(list) ⇒ Object



33
34
35
# File 'lib/yard-rest-plugin/base_helper.rb', line 33

def reject_without_topic(list)
  list.reject { |object| [:class].include?(object.type) and object.tags("topic").empty? }
end

#reject_without_url(list) ⇒ Object



29
30
31
# File 'lib/yard-rest-plugin/base_helper.rb', line 29

def reject_without_url(list)
  list.reject { |object| [:class, :method].include?(object.type) and object.tags("url").empty? }
end

#run_verifier(list) ⇒ Object

Adds additional test that only includes Objects that contain a URL tag



7
8
9
10
11
12
13
14
# File 'lib/yard-rest-plugin/base_helper.rb', line 7

def run_verifier(list)

  if options[:verifier]
    list.reject! { |item| options[:verifier].call(item).is_a?(FalseClass) }
  end

  index_objects(list)
end