Class: Bashly::Models::Base
- Inherits:
-
Object
- Object
- Bashly::Models::Base
- Includes:
- Renderable
- Defined in:
- lib/bashly/models/base.rb
Constant Summary collapse
- OPTION_KEYS =
i[ arg description environment_variables examples flags help long name parent_name required short version ]
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(options) ⇒ Base
constructor
A new instance of Base.
- #method_missing(method_name, *arguments, &block) ⇒ Object
- #respond_to?(method_name, include_private = false) ⇒ Boolean
Methods included from Renderable
Constructor Details
#initialize(options) ⇒ Base
Returns a new instance of Base.
23 24 25 26 27 |
# File 'lib/bashly/models/base.rb', line 23 def initialize() raise Error, "Invalid options provided" unless .respond_to? :keys = verify if respond_to? :verify end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *arguments, &block) ⇒ Object
29 30 31 32 |
# File 'lib/bashly/models/base.rb', line 29 def method_missing(method_name, *arguments, &block) key = method_name.to_s respond_to?(method_name) ? [key] : super end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
6 7 8 |
# File 'lib/bashly/models/base.rb', line 6 def end |
Instance Method Details
#respond_to?(method_name, include_private = false) ⇒ Boolean
34 35 36 37 |
# File 'lib/bashly/models/base.rb', line 34 def respond_to?(method_name, include_private = false) # options.has_key?(method_name.to_s) || super OPTION_KEYS.include?(method_name) || super end |