class Kriterion::Item

Attributes

description[R]
id[R]
parent_uuid[R]
resources[RW]
section_path[R]
severity[R]
title[R]
uuid[R]

Public Class Methods

new(data) click to toggle source
Calls superclass method Kriterion::Object::new
# 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
primary_key() click to toggle source
# File lib/kriterion/item.rb, line 52
def self.primary_key
  :id
end

Public Instance Methods

compliance() click to toggle source
Calls superclass method Kriterion::Object#compliance
# File lib/kriterion/item.rb, line 29
def compliance
  super(resources)
end
expandable?() click to toggle source
# File lib/kriterion/item.rb, line 44
def expandable?
  true
end
expandable_keys() click to toggle source
# File lib/kriterion/item.rb, line 48
def expandable_keys
  [:resources]
end
parent_names(separator) click to toggle source
# 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