class NHKProgram::Enumeration
Attributes
id[R]
name[R]
Public Class Methods
find_by_id(id)
click to toggle source
Find enumerable object by bame
@param id [Symbol, String] @return [Enumeration]
# File lib/nhk_program/enumeration.rb, line 12 def self.find_by_id(id) mappings[id.to_s] end
find_by_name(name)
click to toggle source
Find enumerable object by bame
@param name [Symbol, String] @return [Enumeration]
# File lib/nhk_program/enumeration.rb, line 20 def self.find_by_name(name) name = name.to_s mappings.values.find do |value| value.name == name end end
Private Class Methods
define(id, name)
click to toggle source
@private
# File lib/nhk_program/enumeration.rb, line 34 def self.define(id, name) id, name = id.to_s, name.to_s instance = new instance.instance_variable_set(:@id, id) instance.instance_variable_set(:@name, name) mappings[id] = instance end
mappings()
click to toggle source
@private
# File lib/nhk_program/enumeration.rb, line 28 def self.mappings @mappings ||= {} end