Top Level Namespace

Defined Under Namespace

Modules: Bookworm

Instance Method Summary collapse

Instance Method Details

#outputObject

See note in crawler.rb about EMPTY_RUBOCOP_AST constant



28
29
30
# File 'lib/bookworm/rules/NoParsedRuby.rb', line 28

def output
  role_name @metadata['ast']
end

#to_aObject



18
19
20
21
22
23
24
25
26
# File 'lib/bookworm/reports/LeafCookbooks.rb', line 18

def to_a
  buffer = Set.new
  @kb.metadatarbs.each do |_, |
    ['ExplicitMetadataDepends'].each do |cb|
      buffer << cb
    end
  end
  (@kb.cookbooks.keys.to_set - buffer).sort.to_a
end

#to_hObject



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/bookworm/reports/NoParsedRuby.rb', line 19

def to_h
  no_parsed_ruby = {}
  Bookworm::InferRules::NoParsedRuby.keys.each do |key|
    plural = BOOKWORM_KEYS[key]['plural']
    no_parsed_ruby[plural] = []
    @kb.send(plural.to_sym).each do |k, |
      no_parsed_ruby[plural].append(k) if ['NoParsedRuby']
    end
  end
  no_parsed_ruby
end

#to_plainObject



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/bookworm/reports/NoParsedRuby.rb', line 31

def to_plain
  hsh = to_h
  buffer = ''
  Bookworm::InferRules::NoParsedRuby.keys.each do |key|
    plural = BOOKWORM_KEYS[key]['plural']
    if hsh[plural].empty?
      buffer << "No non-AST #{plural} files\n"
    else
      buffer << "#{plural.capitalize}:\n"
      hsh[plural].sort.each do |keys|
        buffer << "\t#{keys}\n"
      end
    end
  end
  buffer
end

#to_sObject



18
19
20
21
22
23
24
25
26
# File 'lib/bookworm/reports/CookbookDependencyDot.rb', line 18

def to_s
  cookbook_deps = []
  @kb.metadatarbs.each do |x, |
    ['ExplicitMetadataDepends'].each do |cb|
      cookbook_deps << [x.gsub(/:.*/, ''), cb]
    end
  end
  "digraph deps {\n#{cookbook_deps.map { |arr| arr.join('->') }.join("\n")}\n}"
end