Class: File

Inherits:
Object show all
Defined in:
lib/ruuuby/class/io/file.rb

Overview

add various aliases/functions to existing class File, (aliased globally by Kernel‘s function+📁+)

Defined Under Namespace

Modules: CSV, YAML

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.insert_line_before_expr(the_path, the_line, expression) ⇒ Object



36
37
38
39
# File 'lib/ruuuby/class/io/file.rb', line 36

def self.insert_line_before_expr(the_path, the_line, expression)
  

.insert_lines_before_expr(the_path, the_lines, expression) ⇒ Object



44
45
46
47
48
49
50
51
52
# File 'lib/ruuuby/class/io/file.rb', line 44

def self.insert_lines_before_expr(the_path, the_lines, expression)
  

.replace_expr_with(the_path, expression, replacement, num_matches = 1) ⇒ Integer

original source referenced from:



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/ruuuby/class/io/file.rb', line 63

def self.replace_expr_with(the_path, expression, replacement, num_matches=1)
  

.replace_expr_with!(the_path, expression, replacement, num_matches) ⇒ Integer

Returns 0 if there were no matches, otherwise n, (a positive int), for number of matches.

Raises:

  • (RuntimeError)

    if the expression provided was not found in any line of the file provided



105
106
107
108
109
110
111
112
# File 'lib/ruuuby/class/io/file.rb', line 105

def self.replace_expr_with!(the_path, expression, replacement, num_matches)
  num_matched = ::File.replace_expr_with(the_path, expression, replacement, num_matches)
  if num_matched == 0
    

.∃?(path) ⇒ Boolean

TODO: missing coverage

Raises:

  • (ArgumentError)


26
27
28
29
# File 'lib/ruuuby/class/io/file.rb', line 26

def self.

Instance Method Details

#∅?Boolean



15
# File 'lib/ruuuby/class/io/file.rb', line 15

def