0.0
No commit activity in last 3 years
No release in over 3 years
Find the type of data a string contains
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 1.3
>= 0
 Project Readme

Lexigrapher

Code Climate

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!