Sha256: f969280daf3b4b34a7fe6cdf282ad3cc39176c3fd82dc910e1ec67c026af29ae

Contents?: true

Size: 1.01 KB

Versions: 24

Compression:

Stored size: 1.01 KB

Contents

module Browser
  class Location
    if RUBY_ENGINE == 'opal'
      include Native::Wrapper

      alias_native :hash
      alias_native :host
      alias_native :hostname
      alias_native :href
      alias_native :origin
      alias_native :pathname
      alias_native :port
      alias_native :protocol
      alias_native :search
    else
      def initialize(location_string)
        @location = URI(location_string)
      rescue
        @location = URI('http://localhost/')
      end

      def hash
        @location.hash
      end

      def host
        @location.host
      end

      def hostname
        @location.hostname
      end

      def href
        @location.to_s
      end

      def origin
        @location.origin
      end

      def pathname
        @location.path
      end

      def port
        @location.port
      end

      def protocol
        @location.scheme
      end

      def search
        @location.query
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
isomorfeus-preact-23.8.0.rc3 lib/browser/location.rb
isomorfeus-preact-23.8.0.rc2 lib/browser/location.rb
isomorfeus-preact-23.8.0.rc1 lib/browser/location.rb
isomorfeus-preact-23.7.0.rc5 lib/browser/location.rb
isomorfeus-preact-23.7.0.rc4 lib/browser/location.rb
isomorfeus-preact-23.7.0.rc3 lib/browser/location.rb
isomorfeus-preact-23.7.0.rc2 lib/browser/location.rb
isomorfeus-preact-23.7.0.rc1 lib/browser/location.rb
isomorfeus-preact-23.6.0.rc5 lib/browser/location.rb
isomorfeus-preact-23.6.0.rc4 lib/browser/location.rb
isomorfeus-preact-23.6.0.rc3 lib/browser/location.rb
isomorfeus-preact-23.6.0.rc2 lib/browser/location.rb
isomorfeus-preact-23.6.0.rc1 lib/browser/location.rb
isomorfeus-preact-23.1.0.rc2 lib/browser/location.rb
isomorfeus-preact-23.1.0.rc1 lib/browser/location.rb
isomorfeus-preact-22.11.0.rc1 lib/browser/location.rb
isomorfeus-preact-22.10.0.rc2 lib/browser/location.rb
isomorfeus-preact-22.10.0.rc1 lib/browser/location.rb
isomorfeus-preact-22.9.0.rc9 lib/browser/location.rb
isomorfeus-preact-22.9.0.rc8 lib/browser/location.rb