Sha256: 37dd64f92f0784abe2b78698c390c19e90ca57301c1ad57662b5fe1c498f76e7

Contents?: true

Size: 734 Bytes

Versions: 9

Compression:

Stored size: 734 Bytes

Contents

module Leap
  # Ideally Leap subjects will provide methods that return a curated hash of attributes suitable for Leap decisions and indicate them with the <tt>:with</tt> option on <tt>Leap::Subject#decide</tt>.
  # 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.
  module ImplicitAttributes
    # Provides an articifial attributes hash constructed from the object's instance variables.
    # @return [Hash]
    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
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
leap-0.5.8 lib/leap/implicit_attributes.rb
leap-0.5.7 lib/leap/implicit_attributes.rb
leap-0.5.6 lib/leap/implicit_attributes.rb
leap-0.5.5 lib/leap/implicit_attributes.rb
leap-0.5.4 lib/leap/implicit_attributes.rb
leap-0.5.3 lib/leap/implicit_attributes.rb
leap-0.5.2 lib/leap/implicit_attributes.rb
leap-0.5.1 lib/leap/implicit_attributes.rb
leap-0.5.0 lib/leap/implicit_attributes.rb