class Scripting::Commands::Command
Attributes
name[R]
Public Class Methods
new(app, name)
click to toggle source
# File lib/scripting/commands.rb, line 7 def initialize app, name @app = app @name = name.to_s.downcase.to_sym @description = nil @work = lambda {} # noop by default end
Public Instance Methods
describe(&blk)
click to toggle source
# File lib/scripting/commands.rb, line 14 def describe &blk instance_eval &blk if block_given? self end
description(desc=nil)
click to toggle source
# File lib/scripting/commands.rb, line 19 def description desc=nil unless desc.nil? @description = desc end @description end
run!(*args)
click to toggle source
# File lib/scripting/commands.rb, line 31 def run! *args @app.instance_exec(*args, &work) end
work(&blk)
click to toggle source
# File lib/scripting/commands.rb, line 26 def work &blk @work = blk if block_given? @work end