Class: Card::TypeSet
Instance Method Summary
collapse
Methods inherited from SetPattern
#anchor_codenames, anchorless?, find, #format_module_list, #inspect, junction_only?, #module_key, #module_list, new, pattern, #pattern, pattern_applies?, register, #rule_set_key, #safe_key, #to_s, write_tmp_file
Constructor Details
#initialize(card) ⇒ TypeSet
Returns a new instance of TypeSet.
141
142
143
144
|
# File 'lib/card/set_pattern.rb', line 141
def initialize card
super
@inherit_card = card unless module_key
end
|
Instance Method Details
#inherited_key ⇒ Object
160
161
162
|
# File 'lib/card/set_pattern.rb', line 160
def inherited_key
(defined? @inherited_key) ? @inherited_key : @inherited_key = lookup_inherited_key
end
|
#lookup_inherited_key ⇒ Object
146
147
148
149
150
151
152
153
154
155
156
157
158
|
# File 'lib/card/set_pattern.rb', line 146
def lookup_inherited_key
return unless @inherit_card
card, @inherit_card = @inherit_card, nil
default_rule = card.rule_card(:default) and
type_code = default_rule.type_code and
mod_key = "Type::#{type_code.to_s.camelize}" and
( Card::Set.modules[:nonbase_format].values +
[Card::Set.modules[:nonbase]] ).any?{|hash| hash[mod_key]} and
mod_key
end
|
#lookup_module_list(modules_hash) ⇒ Object
164
165
166
|
# File 'lib/card/set_pattern.rb', line 164
def lookup_module_list modules_hash
module_key ? modules_hash[ module_key ] : inherited_key && modules_hash[ inherited_key ]
end
|