Class: MoreUtils
- Inherits:
-
Object
show all
- Defined in:
- lib/utils/strings.rb
Class Method Summary
collapse
Class Method Details
.flag_lookup(arr) ⇒ Object
51
52
53
54
55
56
57
58
|
# File 'lib/utils/strings.rb', line 51
def flag_lookup arr
arr.each_with_object({}) do |e, acc|
e = e.gsub('--', '')
key, val = e.split('=')
acc[key.to_sym] = val
acc
end
end
|
.gem_version ⇒ Object
23
24
25
|
# File 'lib/utils/strings.rb', line 23
def gem_version
"0.1.3"
end
|
.get_args(arr) ⇒ Object
47
48
49
|
# File 'lib/utils/strings.rb', line 47
def get_args arr
arr.reject { |e| /--/.match(e) }
end
|
.get_file_str(path) ⇒ Object
27
28
29
|
# File 'lib/utils/strings.rb', line 27
def get_file_str path
File.open(path, 'r:UTF-8', &:read)
end
|
.get_flags(arr) ⇒ Object
43
44
45
|
# File 'lib/utils/strings.rb', line 43
def get_flags arr
arr.select { |e| /--/.match(e) }
end
|
.root ⇒ Object
39
40
41
|
# File 'lib/utils/strings.rb', line 39
def root
Dir.pwd
end
|
.this_dir ⇒ Object
35
36
37
|
# File 'lib/utils/strings.rb', line 35
def this_dir
__dir__
end
|
.write_file(path, str) ⇒ Object
31
32
33
|
# File 'lib/utils/strings.rb', line 31
def write_file path, str
File.write(path, str)
end
|