Module: SimpleResponse::QueryMethods

Included in:
SimpleStruct
Defined in:
lib/simple_response/query_methods.rb

Instance Method Summary collapse

Instance Method Details

#existing_query_method?(name) ⇒ Boolean

Returns:

  • (Boolean)


3
4
5
6
7
8
9
# File 'lib/simple_response/query_methods.rb', line 3

def existing_query_method?(name)
  return false unless query_method?(name)
  return false unless respond_to?(name[0...-1])

  attribute_class = send(name[0...-1]).class
  attribute_class == TrueClass || attribute_class == FalseClass
end