Class: CommonCoreParser::Standard
- Inherits:
-
Element
show all
- Defined in:
- lib/common_core_parser/elements/standard.rb
Instance Attribute Summary
Attributes inherited from Element
#children_hash, #data
Instance Method Summary
collapse
Methods inherited from Element
#add_child, #children, #code, #grades, #illigit?, #initialize, #parent, #parent_ref_id, #ref_id, #statement, #to_s, #valid?, #valid_grades?
Instance Method Details
18
19
20
|
# File 'lib/common_core_parser/elements/standard.rb', line 18
def cluster
@cluster ||= self.parent.is_a?(Cluster) ? self.parent : nil
end
|
22
23
24
|
# File 'lib/common_core_parser/elements/standard.rb', line 22
def domain
@domain ||= cluster ? cluster.parent : self.parent
end
|
#error_message ⇒ Object
14
15
16
|
# File 'lib/common_core_parser/elements/standard.rb', line 14
def error_message
errors.join(',')
end
|
4
5
6
7
8
9
10
11
12
|
# File 'lib/common_core_parser/elements/standard.rb', line 4
def errors
errors = []
errors << 'Refid is blank' if ref_id.blank?
errors << 'PRI is blank' if parent_ref_id.blank?
errors << 'Code is blank' if code.blank?
errors << 'Statement is blank' if statement.blank?
errors << 'invalid grades' unless valid_grades?
return errors
end
|
26
27
28
|
# File 'lib/common_core_parser/elements/standard.rb', line 26
def subject
@subject ||= domain.try(:parent)
end
|