Lexigrapher
Find the type of a string. In some cases, you have a data type in a string, and you know exactly what it is. Now Ruby can too!
It's as simple as:
Lexigrapher::Parser.new('0xFFF').type
...and voila! You get your type as a symbol!
:integer
What does it try and match against?
To quote the source, and to give you the parser order:
def methods
[
:int?, :float?, :symbol?, :hash?, :array?, # Primatives
:date?, :phone?, :email?, :url?, :ipv4?, :ipv6?, :gender?, # Extensions
:str?, :nil?, :unknown? # Primitives fallback
]
end
Want more checks? Log an issue and let me know!