Class: Hieracles::Format

Inherits:
Object
  • Object
show all
Defined in:
lib/hieracles/format.rb

Instance Method Summary collapse

Constructor Details

#initialize(node) ⇒ Format

Returns a new instance of Format.



3
4
5
# File 'lib/hieracles/format.rb', line 3

def initialize(node)
  @node = node
end

Instance Method Details

#allparams(args) ⇒ Object



27
28
29
# File 'lib/hieracles/format.rb', line 27

def allparams(args)
  show_params(false, args)
end

#facts(_) ⇒ Object



11
12
13
# File 'lib/hieracles/format.rb', line 11

def facts(_)
  "#{__callee__} not implemented, please inherit from the Hieracles::Format class to implement a format.\n"
end

#files(_) ⇒ Object



15
16
17
# File 'lib/hieracles/format.rb', line 15

def files(_)
  "#{__callee__} not implemented, please inherit from the Hieracles::Format class to implement a format.\n"
end

#info(_) ⇒ Object



7
8
9
# File 'lib/hieracles/format.rb', line 7

def info(_)
  "#{__callee__} not implemented, please inherit from the Hieracles::Format class to implement a format.\n"
end

#modules(args) ⇒ Object



40
41
42
43
44
45
46
# File 'lib/hieracles/format.rb', line 40

def modules(args)
  output = ''
  @node.modules.each do |k, v|
    output << build_modules_line(k, v)
  end
  output
end

#params(args) ⇒ Object



23
24
25
# File 'lib/hieracles/format.rb', line 23

def params(args)
  show_params(true, args)
end

#paths(_) ⇒ Object



19
20
21
# File 'lib/hieracles/format.rb', line 19

def paths(_)
  "#{__callee__} not implemented, please inherit from the Hieracles::Format class to implement a format.\n"
end

#show_params(without_common, args) ⇒ Object



31
32
33
34
35
36
37
38
# File 'lib/hieracles/format.rb', line 31

def show_params(without_common, args)
  filter = args[0]
  output = build_head(without_common)
  @node.params(without_common).each do |k, v|
    output << build_params_line(k, v, filter)
  end
  output
end