Class: Avo::Plugin

Inherits:
Object
  • Object
show all
Defined in:
lib/avo/plugin.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ Plugin

Returns a new instance of Plugin.



3
4
# File 'lib/avo/plugin.rb', line 3

def initialize(*, **, &block)
end

Class Method Details

.engineObject



15
16
17
# File 'lib/avo/plugin.rb', line 15

def engine
  "#{namespace}::Engine".safe_constantize
end

.gemspecObject



25
26
27
28
29
# File 'lib/avo/plugin.rb', line 25

def gemspec
  gemspec_path = Dir["#{engine.root}/*.gemspec"].first

  Gem::Specification::load(gemspec_path)
end

.nameObject



7
8
9
# File 'lib/avo/plugin.rb', line 7

def name
  gemspec.name
end

.namespaceObject



19
20
21
22
23
# File 'lib/avo/plugin.rb', line 19

def namespace
  modules = to_s.split("::")
  modules.pop
  modules.join("::")
end

.versionObject



11
12
13
# File 'lib/avo/plugin.rb', line 11

def version
  "#{namespace}::VERSION".safe_constantize
end