Top Level Namespace
Defined Under Namespace
Modules: Enumerable, ExtendedLockfile, LocaleFiddler, Ncurses, RMail, Redwood, Rfc2047
Classes: Array, File, FinishLine, Hash, Integer, Module, Numeric, Object, Pathname, SavingHash, String, Tempfile, Time
Instance Method Summary
collapse
Instance Method Details
#axe(q, default = nil) ⇒ Object
4
5
6
7
8
9
10
11
12
|
# File 'lib/sup/util/axe.rb', line 4
def axe q, default=nil
question = if default && !default.empty?
"#{q} (enter for \"#{default}\"): "
else
"#{q}: "
end
ans = @cli.ask question
ans.empty? ? default : ans.to_s
end
|
#axe_yes(q, default = "n") ⇒ Object
14
15
16
|
# File 'lib/sup/util/axe.rb', line 14
def axe_yes q, default="n"
axe(q, default) =~ /^y|yes$/i
end
|
the following magic enables wide characters when used with a ruby ncurses.so that’s been compiled against libncursesw. (note the w.) why this works, i have no idea. much like pretty much every aspect of dealing with curses. cargo cult programming at its best.
5
|
# File 'lib/sup/util/locale_fiddler.rb', line 5
require 'fiddle'
|
#git_suffix ⇒ Object
1
2
3
4
5
6
7
8
|
# File 'lib/sup/version.rb', line 1
def git_suffix
revision = `GIT_DIR=#{__dir__}/../../.git git rev-parse HEAD 2>/dev/null`
if revision.empty?
"-git-unknown"
else
"-git-#{revision[0..7]}"
end
end
|