bbcode-rails 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eee36ea29830dc83a7843dad8943e85e4ab88cb6
4
- data.tar.gz: 313b2a3bc3276ae865dc9ef757ff9f575692dce7
3
+ metadata.gz: 85c25fceeb4fbc1b4c93491384ef5af2d867587d
4
+ data.tar.gz: 23873eb57b191664b7b6afd60e6590841e888d2d
5
5
  SHA512:
6
- metadata.gz: 8584d458464d83bd45a958fa8d838d205795a18eed3f2edd00811b3ad24b7d657a14e3b925f8d52f10aceb727e6a94acc9dfc5f9f6ab810f8d940b01e2966ee6
7
- data.tar.gz: c30594d59da3ba541a8d9de1b663cd460055abc6760388c2044cbceebe584136c0c5becb6a652a976cab827638344f9a08b566462affc7467f39e1d19df116dc
6
+ metadata.gz: 12894618783176fcb4053053aac63ebc69e3a6d81de7208d060cd6aa14253b5817378de929cc025f96f9255595ab6b6fae2188d846e99356507a898d4f4d2412
7
+ data.tar.gz: ee74932ca1193c89a6cc4898696f390134975376b475241c459cc9b3c76b0d3f61793588a8493ab5cc20e20261bdcb92b65538699493c73977c8f107e2cce326
data/README.md CHANGED
@@ -32,9 +32,12 @@ Or install it yourself as:
32
32
  ## Usage
33
33
 
34
34
  To keep developement simple and easy to understand all tag definitions are found
35
- in `app/bbcode/`. While it is usually better to have one file per tag, usually
36
- tags are not big enough to warrant this, so one can also group them. For example
37
- `styling.rb` could have the simplest tags in it.
35
+ in `app/bbcode/`. It is one file per tag.
36
+
37
+ #### Note
38
+
39
+ While in development the tags are loaded on use, in production they are then
40
+ eager loaded.
38
41
 
39
42
  ### Creating a new tag
40
43
 
data/lib/bbcode-rails.rb CHANGED
@@ -15,6 +15,16 @@ module BBCode
15
15
  str.gsub!( '"', '"' )
16
16
  str.gsub!( "'", ''' )
17
17
 
18
+ # For eager loading
19
+ if defined?(Rails) && Rails.env.development?
20
+ str.scan(/\[(\w+)(?:=.+)?\]/).each do |tagname|
21
+ begin
22
+ "#{tagname[0]}_tag".camelize.constantize
23
+ rescue NameError
24
+ end
25
+ end
26
+ end
27
+
18
28
  @@tags.each do |t|
19
29
  str.gsub!(t.regex) { t.instance.instance_exec($~, &t.block) }
20
30
  end
@@ -22,6 +22,8 @@ class BBCode::Tag
22
22
  end
23
23
 
24
24
  def self.inherited subclass
25
+ # In case we autoreload, remove earlier instances
26
+ BBCode.tags.delete_if {|c| c.to_s == subclass.to_s }
25
27
  BBCode.tags << subclass
26
28
  end
27
29
 
@@ -1,3 +1,3 @@
1
1
  module BBCode
2
- VERSION = "0.6.0"
2
+ VERSION = "0.7.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bbcode-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcel Müller