Class: Lbrt::Utils
- Inherits:
-
Object
show all
- Defined in:
- lib/lbrt/utils.rb
Defined Under Namespace
Modules: CLIHelper, ContextHelper, TemplateHelper
Class Method Summary
collapse
Class Method Details
.matched?(str, target) ⇒ Boolean
7
8
9
10
11
12
13
14
15
|
# File 'lib/lbrt/utils.rb', line 7
def matched?(str, target)
str = str.to_s
if target
str =~ target
else
true
end
end
|
.open(url) ⇒ Object
17
18
19
20
21
|
# File 'lib/lbrt/utils.rb', line 17
def open(url)
url = Shellwords.escape(url)
cmd = ENV['LIBRATO_OPEN'] || 'open'
system("#{cmd} #{url}")
end
|
.unbrace(str) ⇒ Object
3
4
5
|
# File 'lib/lbrt/utils.rb', line 3
def unbrace(str)
str.sub(/\A\s*\{/, '').sub(/\}\s*\z/, '').strip
end
|