Class: Cardio::Mod::Loader::SetLoader
Overview
A SetLoader object loads all set modules for a list of mods. The mods are given by a Mod::Dirs object. SetLoader can use three different strategies to load the set modules.
Instance Attribute Summary
#mod_dirs
Instance Method Summary
collapse
load_dir, load_initializers, load_mods, #parts_from_path, reload_sets
Constructor Details
#initialize(args = {}) ⇒ SetLoader
Returns a new instance of SetLoader.
12
13
14
15
|
# File 'lib/cardio/mod/loader/set_loader.rb', line 12
def initialize args={}
@no_all = args.delete :no_all
super load_strategy: args[:load_strategy], mod_dirs: args[:mod_dirs]
end
|
Instance Method Details
#each_file(&block) ⇒ Object
33
34
35
36
|
# File 'lib/cardio/mod/loader/set_loader.rb', line 33
def each_file &block
each_file_with_patterns(*main_patterns, &block)
end
|
#each_file_with_patterns(*patterns, &block) ⇒ Object
38
39
40
41
42
43
44
|
# File 'lib/cardio/mod/loader/set_loader.rb', line 38
def each_file_with_patterns *patterns, &block
each_mod_dir :set do |base_dir|
patterns.each do |pattern|
each_file_in_dir base_dir, pattern.to_s, &block
end
end
end
|
#load_strategy_class(strategy) ⇒ Object
17
18
19
|
# File 'lib/cardio/mod/loader/set_loader.rb', line 17
def load_strategy_class strategy
LoadStrategy.class_for_set strategy
end
|
#main_patterns ⇒ Object
does not include abstract
28
29
30
31
|
# File 'lib/cardio/mod/loader/set_loader.rb', line 28
def main_patterns
method = @no_all ? :nonbase_codes : :codes
Card::Set::Pattern.send method
end
|
#template_class ⇒ Object
8
9
10
|
# File 'lib/cardio/mod/loader/set_loader.rb', line 8
def template_class
SetTemplate
end
|