Class: Kriterion::Item
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#parent_uuid ⇒ Object
readonly
Returns the value of attribute parent_uuid.
-
#resources ⇒ Object
Returns the value of attribute resources.
-
#section_path ⇒ Object
readonly
Returns the value of attribute section_path.
-
#severity ⇒ Object
readonly
Returns the value of attribute severity.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#uuid ⇒ Object
readonly
Returns the value of attribute uuid.
Class Method Summary collapse
Instance Method Summary collapse
- #compliance ⇒ Object
- #expandable? ⇒ Boolean
- #expandable_keys ⇒ Object
-
#initialize(data) ⇒ Item
constructor
A new instance of Item.
- #parent_names(separator) ⇒ Object
Methods inherited from Object
#find_section, #flush_compliance!, #full_keys, #primary_key, #to_h
Constructor Details
#initialize(data) ⇒ Item
Returns a new instance of Item.
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/kriterion/item.rb', line 15 def initialize(data) super(data) @uuid = data['uuid'] || SecureRandom.uuid @id = data['id'] @title = data['title'] @description = data['description'] @severity = data['severity'] @section_path = data['section_path'] @parent_type = data['parent_type'] @parent_uuid = data['parent_uuid'] @resources = data['resources'] || [] end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
8 9 10 |
# File 'lib/kriterion/item.rb', line 8 def description @description end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
6 7 8 |
# File 'lib/kriterion/item.rb', line 6 def id @id end |
#parent_uuid ⇒ Object (readonly)
Returns the value of attribute parent_uuid.
10 11 12 |
# File 'lib/kriterion/item.rb', line 10 def parent_uuid @parent_uuid end |
#resources ⇒ Object
Returns the value of attribute resources.
13 14 15 |
# File 'lib/kriterion/item.rb', line 13 def resources @resources end |
#section_path ⇒ Object (readonly)
Returns the value of attribute section_path.
11 12 13 |
# File 'lib/kriterion/item.rb', line 11 def section_path @section_path end |
#severity ⇒ Object (readonly)
Returns the value of attribute severity.
9 10 11 |
# File 'lib/kriterion/item.rb', line 9 def severity @severity end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
7 8 9 |
# File 'lib/kriterion/item.rb', line 7 def title @title end |
#uuid ⇒ Object (readonly)
Returns the value of attribute uuid.
5 6 7 |
# File 'lib/kriterion/item.rb', line 5 def uuid @uuid end |
Class Method Details
.primary_key ⇒ Object
52 53 54 |
# File 'lib/kriterion/item.rb', line 52 def self.primary_key :id end |
Instance Method Details
#compliance ⇒ Object
29 30 31 |
# File 'lib/kriterion/item.rb', line 29 def compliance super(resources) end |
#expandable? ⇒ Boolean
44 45 46 |
# File 'lib/kriterion/item.rb', line 44 def true end |
#expandable_keys ⇒ Object
48 49 50 |
# File 'lib/kriterion/item.rb', line 48 def [:resources] end |
#parent_names(separator) ⇒ Object
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/kriterion/item.rb', line 33 def parent_names(separator) parents = [] section_path.each_index do |index| parents << section_path[0..index].join(separator) end parents.delete(id) parents.reverse end |