Class: Semi::Variables::Path

Inherits:
Base
  • Object
show all
Defined in:
lib/semi/variables/path.rb

Constant Summary collapse

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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#initialize, #set, #to_s

Constructor Details

This class inherits a constructor from Semi::Variables::Base

Class Method Details

.validate(value) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/semi/variables/path.rb', line 12

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

Instance Method Details

#validateObject



8
9
10
# File 'lib/semi/variables/path.rb', line 8

def validate
  self.validate(@value)
end