pluginator 0.9.1 → 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/lib/pluginator.rb +12 -0
  2. data/pluginator.gemspec +1 -1
  3. metadata +1 -1
data/lib/pluginator.rb CHANGED
@@ -45,6 +45,15 @@ class Pluginator
45
45
  classes
46
46
  end
47
47
 
48
+ def register_plugin_class type, klass
49
+ type = type.to_s
50
+ name = class2name(klass)
51
+ @plugins[type] ||= {}
52
+ if @plugins[type][name].nil?
53
+ @plugins[type][name] = klass
54
+ end
55
+ end
56
+
48
57
  private
49
58
 
50
59
  def detect
@@ -79,4 +88,7 @@ private
79
88
  klass
80
89
  end
81
90
 
91
+ def class2name klass
92
+ klass.gsub(/([A-Z])/){|x| "_#{x.downcase}"}.gsub(/(^_|::_)/,"/")[1..-1]
93
+ end
82
94
  end
data/pluginator.gemspec CHANGED
@@ -5,7 +5,7 @@ Gem::Specification.new do |s|
5
5
  s.email = ["mpapis@gmail.com"]
6
6
  s.authors = ["Michal Papis"]
7
7
  s.name = "pluginator"
8
- s.version = "0.9.1"
8
+ s.version = "0.9.2"
9
9
  s.files = `git ls-files`.split("\n")
10
10
  s.required_ruby_version = ">= 1.9.2"
11
11
  s.add_development_dependency("simplecov")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pluginator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: