class Bashly::Models::Base

Constants

OPTION_KEYS

Attributes

options[R]

Public Class Methods

new(options) click to toggle source
# File lib/bashly/models/base.rb, line 31
def initialize(options)
  raise Error, "Invalid options provided" unless options.respond_to? :keys
  @options = options
  verify if respond_to? :verify
end

Public Instance Methods

help() click to toggle source
# File lib/bashly/models/base.rb, line 45
def help
  options['help'] ||= ''
end
method_missing(method_name, *arguments, &block) click to toggle source
Calls superclass method
# File lib/bashly/models/base.rb, line 49
def method_missing(method_name, *arguments, &block)
  key = method_name.to_s
  respond_to?(method_name) ? options[key] : super
end
optional() click to toggle source
# File lib/bashly/models/base.rb, line 37
def optional
  !required
end
respond_to?(method_name, include_private = false) click to toggle source
Calls superclass method
# File lib/bashly/models/base.rb, line 54
def respond_to?(method_name, include_private = false)
  OPTION_KEYS.include?(method_name) || super
end
summary() click to toggle source
# File lib/bashly/models/base.rb, line 41
def summary
  help.empty? ? "" : help.split("\n").first
end