Module: ActiveAttr::QueryAttributes
- Extended by:
- ActiveSupport::Concern
- Includes:
- Attributes
- Included in:
- Model
- Defined in:
- lib/active_attr/query_attributes.rb
Overview
QueryAttributes provides instance methods for querying attributes.
Instance Method Summary collapse
-
#query_attribute(name) ⇒ true, false
Test the presence of an attribute.
Methods included from Attributes
#==, #attributes, filter_attributes, filter_attributes=, #inspect, #read_attribute, #write_attribute
Instance Method Details
#query_attribute(name) ⇒ true, false
Test the presence of an attribute
See Typecasting::BooleanTypecaster#call for more details.
44 45 46 47 48 49 50 |
# File 'lib/active_attr/query_attributes.rb', line 44 def query_attribute(name) if respond_to? "#{name}?" send "#{name}?" else raise UnknownAttributeError, "unknown attribute: #{name}" end end |