Class: Data_list
- Inherits:
-
Object
- Object
- Data_list
- Defined in:
- lib/files/Data_list.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#list ⇒ Object
Returns the value of attribute list.
Instance Method Summary collapse
- #get_data ⇒ Object
- #get_names ⇒ Object
- #get_selected ⇒ Object
-
#initialize(list:) ⇒ Data_list
constructor
A new instance of Data_list.
- #select(number) ⇒ Object
- #unselect ⇒ Object
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
#list ⇒ Object
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_data ⇒ Object
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_names ⇒ Object
23 24 25 |
# File 'lib/files/Data_list.rb', line 23 def get_names return ["№", *get_objects_attr_names] end |
#get_selected ⇒ Object
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 |
#unselect ⇒ Object
13 14 15 |
# File 'lib/files/Data_list.rb', line 13 def unselect self.arary = [] end |