Class: Metro::Model::OptionsProperty::NoOption

Inherits:
Object
  • Object
show all
Defined in:
lib/metro/models/properties/options_property/no_option.rb

Overview

When the options cannot find a selected menu option then this no option is returned instead of a nil value. This allows for a warning to be generated if any methods target this item.

Also if the option will send a ‘missing_menu_action’ if the options were to ask for the selected action.

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



14
15
16
# File 'lib/metro/models/properties/options_property/no_option.rb', line 14

def method_missing(name,*args,&block)
  log.warn warning_message
end

Instance Method Details

#propertiesObject



22
23
24
# File 'lib/metro/models/properties/options_property/no_option.rb', line 22

def properties
  { action: :missing_menu_action }
end

#warning_messageObject



18
19
20
# File 'lib/metro/models/properties/options_property/no_option.rb', line 18

def warning_message
  "No valid options were found in the menu"
end