Class: Checked::File_Paths

Inherits:
Strings show all
Defined in:
lib/Checked/Demand/File_Paths.rb

Constant Summary collapse

INVALID_CHARS =
%r!([^a-zA-Z0-9\.\_\-\/~,]+)!

Instance Method Summary collapse

Methods inherited from Strings

#chop_ext, #chop_rb, #chop_slash_r, #exclude!, #file_content!, #file_names, #file_names_by_ext, #file_read!, #hostname!, #include!, #matches_only!, #new_content!, #not_empty!, #os_stardard, #ruby_name, #shell, #to_camel_case, #to_class_name, #to_plural, #to_single, #untar

Instance Method Details

#check!Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/Checked/Demand/File_Paths.rb', line 6

def check!
  super
  string! return!

  return! return!.strip
  not_empty! return!

  validate_format!
  expand_target if File.exists?(File.expand_path return!)

  return! 
end

#dir!Object



27
28
29
# File 'lib/Checked/Demand/File_Paths.rb', line 27

def dir!
  demand File.directory?(return!), "...must be an existing directory." 
end

#not_dir!Object



19
20
21
# File 'lib/Checked/Demand/File_Paths.rb', line 19

def not_dir!
  demand !File.directory?(return!), "...can't be an existing directory."
end

#not_file!Object



23
24
25
# File 'lib/Checked/Demand/File_Paths.rb', line 23

def not_file!
  demand !File.file?(return!), "...can't be a file."
end