class Oc::Run::Base
Attributes
config[W]
options[W]
Public Class Methods
description(value)
click to toggle source
# File lib/system/run/base.rb, line 33 def self.description(value) options[:description] = value end
example(value)
click to toggle source
# File lib/system/run/base.rb, line 41 def self.example(value) options[:example] = value end
get_object_name(value=nil)
click to toggle source
# File lib/system/run/base.rb, line 20 def self.get_object_name(value=nil) @object_name ||= begin value ||= if self.name && !self.name.empty? self.name.split('::').last end value.to_s.split(/(?=[A-Z])/).join('-').downcase if value end end
meta()
click to toggle source
# File lib/system/run/base.rb, line 59 def self.meta options[:meta] ||=[] end
method_added(method)
click to toggle source
# File lib/system/run/base.rb, line 4 def self.method_added(method) return if self == Oc::Run::Base return if private_method_defined? method return if protected_method_defined? method prefix = self.get_object_name method_name = method.to_s == 'run' ? nil : method.to_s.gsub('_','-') name = [prefix, method_name].compact Oc::Run.add({ :name => name, :class => self, :method => method, :options => options }) @options = nil end
option(switches, description=nil, options={})
click to toggle source
# File lib/system/run/base.rb, line 45 def self.option(switches, description=nil, options={}) meta << { :switches => switches, :description => description, :type => options[:type].nil? ? "String" : options[:type], :default => options[:default], :optional => options[:optional] } end
options()
click to toggle source
# File lib/system/run/base.rb, line 55 def self.options @options ||= {} end
summary(value)
click to toggle source
# File lib/system/run/base.rb, line 37 def self.summary(value) options[:summary] = value end
syntax(value)
click to toggle source
# File lib/system/run/base.rb, line 29 def self.syntax(value) options[:syntax] = value end