Class: Data_list

Inherits:
Object
  • Object
show all
Defined in:
lib/files/Data_list.rb

Direct Known Subclasses

Data_List_Student_Short

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(list:) ⇒ Data_list

Returns a new instance of Data_list.



8
9
10
11
# File 'lib/files/Data_list.rb', line 8

def initialize(list:)
  self.list = list
  self.arary = []
end

Instance Attribute Details

#listObject

Returns the value of attribute list.



6
7
8
# File 'lib/files/Data_list.rb', line 6

def list
  @list
end

Instance Method Details

#get_dataObject



26
27
28
29
30
31
# File 'lib/files/Data_list.rb', line 26

def get_data
  table = []
  counter = 0
  list.each { |obj| table.append([counter, *get_objects_attr(obj)]); counter += 1}
  return Data_table.new(table: table)
end

#get_namesObject



23
24
25
# File 'lib/files/Data_list.rb', line 23

def get_names
  return ["", *get_objects_attr_names]
end

#get_selectedObject



20
21
22
# File 'lib/files/Data_list.rb', line 20

def get_selected
  self.arary
end

#select(number) ⇒ Object



17
18
19
# File 'lib/files/Data_list.rb', line 17

def select(number)
  self.arary.append(self.list[number].ID)
end

#unselectObject



13
14
15
# File 'lib/files/Data_list.rb', line 13

def unselect
  self.arary = []
end