class RubiLive::Unit
Constants
- ConfigPath
Public Class Methods
config()
click to toggle source
# File lib/rubi_live/unit.rb, line 20 def config @config ||= YAML.load_file(ConfigPath).deep_symbolize_keys end
find(name)
click to toggle source
# File lib/rubi_live/unit.rb, line 24 def find(name) unit_name = name.to_sym raise UnknownUnitError unless valid?(unit_name) @cache ||= {} unless @cache[unit_name] unit_config = config[unit_name] @cache[unit_name] = RubiLive::Unit[unit_config] end @cache[unit_name] end
names()
click to toggle source
# File lib/rubi_live/unit.rb, line 37 def names config.keys end
valid?(unit_name)
click to toggle source
# File lib/rubi_live/unit.rb, line 41 def valid?(unit_name) names.include?(unit_name) end
Public Instance Methods
each(&block)
click to toggle source
# File lib/rubi_live/unit.rb, line 12 def each(&block) members.each(&block) end
members()
click to toggle source
# File lib/rubi_live/unit.rb, line 6 def members self[:idols].map do |member| RubiLive::Idol.find(member.to_sym) end end