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
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
# File 'lib/doing/plugin_manager.rb', line 124 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.new('Invalid plugin type', 'unrecognized') end type.to_sym end |