-
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implement Page#geolocation= and BrowserContext#override_permissions
- Loading branch information
1 parent
578b940
commit 72c08e6
Showing
4 changed files
with
71 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
class Puppeteer::Geolocation | ||
# @param latitude [Fixnum] | ||
# @param longitude [Fixnum] | ||
# @param accuracy [Fixnum] | ||
def initialize(latitude:, longitude:, accuracy: 0) | ||
unless (-180..180).include?(longitude) | ||
raise ArgumentError.new("Invalid longitude \"#{longitude}\": precondition -180 <= LONGITUDE <= 180 failed.") | ||
end | ||
unless (-90..90).include?(latitude) | ||
raise ArgumentError.new("Invalid latitude \"#{latitude}\": precondition -90 <= LATITUDE <= 90 failed.") | ||
end | ||
if accuracy < 0 | ||
raise ArgumentError.new("Invalid accuracy \"#{longitude}\": precondition 0 <= ACCURACY failed.") | ||
end | ||
|
||
@latitude = latitude | ||
@longitude = longitude | ||
@accuracy = accuracy | ||
end | ||
|
||
def to_h | ||
{ latitude: @latitude, longitude: @longitude, accuracy: @accuracy } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters