module Rbnotes::Commands
This module defines all command classes of rbnotes. Each command class must be derived from Rbnotes::Commands::Command
class.
Public Class Methods
load("add") → Rbnotes::Commands::Add
click to toggle source
load("delete") → Rbnotes::Commands::Delete
load("export") → Rbnotes::Commands::Export
load("help") → Rbnotes::Commands::Help
load("import") → Rbnotes::Commnads::Import
load("list") → Rbnotes::Commands::List
load("search") → Rbnotes::Commands::Search
load("show") → Rbnotes::Commands::Show
load("update") → Rbnotes::Commands::Update
Loads a class to perfom the command, then returns an instance of the class.
# File lib/rbnotes/commands.rb, line 269 def load(cmd_name) cmd_name ||= Builtins.default_cmd_name klass_name = cmd_name.capitalize klass = Builtins.command(klass_name) if klass.nil? begin require_relative "commands/#{cmd_name}" klass = const_get(klass_name, false) rescue LoadError => _ STDERR.puts "unknown command: #{cmd_name}" klass = Builtins.default_cmd end end klass.new end