Class: Avo::Plugin
- Inherits:
-
Object
- Object
- Avo::Plugin
- Defined in:
- lib/avo/plugin.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#priority ⇒ Object
readonly
Returns the value of attribute priority.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name:, priority:, &block) ⇒ Plugin
constructor
A new instance of Plugin.
- #to_s ⇒ Object
Constructor Details
#initialize(name:, priority:, &block) ⇒ Plugin
Returns a new instance of Plugin.
8 9 10 11 |
# File 'lib/avo/plugin.rb', line 8 def initialize(*, name:, priority:, **, &block) @name = name @priority = priority end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/avo/plugin.rb', line 3 def name @name end |
#priority ⇒ Object (readonly)
Returns the value of attribute priority.
4 5 6 |
# File 'lib/avo/plugin.rb', line 4 def priority @priority end |
Class Method Details
.engine ⇒ Object
28 29 30 |
# File 'lib/avo/plugin.rb', line 28 def engine "#{namespace}::Engine".safe_constantize end |
.gemspec ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/avo/plugin.rb', line 38 def gemspec return if engine.blank? gemspec_path = Dir["#{engine.root}/*.gemspec"].first Gem::Specification::load(gemspec_path) end |
.name ⇒ Object
18 19 20 21 22 |
# File 'lib/avo/plugin.rb', line 18 def name return gemspec.name if gemspec.present? self.to_s.split("::").first end |
.namespace ⇒ Object
32 33 34 35 36 |
# File 'lib/avo/plugin.rb', line 32 def namespace modules = to_s.split("::") modules.pop modules.join("::") end |
.version ⇒ Object
24 25 26 |
# File 'lib/avo/plugin.rb', line 24 def version "#{namespace}::VERSION".safe_constantize end |
Instance Method Details
#to_s ⇒ Object
13 14 15 |
# File 'lib/avo/plugin.rb', line 13 def to_s "#{name}-#{version}" end |