Module: CouchShell::PluginClass
- Defined in:
- lib/couch-shell/plugin.rb
Instance Method Summary collapse
Instance Method Details
#cmd(doc_line, opts = {}) ⇒ Object
163 164 165 166 167 168 169 170 171 172 173 |
# File 'lib/couch-shell/plugin.rb', line 163 def cmd(doc_line, opts = {}) opts[:doc_line] = doc_line Decorate.decorate { |klass, method_name| if !opts[:name] && method_name =~ /\Aexecute_(.+)\z/ opts[:name] = $1 end opts[:execute_message] = method_name opts[:plugin] = plugin_info plugin_info.register_command CommandInfo.new(opts) } end |
#plugin_info ⇒ Object
143 144 145 |
# File 'lib/couch-shell/plugin.rb', line 143 def plugin_info PluginInfo[self] end |
#var(doc_line, opts = {}) ⇒ Object
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
# File 'lib/couch-shell/plugin.rb', line 147 def var(doc_line, opts = {}) opts[:doc_line] = doc_line Decorate.decorate { |klass, method_name| unless opts[:name] || opts[:prefix] if method_name =~ /\Alookup_prefix_(.+)\z/ opts[:prefix] = $1 elsif method_name =~ /\Alookup_(.+)\z/ opts[:name] = $1 end end opts[:lookup_message] = method_name opts[:plugin] = plugin_info plugin_info.register_variable VariableInfo.new(opts) } end |