Module: Postable::ClassMethods

Defined in:
lib/vendor/plugins/postable/lib/postable.rb

Instance Method Summary collapse

Instance Method Details

#marks_up(attribute) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/vendor/plugins/postable/lib/postable.rb', line 8

def marks_up(attribute)
  before_validation "convert_#{attribute}_to_markdown".to_sym
  class_eval "    def convert_\#{attribute}_to_markdown\n      unless self.\#{attribute}.blank?\n        self.\#{attribute}_html = RDiscount.new(\#{attribute}).to_html\n      end\n    end\n    private :convert_\#{attribute}_to_markdown\n  EOC\nend\n"

#slugifies(attribute) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/vendor/plugins/postable/lib/postable.rb', line 20

def slugifies(attribute)
  before_validation "convert_#{attribute}_to_slug".to_sym
  class_eval "    def convert_\#{attribute}_to_slug\n      if self.\#{attribute}_slug.blank?\n        self.\#{attribute}_slug = generate_slug(\#{attribute})\n      end\n    end\n    private :convert_\#{attribute}_to_slug\n  EOC\nend\n"