Class: AcademicBenchmarks::Standards::Authority

Inherits:
Object
  • Object
show all
Includes:
InstVarsToHash, RemoveObsoleteChildren
Defined in:
lib/academic_benchmarks/standards/authority.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from RemoveObsoleteChildren

#remove_obsolete_children

Methods included from InstVarsToHash

#to_h, #to_json, #to_s

Constructor Details

#initialize(code:, guid:, description:, children: []) ⇒ Authority

Returns a new instance of Authority.



22
23
24
25
26
27
# File 'lib/academic_benchmarks/standards/authority.rb', line 22

def initialize(code:, guid:, description:, children: [])
  @code = code
  @guid = guid
  @description = description
  @children = children
end

Instance Attribute Details

#childrenObject

Returns the value of attribute children.



10
11
12
# File 'lib/academic_benchmarks/standards/authority.rb', line 10

def children
  @children
end

#codeObject

Returns the value of attribute code.



10
11
12
# File 'lib/academic_benchmarks/standards/authority.rb', line 10

def code
  @code
end

#descriptionObject Also known as: descr

Returns the value of attribute description.



10
11
12
# File 'lib/academic_benchmarks/standards/authority.rb', line 10

def description
  @description
end

#guidObject

Returns the value of attribute guid.



10
11
12
# File 'lib/academic_benchmarks/standards/authority.rb', line 10

def guid
  @guid
end

Class Method Details

.from_hash(hash) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/academic_benchmarks/standards/authority.rb', line 14

def self.from_hash(hash)
  self.new(
    code: hash["code"],
    guid: hash["guid"],
    description: (hash["descr"] || hash["description"])
  )
end