Module: RedminePluginKit

Defined in:
lib/redmine_plugin_kit.rb,
lib/redmine_plugin_kit/debug.rb,
lib/redmine_plugin_kit/engine.rb,
lib/redmine_plugin_kit/loader.rb,
lib/redmine_plugin_kit/version.rb,
lib/redmine_plugin_kit/plugin_base.rb,
lib/redmine_plugin_kit/helpers/global_helper.rb

Defined Under Namespace

Modules: Helpers, PluginBase Classes: Debug, Engine, Loader

Constant Summary collapse

VERSION =
'1.0.6'

Class Method Summary collapse

Class Method Details

.false?(value) ⇒ Boolean

false if false or nil

Returns:

  • (Boolean)


25
26
27
# File 'lib/redmine_plugin_kit.rb', line 25

def false?(value)
  !true?(value)
end

.textarea_cols(text, min: 8, max: 20) ⇒ Object



29
30
31
# File 'lib/redmine_plugin_kit.rb', line 29

def textarea_cols(text, min: 8, max: 20)
  [[min, text.to_s.length / 50].max, max].min # rubocop: disable Style/ComparableClamp
end

.true?(value) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
20
21
22
# File 'lib/redmine_plugin_kit.rb', line 17

def true?(value)
  return false if value.is_a? FalseClass
  return true if value.is_a?(TrueClass) || value.to_i == 1 || value.to_s.casecmp('true').zero?

  false
end