Class: Cardio::Mod::Loader::SetLoader

Inherits:
Cardio::Mod::Loader show all
Defined in:
lib/cardio/mod/loader/set_loader.rb

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

Attributes inherited from Cardio::Mod::Loader

#mod_dirs

Instance Method Summary collapse

Methods inherited from Cardio::Mod::Loader

load_dir, load_initializers, load_mods, #parts_from_path, reload_sets

Constructor Details

#initialize(args = {}) ⇒ SetLoader

Returns a new instance of SetLoader.



8
9
10
11
# File 'lib/cardio/mod/loader/set_loader.rb', line 8

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



26
27
28
29
30
# File 'lib/cardio/mod/loader/set_loader.rb', line 26

def each_file &block
  pattern_groups.each do |pattern_group|
    each_file_with_patterns pattern_group, &block
  end
end

#loadObject



17
18
19
20
# File 'lib/cardio/mod/loader/set_loader.rb', line 17

def load
  super
  Card::Set.finalize_load
end

#load_strategy_class(strategy) ⇒ Object



13
14
15
# File 'lib/cardio/mod/loader/set_loader.rb', line 13

def load_strategy_class strategy
  LoadStrategy.class_for_set strategy
end

#pattern_groupsObject



32
33
34
# File 'lib/cardio/mod/loader/set_loader.rb', line 32

def pattern_groups
  Card::Set::Pattern.grouped_codes with_all: !@no_all
end

#template_classObject



22
23
24
# File 'lib/cardio/mod/loader/set_loader.rb', line 22

def template_class
  SetTemplate
end