Module: Rounders::Plugins::Pluggable::ClassMethods

Defined in:
lib/rounders/plugins/pluggable.rb

Instance Method Summary collapse

Instance Method Details

#directory_nameObject



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_nameObject



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_pathObject



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_pluginsObject



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.expand_path
    rescue => e
      Rounders.logger.error e
    end
  end
end

#symbolObject



25
26
27
# File 'lib/rounders/plugins/pluggable.rb', line 25

def symbol
  Util.infrect(name.split('::').last).underscore.to_sym
end