Class: AbideDevUtils::CEM::Resource
- Inherits:
-
Object
- Object
- AbideDevUtils::CEM::Resource
- Defined in:
- lib/abide_dev_utils/cem/benchmark.rb
Overview
Represents a resource data resource statement
Instance Attribute Summary collapse
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #cem_options ⇒ Object
- #cem_options? ⇒ Boolean
- #cem_protected ⇒ Object
- #cem_protected? ⇒ Boolean
- #controls ⇒ Object
- #dependent_controls ⇒ Object
- #file_path ⇒ Object
-
#initialize(title, data, framework, mapper) ⇒ Resource
constructor
A new instance of Resource.
-
#manifest ⇒ AbideDevUtils::Ppt::CodeIntrospection::Manifest?
Returns a representation of the actual manifest backing this resource.
- #manifest? ⇒ Boolean
- #to_reference ⇒ Object
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
#title ⇒ Object (readonly)
Returns the value of attribute title.
13 14 15 |
# File 'lib/abide_dev_utils/cem/benchmark.rb', line 13 def title @title end |
#type ⇒ Object (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_options ⇒ Object
49 50 51 |
# File 'lib/abide_dev_utils/cem/benchmark.rb', line 49 def @cem_options ||= resource_properties('cem_options') end |
#cem_options? ⇒ Boolean
45 46 47 |
# File 'lib/abide_dev_utils/cem/benchmark.rb', line 45 def !.empty? end |
#cem_protected ⇒ Object
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
53 54 55 |
# File 'lib/abide_dev_utils/cem/benchmark.rb', line 53 def cem_protected? !cem_protected.empty? end |
#controls ⇒ Object
41 42 43 |
# File 'lib/abide_dev_utils/cem/benchmark.rb', line 41 def controls @controls || load_controls end |
#dependent_controls ⇒ Object
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_path ⇒ Object
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 |
#manifest ⇒ AbideDevUtils::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.
29 30 31 |
# File 'lib/abide_dev_utils/cem/benchmark.rb', line 29 def manifest @manifest ||= load_manifest end |
#manifest? ⇒ Boolean
33 34 35 |
# File 'lib/abide_dev_utils/cem/benchmark.rb', line 33 def manifest? !manifest.nil? end |
#to_reference ⇒ Object
65 66 67 |
# File 'lib/abide_dev_utils/cem/benchmark.rb', line 65 def to_reference "#{type.split('::').map(&:capitalize).join('::')}['#{title}']" end |