Sha256: 8181d6423c9bf8e58d1f582aea052e819e6bfdcca9ea217786a3348154064fa4
Contents?: true
Size: 1.09 KB
Versions: 14
Compression:
Stored size: 1.09 KB
Contents
class Card module Set class Type < Pattern::Base def initialize card super # support type inheritance @inherit_card = card unless module_key end def lookup_module_list modules_hash lookup_key = module_key || inherited_key modules_hash[lookup_key] if lookup_key end private def inherited_key if defined?(@inherited_key) @inherited_key else @inherited_key = lookup_inherited_key end end def lookup_inherited_key return unless (card = @inherit_card) @inherit_card = nil return unless (type_code = default_type_code card) mod_key = "Type::#{type_code.to_s.camelize}" mod_key if mods_exist_for_key? mod_key end def default_type_code card card.rule_card(:default)&.type_code end def mods_exist_for_key? mod_key list_of_hashes = Card::Set.modules[:nonbase_format].values list_of_hashes << Card::Set.modules[:nonbase] list_of_hashes.any? { |h| h[mod_key] } end end end end
Version data entries
14 entries across 14 versions & 1 rubygems