Class: AbideDevUtils::Sce::Resource
- Inherits:
-
Object
- Object
- AbideDevUtils::Sce::Resource
- Defined in:
- lib/abide_dev_utils/sce/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
- #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
- #sce_options ⇒ Object
- #sce_options? ⇒ Boolean
- #sce_protected ⇒ Object
- #sce_protected? ⇒ 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/sce/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/sce/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/sce/benchmark.rb', line 13 def type @type end |
Instance Method Details
#controls ⇒ Object
41 42 43 |
# File 'lib/abide_dev_utils/sce/benchmark.rb', line 41 def controls @controls || load_controls end |
#dependent_controls ⇒ Object
61 62 63 |
# File 'lib/abide_dev_utils/sce/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/sce/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/sce/benchmark.rb', line 29 def manifest @manifest ||= load_manifest end |
#manifest? ⇒ Boolean
33 34 35 |
# File 'lib/abide_dev_utils/sce/benchmark.rb', line 33 def manifest? !manifest.nil? end |
#sce_options ⇒ Object
49 50 51 |
# File 'lib/abide_dev_utils/sce/benchmark.rb', line 49 def @sce_options ||= resource_properties('sce_options') end |
#sce_options? ⇒ Boolean
45 46 47 |
# File 'lib/abide_dev_utils/sce/benchmark.rb', line 45 def !.empty? end |
#sce_protected ⇒ Object
57 58 59 |
# File 'lib/abide_dev_utils/sce/benchmark.rb', line 57 def sce_protected @sce_protected ||= resource_properties('sce_protected') end |
#sce_protected? ⇒ Boolean
53 54 55 |
# File 'lib/abide_dev_utils/sce/benchmark.rb', line 53 def sce_protected? !sce_protected.empty? end |
#to_reference ⇒ Object
65 66 67 |
# File 'lib/abide_dev_utils/sce/benchmark.rb', line 65 def to_reference "#{type.split('::').map(&:capitalize).join('::')}['#{title}']" end |