auto_html 1.3.6 → 1.3.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.md +17 -1
  2. data/lib/auto_html.rb +3 -1
  3. metadata +7 -3
data/README.md CHANGED
@@ -47,7 +47,7 @@ If you need to display preview, no problem. Have something like this as action i
47
47
  render :text => comment.body_html
48
48
  end
49
49
 
50
- Plugin is highly customizable, and you can easily create new filters that will transform user input any way you like. For instance, this is the image filter that comes bundled with plugin:
50
+ AutoHtml is highly customizable, and you can easily create new filters that will transform user input any way you like. For instance, this is the image filter that comes bundled with plugin:
51
51
 
52
52
  AutoHtml.add_filter(:image) do |text|
53
53
  text.gsub(/http:\/\/.+\.(jpg|jpeg|bmp|gif|png)(\?\S+)?/i) do |match|
@@ -56,6 +56,22 @@ Plugin is highly customizable, and you can easily create new filters that will t
56
56
  end
57
57
 
58
58
 
59
+ ## Non-ActiveModel models
60
+
61
+ AutoHtml uses standard ActiveModel API meaning you can include AutoHtmlFor module (that automates transformation of the field) in any non-ActiveRecord model that uses ActiveModel. Here's working [mongoid](http://mongoid.org/) example:
62
+
63
+ class Post
64
+ include Mongoid::Document
65
+ include AutoHtmlFor
66
+
67
+ field :body
68
+
69
+ auto_html_for :body do
70
+ simple_format
71
+ link
72
+ end
73
+ end
74
+
59
75
 
60
76
  ## Bundled filters
61
77
 
data/lib/auto_html.rb CHANGED
@@ -6,4 +6,6 @@ Dir["#{File.dirname(__FILE__) + '/auto_html/filters'}/**/*"].each do |filter|
6
6
  require "#{filter}"
7
7
  end
8
8
 
9
- ActiveRecord::Base.send :include, AutoHtmlFor
9
+ if defined?(ActiveRecord::Base)
10
+ ActiveRecord::Base.send :include, AutoHtmlFor
11
+ end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: auto_html
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 21
4
5
  prerelease: false
5
6
  segments:
6
7
  - 1
7
8
  - 3
8
- - 6
9
- version: 1.3.6
9
+ - 7
10
+ version: 1.3.7
10
11
  platform: ruby
11
12
  authors:
12
13
  - Dejan Simic
@@ -14,7 +15,7 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2011-03-30 00:00:00 +02:00
18
+ date: 2011-04-12 00:00:00 +02:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
@@ -25,6 +26,7 @@ dependencies:
25
26
  requirements:
26
27
  - - ">="
27
28
  - !ruby/object:Gem::Version
29
+ hash: 3
28
30
  segments:
29
31
  - 0
30
32
  version: "0"
@@ -93,6 +95,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
93
95
  requirements:
94
96
  - - ">="
95
97
  - !ruby/object:Gem::Version
98
+ hash: 3
96
99
  segments:
97
100
  - 0
98
101
  version: "0"
@@ -101,6 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
104
  requirements:
102
105
  - - ">="
103
106
  - !ruby/object:Gem::Version
107
+ hash: 3
104
108
  segments:
105
109
  - 0
106
110
  version: "0"