Module: Ronin::Core::Params::Types

Defined in:
lib/ronin/core/params/types.rb,
lib/ronin/core/params/types/uri.rb,
lib/ronin/core/params/types/enum.rb,
lib/ronin/core/params/types/type.rb,
lib/ronin/core/params/types/float.rb,
lib/ronin/core/params/types/regexp.rb,
lib/ronin/core/params/types/string.rb,
lib/ronin/core/params/types/boolean.rb,
lib/ronin/core/params/types/integer.rb,
lib/ronin/core/params/types/numeric.rb

Overview

Contains all Types classes.

Defined Under Namespace

Classes: Boolean, Enum, Float, Integer, Numeric, Regexp, String, Type, URI

Constant Summary collapse

TYPE_ALIASES =

Mapping of ruby core classes to param types.

{
  ::String  => Types::String,
  ::Integer => Types::Integer,
  ::Float   => Types::Float,
  ::Regexp  => Types::Regexp,
  ::URI     => Types::URI
}

Class Method Summary collapse

Class Method Details

.lookup(type_class) ⇒ Class<Types::Type>

Looks up a type class.

Parameters:

  • type_class (Class)

    The ruby class to map to a param type class.

Returns:



53
54
55
56
57
58
59
60
61
# File 'lib/ronin/core/params/types.rb', line 53

def self.lookup(type_class)
  if type_class < Type
    type_class
  else
    TYPE_ALIASES.fetch(type_class) do
      raise(UnknownType,"unknown param type: #{type_class.inspect}")
    end
  end
end