Sha256: b6be56ce12cc310e4b90f20b6774ad87ebdace6e4dc507d22cf301bce6d76db6

Contents?: true

Size: 434 Bytes

Versions: 2

Compression:

Stored size: 434 Bytes

Contents

require_relative 'base'

module Semi::Variables
  class Path < Semi::Variables::Base

    @@path_re = Regexp.new('^(?<path>(?:\.{1,2}|\/).*?)\/(?<file>[^\/]+)?$')

    def validate
      self.validate(@value)
    end
    
    def self.validate(value)
      if ['String', 'Semi::Variables::Path'].include? value.class.to_s
        if @@path_re.match(value)
          return true
        end
      end
      false
    end
    
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
semi-0.3.1 lib/semi/variables/path.rb
semi-0.3.0 lib/semi/variables/path.rb