Class: Element
- Inherits:
-
Object
- Object
- Element
- Defined in:
- lib/Appolo/Models/element.rb
Overview
This class represent the top abstraction of an element. Specifies common behavior.
Direct Known Subclasses
Classes, CourseUnit, LectiveSemester, Lecture, Program, Resource, Student, Teacher
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#links ⇒ Object
readonly
Returns the value of attribute links.
-
#short_name ⇒ Object
readonly
Returns the value of attribute short_name.
Instance Method Summary collapse
- #check_json_info(json_info) ⇒ Object
-
#initialize(id, s_name, links, type_for_links) ⇒ Element
constructor
initializes the common behavior this class specifies.
Constructor Details
#initialize(id, s_name, links, type_for_links) ⇒ Element
initializes the common behavior this class specifies.
12 13 14 15 16 |
# File 'lib/Appolo/Models/element.rb', line 12 def initialize (id, s_name, links, type_for_links) @id = id @short_name = s_name @links = Links.new(links, type_for_links) unless links.nil? end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
8 9 10 |
# File 'lib/Appolo/Models/element.rb', line 8 def id @id end |
#links ⇒ Object (readonly)
Returns the value of attribute links.
8 9 10 |
# File 'lib/Appolo/Models/element.rb', line 8 def links @links end |
#short_name ⇒ Object (readonly)
Returns the value of attribute short_name.
8 9 10 |
# File 'lib/Appolo/Models/element.rb', line 8 def short_name @short_name end |
Instance Method Details
#check_json_info(json_info) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/Appolo/Models/element.rb', line 18 def check_json_info(json_info) if json_info.is_a? Hash json_data = json_info else json_data = JSON.parse json_info end json_data end |