Method: Doing::Plugins.valid_type
- Defined in:
- lib/doing/plugin_manager.rb
.valid_type(type, default: nil) ⇒ Symbol
Converts a partial symbol to a valid plugin type, e.g. :imp => :import
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/doing/plugin_manager.rb', line 106 def valid_type(type, default: nil) type ||= default t = type.to_s type = case t when /^i(m(p(o(r(t)?)?)?)?)?$/ :import when /^e(x(p(o(r(t)?)?)?)?)?$/ :export else raise Errors::InvalidPluginType, 'Invalid plugin type' end type.to_sym end |