class Elscripto::Command
Attributes
name[R]
system_call[R]
Public Class Methods
new(name, options = {})
click to toggle source
# File lib/elscripto/command.rb, line 5 def initialize name, options = {} raise ArgumentError.new 'Elscripto commands need a name spectacularrr' if blank? name @name = name @system_call = blank?(options[:command]) ? builtin_commands[name] : options.delete(:command) raise ArgumentError.new 'Elscripto commands need a command spectacularrr' if blank? @system_call end
Protected Instance Methods
blank?(var)
click to toggle source
# File lib/elscripto/command.rb, line 21 def blank? var var == '' or var.nil? or var == [] end
builtin_commands()
click to toggle source
# File lib/elscripto/command.rb, line 12 def builtin_commands return @commands if @commands @commands = {} Dir[File.join(Elscripto::App.global_conf_path,'*.conf')].each do |file| @commands.merge! YAML.load_file(file) end @commands end