Module: CouchRest::Model::PropertyProtection::ClassMethods

Defined in:
lib/couchrest/model/property_protection.rb

Instance Method Summary collapse

Instance Method Details

#accessible_propertiesObject



36
37
38
39
40
41
42
# File 'lib/couchrest/model/property_protection.rb', line 36

def accessible_properties
  props = properties.select { |prop| prop.options[:accessible] }
  if props.empty?
    props = properties.select { |prop| !prop.options[:protected] }
  end
  props
end

#protected_propertiesObject



44
45
46
47
# File 'lib/couchrest/model/property_protection.rb', line 44

def protected_properties
  accessibles = accessible_properties
  properties.reject { |prop| accessibles.include?(prop) }
end