0

I want to get anchor value from URL using ruby.

http://{My-Domain}/signin#recording

Want to get #recording value.

1 Answers1

3

You can use URI.parse to parse the URL, and then look for the attribute fragment:

require 'uri'

url = 'http://www.example.com/signin#recording'
uri = URI.parse url
uri.fragment
# => "recording"
Uri Agassi
  • 35,245
  • 12
  • 68
  • 90