class Bashly::Script::Base
Attributes
options[R]
Public Class Methods
new(options)
click to toggle source
# File lib/bashly/script/base.rb, line 14 def initialize(options) raise Error, 'Invalid options provided' unless options.respond_to? :keys @options = options end
option_keys()
click to toggle source
# File lib/bashly/script/base.rb, line 9 def option_keys @option_keys ||= [] end
Public Instance Methods
help()
click to toggle source
# File lib/bashly/script/base.rb, line 28 def help options['help'] ||= '' end
method_missing(method_name, *arguments, &)
click to toggle source
Calls superclass method
# File lib/bashly/script/base.rb, line 32 def method_missing(method_name, *arguments, &) key = method_name.to_s respond_to?(method_name) ? options[key] : super end
optional()
click to toggle source
# File lib/bashly/script/base.rb, line 20 def optional !options['required'] end
respond_to_missing?(method_name, include_private = false)
click to toggle source
Calls superclass method
# File lib/bashly/script/base.rb, line 37 def respond_to_missing?(method_name, include_private = false) self.class.option_keys.include?(method_name) || method_name.to_s.start_with?('x_') || super end
summary()
click to toggle source
# File lib/bashly/script/base.rb, line 24 def summary help.empty? ? '' : help.split("\n").first end