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
ehbrs-tools-0.16.4 vendor/aranha-parsers/lib/aranha/parsers/source_address/file.rb
ehbrs-tools-0.16.3 vendor/aranha-parsers/lib/aranha/parsers/source_address/file.rb
ehbrs-tools-0.16.2 vendor/aranha-parsers/lib/aranha/parsers/source_address/file.rb
aranha-parsers-0.7.0 lib/aranha/parsers/source_address/file.rb
aranha-parsers-0.6.1 lib/aranha/parsers/source_address/file.rb
ehbrs-tools-0.16.1 vendor/aranha-parsers/lib/aranha/parsers/source_address/file.rb
aranha-parsers-0.6.0 lib/aranha/parsers/source_address/file.rb
aranha-parsers-0.5.0 lib/aranha/parsers/source_address/file.rb
aranha-parsers-0.4.0 lib/aranha/parsers/source_address/file.rb
aranha-parsers-0.3.0 lib/aranha/parsers/source_address/file.rb
aranha-parsers-0.2.2 lib/aranha/parsers/source_address/file.rb
aranha-parsers-0.2.1 lib/aranha/parsers/source_address/file.rb
aranha-parsers-0.2.0 lib/aranha/parsers/source_address/file.rb
aranha-parsers-0.1.1 lib/aranha/parsers/source_address/file.rb
aranha-parsers-0.1.0 lib/aranha/parsers/source_address/file.rb
aranha-0.10.1 lib/aranha/parsers/source_address/file.rb
aranha-0.10.0 lib/aranha/parsers/source_address/file.rb
aranha-0.9.1 lib/aranha/parsers/source_address/file.rb
aranha-0.9.0 lib/aranha/parsers/source_address/file.rb
aranha-0.8.0 lib/aranha/parsers/source_address/file.rb