Module: Aha::Helper
Overview
Internal: Provides helper methods for the rest of the Aha library.
Instance Method Summary collapse
-
#extract_option(option_key, args) ⇒ Object
Internal: Extracts an option from the options hash if it exists in the method args.
Instance Method Details
#extract_option(option_key, args) ⇒ Object
Internal: Extracts an option from the options hash if it exists in the method args.
option_key - A symbol corresponding to a key in the options hash. args - An array containing a number of args followed by an optional options hash.
Examples:
= [:a, :b, :c, :d, {:key => :option}]
= [:a, :b, :c, :d]
extract_option :key,
# => :option
extract_option :key,
# => nil
Returns the option value if it exists and nil otherwise.
23 24 25 26 |
# File 'lib/aha/helper.rb', line 23 def extract_option(option_key, args) = args.last.is_a?(Hash) ? args.pop : {} [option_key] end |