Sha256: 1ed7e0ce21ff5a017bd81f8b4e0ee141021c2facdea2e61328bd7b53b34ac5c8

Contents?: true

Size: 470 Bytes

Versions: 3

Compression:

Stored size: 470 Bytes

Contents

require 'wgif/exceptions'

module WGif
  class Validator
    URL = %r{\Ahttps?://.*\z}
    TIMESTAMP = /\A\d{1,2}(?::\d{2})+(?:\.\d*)?\z/

    def initialize(args)
      @args = args
    end

    def validate
      fail WGif::InvalidUrlException unless args[:url] =~ URL
      fail WGif::InvalidTimestampException unless args[:trim_from] =~ TIMESTAMP
      fail WGif::MissingOutputFileException unless args[:output]
    end

    private

    attr_reader :args
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
wgif-0.5.4 lib/wgif/validator.rb
wgif-0.5.3 lib/wgif/validator.rb
wgif-0.5.2 lib/wgif/validator.rb