Sha256: 8a1eaa61ba07eb641d98b1d4eae37cd4443492eb9acd6c8b74f7fa109e586053

Contents?: true

Size: 691 Bytes

Versions: 1

Compression:

Stored size: 691 Bytes

Contents

#
# Capture helper - regexen.
#
module CaptureHelper
  # Seems evil but it works. :-(
  # these do pattern matching.
  # They parse out what they say they do while allowing ANY prefix.
  # So http://localhost/v3/myserver/route/id works just like
  #    http://localhost/route/id
  #
  # Because this seems wrong, I'm leaving it notably ugly so that I'll notice
  # and maybe improve it later.
  #
  MATCH_NONSLASH = /([^\/]+)/
  MATCH_NUMBER = /([\d]+)/
  # These start with optional everythingm followed bu slash-separated matches
  COLLECTION_ONLY = /.*\/#{MATCH_NONSLASH}\/?/ # possible trailing slash
  COLLECTION_AND_ID = /.*\/#{MATCH_NONSLASH}\/#{MATCH_NUMBER}/
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
doppelserver-1.0.0 lib/doppelserver/routes/helpers/capture_helper.rb