Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move internal modules under WaybackMachineDownloader namespace #110

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/wayback_machine_downloader/archive_api.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
module ArchiveAPI
class WaybackMachineDownloader; end

module WaybackMachineDownloader::ArchiveAPI

def get_raw_list_from_api url, page_index
request_url = "http://web.archive.org/cdx/search/xd?url="
Expand Down
8 changes: 5 additions & 3 deletions lib/wayback_machine_downloader/tidy_bytes.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
module TibyBytes
class WaybackMachineDownloader; end

module WaybackMachineDownloader::TidyBytes

# CP-1252 decimal byte => UTF-8 approximation as an array of bytes
CP1252 = {
Expand Down Expand Up @@ -111,12 +113,12 @@ def tidy_bytes!(force = false)
private

def tidy_byte(byte)
byte < 160 ? TibyBytes::CP1252[byte] : byte < 192 ? [194, byte] : [195, byte - 64]
byte < 160 ? CP1252[byte] : byte < 192 ? [194, byte] : [195, byte - 64]
end

end
end

class String
include TibyBytes::StringMixin
include WaybackMachineDownloader::TidyBytes::StringMixin
end
6 changes: 4 additions & 2 deletions lib/wayback_machine_downloader/to_regex.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
module ToRegex
class WaybackMachineDownloader; end

module WaybackMachineDownloader::ToRegex
module StringMixin
class << self
def literal?(str)
Expand Down Expand Up @@ -77,5 +79,5 @@ def as_regexp(options = {})
end

class String
include ToRegex::StringMixin
include WaybackMachineDownloader::ToRegex::StringMixin
end