Class: Redmine::PluginPath

Inherits:
Object
  • Object
show all
Defined in:
lib/redmine/plugin_loader.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dir) ⇒ PluginPath

Returns a new instance of PluginPath.



24
25
26
27
28
# File 'lib/redmine/plugin_loader.rb', line 24

def initialize(dir)
  @dir = dir
  @assets_dir = File.join dir, 'assets'
  @initializer = File.join dir, 'init.rb'
end

Instance Attribute Details

#assets_dirObject (readonly)

Returns the value of attribute assets_dir.



22
23
24
# File 'lib/redmine/plugin_loader.rb', line 22

def assets_dir
  @assets_dir
end

#initializerObject (readonly)

Returns the value of attribute initializer.



22
23
24
# File 'lib/redmine/plugin_loader.rb', line 22

def initializer
  @initializer
end

Instance Method Details

#has_assets_dir?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/redmine/plugin_loader.rb', line 38

def has_assets_dir?
  File.directory?(@assets_dir)
end

#has_initializer?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/redmine/plugin_loader.rb', line 42

def has_initializer?
  File.file?(@initializer)
end

#run_initializerObject



30
31
32
# File 'lib/redmine/plugin_loader.rb', line 30

def run_initializer
  load initializer if has_initializer?
end

#to_sObject



34
35
36
# File 'lib/redmine/plugin_loader.rb', line 34

def to_s
  @dir
end