Module: RedminePluginKit::PluginBase::ClassMethods

Defined in:
lib/redmine_plugin_kit/plugin_base.rb

Instance Method Summary collapse

Instance Method Details

#loaderObject



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

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

#plugin_idObject



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

def plugin_id
  to_s.underscore
end

#setting(value) ⇒ Object

support with default setting as fall back



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

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

#setting?(value) ⇒ Boolean

Returns:

  • (Boolean)


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

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

#setup!(existing_loader = nil) ⇒ Object



10
11
12
13
14
15
# 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
end