Class: LUSI::API::Course::SyllabusRule
- Inherits:
-
Object
- Object
- LUSI::API::Course::SyllabusRule
- Defined in:
- lib/lusi_api/course.rb
Overview
Represents a syllabus rule in the LUSI API
Instance Attribute Summary collapse
-
#level ⇒ String?
The level this rule applies to (‘Module’, ‘Part II Year 3’ etc.).
-
#syllabus_rule_modules ⇒ Array<LUSI::API::Course::SyllabusRuleModule>?
The list of modules included with this rule.
-
#type ⇒ LUSI::API::Course::SyllabusRuleType
The rule type.
Instance Method Summary collapse
-
#initialize(xml = nil, lookup = nil, level: nil, syllabus_rule_modules: nil, type: nil) ⇒ void
constructor
Initialises a new SyllabusRule instance.
-
#to_s ⇒ String
Returns a string representation of the SyllabusRule instance.
Constructor Details
#initialize(xml = nil, lookup = nil, level: nil, syllabus_rule_modules: nil, type: nil) ⇒ void
Initialises a new SyllabusRule instance
1100 1101 1102 1103 1104 1105 |
# File 'lib/lusi_api/course.rb', line 1100 def initialize(xml = nil, lookup = nil, level: nil, syllabus_rule_modules: nil, type: nil) @level = LUSI::API::Core::XML.xml_content_at(xml, 'xmlns:Level', level) @syllabus_rule_modules = LUSI::API::Core::XML.xml(xml, 'xmlns:SyllabusRuleModuless/xmlns:SyllabusRuleModule', syllabus_rule_modules) { |s| SyllabusRuleModule.new(s, lookup) } @type = SyllabusRuleType.new(LUSI::API::Core::XML.xml_at(xml, 'xmlns:Type', type), lookup) end |
Instance Attribute Details
#level ⇒ String?
Returns the level this rule applies to (‘Module’, ‘Part II Year 3’ etc.).
1083 1084 1085 |
# File 'lib/lusi_api/course.rb', line 1083 def level @level end |
#syllabus_rule_modules ⇒ Array<LUSI::API::Course::SyllabusRuleModule>?
Returns the list of modules included with this rule.
1091 1092 1093 |
# File 'lib/lusi_api/course.rb', line 1091 def syllabus_rule_modules @syllabus_rule_modules end |
#type ⇒ LUSI::API::Course::SyllabusRuleType
Returns the rule type.
1087 1088 1089 |
# File 'lib/lusi_api/course.rb', line 1087 def type @type end |
Instance Method Details
#to_s ⇒ String
Returns a string representation of the SyllabusRule instance
1109 1110 1111 |
# File 'lib/lusi_api/course.rb', line 1109 def to_s "#{@level} #{@type}" end |