class Dict
Базовый класс для словарей из Dicts.
Attributes
id[R]
index[R]
Public Class Methods
all()
click to toggle source
# File lib/c80_shared/dict.rb, line 11 def self.all constants.select { |const| (const_get const).class != Array }.map { |const| const_get const } # пока я не добавил константы типа ALL, работала эта строка: constants.map { |const| const_get const } end
find(id)
click to toggle source
# File lib/c80_shared/dict.rb, line 15 def self.find(id) all.select { |const| const.id == id.to_i }.first end
find_by_index(index)
click to toggle source
# File lib/c80_shared/dict.rb, line 19 def self.find_by_index(index) all.select { |const| const.index == index }.first end
new(id, index)
click to toggle source
# File lib/c80_shared/dict.rb, line 6 def initialize(id, index) @id = id @index = index end
where(ids)
click to toggle source
# File lib/c80_shared/dict.rb, line 23 def self.where(ids) all.select { |const| ids.include?(const.id) } end