Class: MenuCommander::MenuOptions
- Inherits:
-
Object
- Object
- MenuCommander::MenuOptions
- Defined in:
- lib/menu_commander/menu_options.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #default_options ⇒ Object
-
#initialize(options) ⇒ MenuOptions
constructor
A new instance of MenuOptions.
- #method_missing(method, *_args, &_block) ⇒ Object
- #respond_to_missing?(method_name, include_private = false) ⇒ Boolean
Constructor Details
#initialize(options) ⇒ MenuOptions
Returns a new instance of MenuOptions.
5 6 7 8 9 |
# File 'lib/menu_commander/menu_options.rb', line 5 def initialize() ||= {} .transform_keys!(&:to_sym) @options = .merge end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *_args, &_block) ⇒ Object
26 27 28 |
# File 'lib/menu_commander/menu_options.rb', line 26 def method_missing(method, *_args, &_block) respond_to?(method) ? [method] : super end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
3 4 5 |
# File 'lib/menu_commander/menu_options.rb', line 3 def @options end |
Instance Method Details
#default_options ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/menu_commander/menu_options.rb', line 11 def @default_options ||= { auto_select: true, echo: false, echo_marker_success: '✓', echo_marker_error: '✗', filter: 'auto', header: false, page_size: 10, select_marker: '⯈', submenu_marker: ' ⯆', title_marker: '▌', # ➤ ❚ ✚ } end |
#respond_to_missing?(method_name, include_private = false) ⇒ Boolean
30 31 32 |
# File 'lib/menu_commander/menu_options.rb', line 30 def respond_to_missing?(method_name, include_private = false) .has_key?(method_name) || super end |