Sha256: 955ded08e0637faa404e9973058676841ba86c91b496d52b0b946282aedc7933

Contents?: true

Size: 633 Bytes

Versions: 122

Compression:

Stored size: 633 Bytes

Contents

# frozen_string_literal: true

require 'aranha/parsers/source_address/http_get'

module Aranha
  module Parsers
    class SourceAddress
      class File < ::Aranha::Parsers::SourceAddress::HttpGet
        SCHEME = 'file://'

        class << self
          def valid_source?(source)
            source.to_s.start_with?(SCHEME + '/', '/')
          end
        end

        def initialize(source)
          super source.to_s.gsub(/\A#{Regexp.quote(SCHEME)}/, '')
        end

        def url
          "#{SCHEME}#{source}"
        end

        def content
          ::File.open(source, &:read)
        end
      end
    end
  end
end

Version data entries

122 entries across 122 versions & 4 rubygems

Version Path
eac_tools-0.60.2 sub/aranha-parsers/lib/aranha/parsers/source_address/file.rb
eac_tools-0.60.1 sub/aranha-parsers/lib/aranha/parsers/source_address/file.rb
aranha-parsers-0.17.1 lib/aranha/parsers/source_address/file.rb
eac_tools-0.60.0 sub/aranha-parsers/lib/aranha/parsers/source_address/file.rb
eac_tools-0.59.0 sub/aranha-parsers/lib/aranha/parsers/source_address/file.rb
eac_tools-0.58.0 sub/aranha-parsers/lib/aranha/parsers/source_address/file.rb
eac_tools-0.57.0 sub/aranha-parsers/lib/aranha/parsers/source_address/file.rb
eac_tools-0.56.1 sub/aranha-parsers/lib/aranha/parsers/source_address/file.rb
eac_tools-0.56.0 sub/aranha-parsers/lib/aranha/parsers/source_address/file.rb
eac_tools-0.55.7 sub/aranha-parsers/lib/aranha/parsers/source_address/file.rb
eac_tools-0.55.6 sub/aranha-parsers/lib/aranha/parsers/source_address/file.rb
eac_tools-0.55.5 sub/aranha-parsers/lib/aranha/parsers/source_address/file.rb
eac_tools-0.55.4 sub/aranha-parsers/lib/aranha/parsers/source_address/file.rb
aranha-parsers-0.17.0 lib/aranha/parsers/source_address/file.rb
eac_tools-0.55.3 sub/aranha-parsers/lib/aranha/parsers/source_address/file.rb
aranha-parsers-0.16.0 lib/aranha/parsers/source_address/file.rb
eac_tools-0.55.2 sub/aranha-parsers/lib/aranha/parsers/source_address/file.rb
aranha-parsers-0.15.1 lib/aranha/parsers/source_address/file.rb
aranha-parsers-0.15.0 lib/aranha/parsers/source_address/file.rb
eac_tools-0.55.1 sub/aranha-parsers/lib/aranha/parsers/source_address/file.rb