Class: Rules::Parameters::Attribute

Inherits:
Parameter
  • Object
show all
Defined in:
lib/rules/parameters/attribute.rb

Constant Summary

Constants inherited from Parameter

Parameter::VALID_TYPES

Instance Attribute Summary

Attributes inherited from Parameter

#key, #name, #type

Instance Method Summary collapse

Methods inherited from Parameter

cast, #initialize, #to_s

Constructor Details

This class inherits a constructor from Rules::Parameters::Parameter

Instance Method Details

#evaluate(attributes = {}) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/rules/parameters/attribute.rb', line 5

def evaluate(attributes = {})
  if Rules.config.missing_attributes_are_nil?
    attributes[key]
  else
    attributes.fetch(key)
  end
end