Module: OrbitalFields::ShortId::ClassMethods
- Defined in:
- lib/orbital_fields/short_id.rb
Instance Method Summary collapse
Instance Method Details
#find_by_short_id(input) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/orbital_fields/short_id.rb', line 7 def find_by_short_id(input) return nil unless input =~ /[a-z0-9]{1,19}/i id = input.upcase.from_base_36.to_base_16.downcase return nil if id.length > 24 id = id.rjust(24, "0") if id.length < 24 find(id) end |