Sha256: 05f7e9570fcacff5fc76dc2ba7493e2e07e388f0447fb3edbab0bf9a8e46fbde
Contents?: true
Size: 761 Bytes
Versions: 5
Compression:
Stored size: 761 Bytes
Contents
require 'active_support/concern' module Ripple module AttributeMethods module Query extend ActiveSupport::Concern included do attribute_method_suffix "?" end private # Based on code from ActiveRecord def attribute?(attr_name) unless value = attribute(attr_name) false else prop = self.class.properties[attr_name] if prop.nil? if Numeric === value || value !~ /[^0-9]/ !value.to_i.zero? else Boolean.ripple_cast(value) || value.present? end elsif prop.type <= Numeric !value.zero? else value.present? end end end end end end
Version data entries
5 entries across 5 versions & 4 rubygems