Module: Rounders::Plugins::Pluggable::ClassMethods
- Defined in:
- lib/rounders/plugins/pluggable.rb
Instance Method Summary collapse
- #directory_name ⇒ Object
- #feature_name ⇒ Object
- #load_path ⇒ Object
- #load_plugins ⇒ Object
- #symbol ⇒ Object
Instance Method Details
#directory_name ⇒ Object
21 22 23 |
# File 'lib/rounders/plugins/pluggable.rb', line 21 def directory_name @directory_name ||= Util.infrect(feature_name.split('_').first).pluralize end |
#feature_name ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/rounders/plugins/pluggable.rb', line 13 def feature_name @feature_name ||= begin name_spaces = name.to_s.split('::') class_name = name_spaces.last Rounders::Util.infrect(class_name).underscore end end |
#load_path ⇒ Object
29 30 31 |
# File 'lib/rounders/plugins/pluggable.rb', line 29 def load_path @load_path ||= File.join(Rounders::APP_PATH, directory_name) end |
#load_plugins ⇒ Object
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/rounders/plugins/pluggable.rb', line 33 def load_plugins Pathname.glob("#{load_path}/**/*.rb").each do |plugin| begin Rounders.logger.info "load #{plugin.expand_path}" require_relative plugin. rescue => e Rounders.logger.error e end end end |
#symbol ⇒ Object
25 26 27 |
# File 'lib/rounders/plugins/pluggable.rb', line 25 def symbol Util.infrect(name.split('::').last).underscore.to_sym end |