module MarkMapper

Constants

Methods
ModifierString

Private

Version

Public Class Methods

modifier?(key) click to toggle source

Internal

# File lib/mark_mapper.rb, line 113
def self.modifier?(key)
  key.to_s[0, 1] == ModifierString
end
to_object_id(value) click to toggle source
# File lib/mark_mapper.rb, line 98
def self.to_object_id(value)
  return value if value.is_a?(MarkLogic::ObjectId)
  return nil   if value.nil? || (value.respond_to?(:empty?) && value.empty?)

  if MarkLogic::ObjectId.legal?(value.to_s)
    MarkLogic::ObjectId.from_string(value.to_s)
  else
    value
  end
end

Protected Instance Methods

attribute_method?(attr_name) click to toggle source

We don’t call super here to avoid invoking attributes, which builds a whole new hash per call.

# File lib/mark_mapper/plugins/dirty.rb, line 38
def attribute_method?(attr_name)
  keys.key?(attr_name) || !embedded_associations.detect {|a| a.name == attr_name }.nil?
end

Private Instance Methods

attribute_value_changed?(key_name) click to toggle source
# File lib/mark_mapper/plugins/dirty.rb, line 56
def attribute_value_changed?(key_name)
  changed_attributes[key_name] != read_key(key_name)
end
write_key(key, value) click to toggle source
Calls superclass method
# File lib/mark_mapper/plugins/dirty.rb, line 44
def write_key(key, value)
  key = unalias_key(key)
  if !keys.key?(key)
    super
  else
    attribute_will_change!(key) unless attribute_changed?(key)
    super.tap do
      changed_attributes.delete(key) unless attribute_value_changed?(key)
    end
  end
end