Class: AbideDevUtils::CEM::Resource

Inherits:
Object
  • Object
show all
Defined in:
lib/abide_dev_utils/cem/benchmark.rb

Overview

Represents a resource data resource statement

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(title, data, framework, mapper) ⇒ Resource

Returns a new instance of Resource.



15
16
17
18
19
20
21
22
# File 'lib/abide_dev_utils/cem/benchmark.rb', line 15

def initialize(title, data, framework, mapper)
  @title = title
  @data = data
  @type = data['type']
  @framework = framework
  @mapper = mapper
  @dependent = []
end

Instance Attribute Details

#titleObject (readonly)

Returns the value of attribute title.



13
14
15
# File 'lib/abide_dev_utils/cem/benchmark.rb', line 13

def title
  @title
end

#typeObject (readonly)

Returns the value of attribute type.



13
14
15
# File 'lib/abide_dev_utils/cem/benchmark.rb', line 13

def type
  @type
end

Instance Method Details

#cem_optionsObject



49
50
51
# File 'lib/abide_dev_utils/cem/benchmark.rb', line 49

def cem_options
  @cem_options ||= resource_properties('cem_options')
end

#cem_options?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/abide_dev_utils/cem/benchmark.rb', line 45

def cem_options?
  !cem_options.empty?
end

#cem_protectedObject



57
58
59
# File 'lib/abide_dev_utils/cem/benchmark.rb', line 57

def cem_protected
  @cem_protected ||= resource_properties('cem_protected')
end

#cem_protected?Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/abide_dev_utils/cem/benchmark.rb', line 53

def cem_protected?
  !cem_protected.empty?
end

#controlsObject



41
42
43
# File 'lib/abide_dev_utils/cem/benchmark.rb', line 41

def controls
  @controls || load_controls
end

#dependent_controlsObject



61
62
63
# File 'lib/abide_dev_utils/cem/benchmark.rb', line 61

def dependent_controls
  @dependent_controls ||= @dependent.flatten.uniq.filter_map { |x| controls.find { |y| y.id == x } }
end

#file_pathObject



37
38
39
# File 'lib/abide_dev_utils/cem/benchmark.rb', line 37

def file_path
  @file_path ||= AbideDevUtils::Ppt::ClassUtils.path_from_class_name((type == 'class' ? title : type))
end

#manifestAbideDevUtils::Ppt::CodeIntrospection::Manifest?

Returns a representation of the actual manifest backing this resource. This is used to gather information from the Puppet code about this resource.

Returns:



29
30
31
# File 'lib/abide_dev_utils/cem/benchmark.rb', line 29

def manifest
  @manifest ||= load_manifest
end

#manifest?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/abide_dev_utils/cem/benchmark.rb', line 33

def manifest?
  !manifest.nil?
end

#to_referenceObject



65
66
67
# File 'lib/abide_dev_utils/cem/benchmark.rb', line 65

def to_reference
  "#{type.split('::').map(&:capitalize).join('::')}['#{title}']"
end