Class: Hole::Run::Base
- Inherits:
-
Object
- Object
- Hole::Run::Base
- Defined in:
- lib/system/run/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#config ⇒ Object
writeonly
Sets the attribute config.
-
#options ⇒ Object
writeonly
Sets the attribute options.
Class Method Summary collapse
- .description(value) ⇒ Object
- .example(value) ⇒ Object
- .get_object_name(value = nil) ⇒ Object
- .meta ⇒ Object
- .method_added(method) ⇒ Object
- .option(switches, description = nil, options = {}) ⇒ Object
- .options ⇒ Object
- .summary(value) ⇒ Object
- .syntax(value) ⇒ Object
Instance Attribute Details
#config=(value) ⇒ Object (writeonly)
Sets the attribute config
2 3 4 |
# File 'lib/system/run/base.rb', line 2 def config=(value) @config = value end |
#options=(value) ⇒ Object (writeonly)
Sets the attribute options
2 3 4 |
# File 'lib/system/run/base.rb', line 2 def (value) @options = value end |
Class Method Details
.description(value) ⇒ Object
36 37 38 |
# File 'lib/system/run/base.rb', line 36 def self.description(value) [:description] = value end |
.example(value) ⇒ Object
44 45 46 |
# File 'lib/system/run/base.rb', line 44 def self.example(value) [:example] = value end |
.get_object_name(value = nil) ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/system/run/base.rb', line 23 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 ⇒ Object
60 61 62 |
# File 'lib/system/run/base.rb', line 60 def self. [:meta] ||=[] end |
.method_added(method) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/system/run/base.rb', line 5 def self.method_added(method) return if self == Hole::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 Hole::Run.add({ :name => name, :class => self, :method => method, :options => }) @options = nil end |
.option(switches, description = nil, options = {}) ⇒ Object
48 49 50 51 52 53 54 |
# File 'lib/system/run/base.rb', line 48 def self.option(switches, description=nil, ={}) << { :switches => switches, :description => description, :type => String } end |
.options ⇒ Object
56 57 58 |
# File 'lib/system/run/base.rb', line 56 def self. @options ||= {} end |
.summary(value) ⇒ Object
40 41 42 |
# File 'lib/system/run/base.rb', line 40 def self.summary(value) [:summary] = value end |
.syntax(value) ⇒ Object
32 33 34 |
# File 'lib/system/run/base.rb', line 32 def self.syntax(value) [:syntax] = value end |