Module: ActiveRemote::QueryAttributes

Extended by:
ActiveSupport::Concern
Included in:
Base
Defined in:
lib/active_remote/query_attributes.rb

Overview

QueryAttributes provides instance methods for querying attributes.

Examples:

Usage

class Person < ::ActiveRemote::Base
  attribute :name
end

person = Person.new
person.name? #=> false
person.name = "Chris Griego"
person.name? #=> true

Instance Method Summary collapse

Instance Method Details

#query_attribute(attr_name) ⇒ Object



24
25
26
27
28
29
30
31
32
33
# File 'lib/active_remote/query_attributes.rb', line 24

def query_attribute(attr_name)
  value = self[attr_name]

  case value
  when true        then true
  when false, nil  then false
  else
    value.present?
  end
end