Class: Branchtree::Commands::Common
- Inherits:
-
Object
- Object
- Branchtree::Commands::Common
show all
- Includes:
- Branchtree::Context, TTY::Option
- Defined in:
- lib/branchtree/commands/common.rb
Instance Method Summary
collapse
logger
Instance Method Details
#execute ⇒ Object
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/branchtree/commands/common.rb', line 34
def execute
if params[:help]
puts help
exit 0
end
if params[:loglevel]
logger.log_at(params[:loglevel].to_sym)
logger.debug "Logging at level #{params[:loglevel]}."
end
end
|
#load_situation ⇒ Object
46
47
48
|
# File 'lib/branchtree/commands/common.rb', line 46
def load_situation
Situation.new.tap(&:read)
end
|
#load_tree ⇒ Object
50
51
52
53
|
# File 'lib/branchtree/commands/common.rb', line 50
def load_tree
logger.debug "Loading mapfile from #{params[:mapfile]}."
Tree.load(params[:mapfile])
end
|
#pluralize(quantity, word, plural: "#{word}s") ⇒ Object
55
56
57
58
59
60
61
|
# File 'lib/branchtree/commands/common.rb', line 55
def pluralize(quantity, word, plural: "#{word}s")
if quantity == 1
"1 #{word}"
else
"#{quantity} #{plural}"
end
end
|