Class: RVC::CmdModule

Inherits:
Object
  • Object
show all
Defined in:
lib/rvc/modules.rb

Instance Method Summary collapse

Constructor Details

#initialize(module_name) ⇒ CmdModule

Returns a new instance of CmdModule.



27
28
29
30
31
# File 'lib/rvc/modules.rb', line 27

def initialize module_name
  @module_name = module_name
  @opts = {}
  super()
end

Instance Method Details

#commandsObject



33
34
35
# File 'lib/rvc/modules.rb', line 33

def commands
  @opts.keys
end

#opts(cmd, &b) ⇒ Object



37
38
39
# File 'lib/rvc/modules.rb', line 37

def opts cmd, &b
  @opts[cmd] = b
end

#opts_for(cmd) ⇒ Object



41
42
43
# File 'lib/rvc/modules.rb', line 41

def opts_for cmd
  @opts[cmd]
end

#rvc_alias(cmd, target = nil) ⇒ Object



45
46
47
48
# File 'lib/rvc/modules.rb', line 45

def rvc_alias cmd, target=nil
  target ||= cmd
  RVC::ALIASES[target.to_s] = "#{@module_name}.#{cmd}"
end