Method: Highway::Steps::Registry.new_and_load_default_library
- Defined in:
- lib/highway/steps/registry.rb
permalink .new_and_load_default_library ⇒ Highway::Steps::Registry
Initialize an instance and automatically load all steps in the default library.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/highway/steps/registry.rb', line 25 def self.new_and_load_default_library() registry = self.new() Dir[File.('library/*.rb', File.dirname(__FILE__))].each do |file| require(file) end unless Highway::Steps.const_defined?("Library") return end Highway::Steps::Library.constants.each do |step_symbol| step_class = Highway::Steps::Library.const_get(step_symbol) if step_class_valid?(step_class) registry.register(step_class) end end registry end |