Module: Leap::ImplicitAttributes

Defined in:
lib/leap/implicit_attributes.rb

Overview

Ideally Leap subjects will provide methods that return a curated hash of attributes suitable for Leap decisions and indicate them with the :with option on Leap::Subject#decide. If this type of method is not available, or if it is not properly indicated, Leap will fall back to using the stopgap in this module.

Instance Method Summary collapse

Instance Method Details

#_leap_implicit_attributesHash

Provides an articifial attributes hash constructed from the object’s instance variables.

Returns:

  • (Hash)


7
8
9
# File 'lib/leap/implicit_attributes.rb', line 7

def _leap_implicit_attributes
  Hash[*instance_variables.map { |variable| variable.to_s.delete('@').to_sym }.zip(instance_variables.map { |variable| instance_variable_get variable }).flatten].except(:deliberations)
end