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
aranha-parsers-0.21.0 lib/aranha/parsers/source_address/file.rb
aranha-parsers-0.20.0 lib/aranha/parsers/source_address/file.rb
eac_tools-0.69.1 sub/aranha-parsers/lib/aranha/parsers/source_address/file.rb
aranha-parsers-0.19.1 lib/aranha/parsers/source_address/file.rb
eac_tools-0.69.0 sub/aranha-parsers/lib/aranha/parsers/source_address/file.rb
eac_tools-0.68.0 sub/aranha-parsers/lib/aranha/parsers/source_address/file.rb
aranha-parsers-0.19.0 lib/aranha/parsers/source_address/file.rb
eac_tools-0.67.1 sub/aranha-parsers/lib/aranha/parsers/source_address/file.rb
eac_tools-0.67.0 sub/aranha-parsers/lib/aranha/parsers/source_address/file.rb
eac_tools-0.66.0 sub/aranha-parsers/lib/aranha/parsers/source_address/file.rb
eac_tools-0.65.1 sub/aranha-parsers/lib/aranha/parsers/source_address/file.rb
aranha-parsers-0.18.0 lib/aranha/parsers/source_address/file.rb
eac_tools-0.65.0 sub/aranha-parsers/lib/aranha/parsers/source_address/file.rb
eac_tools-0.64.0 sub/aranha-parsers/lib/aranha/parsers/source_address/file.rb
eac_tools-0.63.0 sub/aranha-parsers/lib/aranha/parsers/source_address/file.rb
eac_tools-0.62.1 sub/aranha-parsers/lib/aranha/parsers/source_address/file.rb
eac_tools-0.62.0 sub/aranha-parsers/lib/aranha/parsers/source_address/file.rb
eac_tools-0.61.1 sub/aranha-parsers/lib/aranha/parsers/source_address/file.rb
eac_tools-0.61.0 sub/aranha-parsers/lib/aranha/parsers/source_address/file.rb
eac_tools-0.60.3 sub/aranha-parsers/lib/aranha/parsers/source_address/file.rb