Module: Mongoid::Markdown::InstanceMethods

Defined in:
lib/mongoid-markdown/mongoid_new.rb,
lib/mongoid-markdown/mongoid_old.rb

Instance Method Summary collapse

Instance Method Details

#markdown!Object



63
64
65
# File 'lib/mongoid-markdown/mongoid_old.rb', line 63

def markdown!
  self.class.markdown_attributes.each { |attr| __send__(attr) }
end

#marked_downObject



51
52
53
# File 'lib/mongoid-markdown/mongoid_old.rb', line 51

def marked_down
  marked_down? ? (@marked_down ||= {}) : @attributes.dup
end

#marked_down=(value) ⇒ Object



59
60
61
# File 'lib/mongoid-markdown/mongoid_old.rb', line 59

def marked_down=(value)
  @is_marked_down = !!value
end

#marked_down?Boolean

Returns:

  • (Boolean)


55
56
57
# File 'lib/mongoid-markdown/mongoid_old.rb', line 55

def marked_down?
  @is_marked_down != false
end

#reloadObject



67
68
69
70
# File 'lib/mongoid-markdown/mongoid_old.rb', line 67

def reload
  marked_down.clear
  super
end

#write_attribute(attr_name, value) ⇒ Object



72
73
74
75
# File 'lib/mongoid-markdown/mongoid_old.rb', line 72

def write_attribute(attr_name, value)
  marked_down[attr_name.to_s] = nil
  super
end