class Nucleon::Plugin::Command

Public Class Methods

register_ids() click to toggle source
  # File lib/core/plugin/command.rb
6 def self.register_ids
7   [ :command, :args, :flags, :data, :subcommand ]
8 end

Public Instance Methods

args(default = []) click to toggle source
   # File lib/core/plugin/command.rb
38 def args(default = [])
39   return array(get(:args, default)) 
40 end
args=(args) click to toggle source
   # File lib/core/plugin/command.rb
44 def args=args
45   set(:args, array(args))
46 end
build(components = {}, overrides = nil, override_key = false) click to toggle source
   # File lib/core/plugin/command.rb
83 def build(components = {}, overrides = nil, override_key = false)
84   logger.debug("Building command with #{components.inspect}")
85   logger.debug("Overrides: #{overrides.inspect}")
86   logger.debug("Override key: #{override_key}")
87   
88   return '' # Implement in sub classes
89 end
command(default = '') click to toggle source
   # File lib/core/plugin/command.rb
26 def command(default = '')
27   return string(get(:command, default))
28 end
command=(command) click to toggle source
   # File lib/core/plugin/command.rb
32 def command=command
33   set(:command, string(command))
34 end
data(default = {}) click to toggle source
   # File lib/core/plugin/command.rb
62 def data(default = {})
63   return hash(get(:data, default)) 
64 end
data=(data) click to toggle source
   # File lib/core/plugin/command.rb
68 def data=data
69   set(:data, hash(data))
70 end
exec(options = {}, overrides = nil) click to toggle source
   # File lib/core/plugin/command.rb
93 def exec(options = {}, overrides = nil)
94   logger.debug("Executing command with #{options.inspect}")
95   logger.debug("Overrides: #{overrides.inspect}")
96   
97   # Implement in sub classes (don't forget the yield!)
98   return true
99 end
flags(default = []) click to toggle source
   # File lib/core/plugin/command.rb
50 def flags(default = [])
51   return array(get(:flags, default)) 
52 end
flags=(flags) click to toggle source
   # File lib/core/plugin/command.rb
56 def flags=flags
57   set(:flags, array(flags))
58 end
normalize(reload) click to toggle source
Calls superclass method
   # File lib/core/plugin/command.rb
13 def normalize(reload)
14   super
15 end
subcommand=(subcommand) click to toggle source
   # File lib/core/plugin/command.rb
74 def subcommand=subcommand
75   unless Util::Data.empty?(subcommand)
76     set(:subcommand, new(hash(subcommand)))
77   end
78 end
to_s() click to toggle source
   # File lib/core/plugin/command.rb
19 def to_s
20   return build(export)
21 end