Class: String

Inherits:
Object show all
Defined in:
lib/friendly_id.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) parse_friendly_id(separator = nil)



58
59
60
61
62
# File 'lib/friendly_id.rb', line 58

def parse_friendly_id(separator = nil)
  separator ||= FriendlyId::Configuration::DEFAULTS[:sequence_separator]
  name, sequence = split(/#{Regexp.escape(separator)}(\d+)?\z/)
  return name, (sequence ||= 1).to_i
end