class Kriterion::Standard
Attributes
date[RW]
description[RW]
item_syntax[RW]
items[RW]
name[RW]
section_separator[RW]
sections[RW]
title[RW]
uuid[RW]
version[RW]
Public Class Methods
get(name)
click to toggle source
# File lib/kriterion/standard.rb, line 37 def self.get(name) # Reload all standards Kriterion::Standard.reload_all! results = @@standards.select { |s| s.name == name } case results.length when 0 raise "No standards found with name: #{name}" when 1 results.first else raise "Multiple standards found with #{name}" end end
new(data)
click to toggle source
Calls superclass method
Kriterion::Object::new
# File lib/kriterion/standard.rb, line 19 def initialize(data) super(data) @uuid = data['uuid'] || SecureRandom.uuid @name = data['name'] @date = data['date'] @description = data['description'] @title = data['title'] @version = data['version'] @item_syntax = if data['item_syntax'].is_a? Regexp data['item_syntax'] else Regexp.new(data['item_syntax']) end @section_separator = data['section_separator'] @sections = data['sections'] || [] @items = data['items'] || [] end
reload_all!()
click to toggle source
# File lib/kriterion/standard.rb, line 53 def self.reload_all! backend = Kriterion::Backend.get @@standards = backend.standards end
Public Instance Methods
compliance()
click to toggle source
Calls superclass method
Kriterion::Object#compliance
# File lib/kriterion/standard.rb, line 73 def compliance super([items, sections].flatten) end
expandable?()
click to toggle source
# File lib/kriterion/standard.rb, line 58 def expandable? true end
expandable_keys()
click to toggle source
# File lib/kriterion/standard.rb, line 62 def expandable_keys %i[ sections items ] end
type()
click to toggle source
# File lib/kriterion/standard.rb, line 69 def type :standard end