Module: RedminePluginKit::PluginBase::ClassMethods

Defined in:
lib/redmine_plugin_kit/plugin_base.rb

Instance Method Summary collapse

Instance Method Details

#loaderObject



22
23
24
# File 'lib/redmine_plugin_kit/plugin_base.rb', line 22

def loader
  @loader ||= RedminePluginKit::Loader.new plugin_id: plugin_id
end

#plugin_idObject



18
19
20
# File 'lib/redmine_plugin_kit/plugin_base.rb', line 18

def plugin_id
  to_s.underscore
end

#setting(value) ⇒ Object

support with default setting as fall back



27
28
29
30
31
32
33
# File 'lib/redmine_plugin_kit/plugin_base.rb', line 27

def setting(value)
  if settings.key? value
    settings[value]
  else
    loader.default_settings[value]
  end
end

#setting?(value) ⇒ Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/redmine_plugin_kit/plugin_base.rb', line 35

def setting?(value)
  RedminePluginKit.true? setting(value)
end

#setup!(existing_loader = nil) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/redmine_plugin_kit/plugin_base.rb', line 10

def setup!(existing_loader = nil)
  init_loader existing_loader
  raise "no loader for #{plugin_id}" if loader.nil?

  setup_required_plugins
  setup
end