djanowski-snippets 0.1.3 → 0.1.4

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.
Files changed (2) hide show
  1. data/lib/snippet.rb +6 -1
  2. metadata +1 -1
data/lib/snippet.rb CHANGED
@@ -11,9 +11,14 @@ class Snippet < ActiveRecord::Base
11
11
  end
12
12
 
13
13
  def parse(text, parser = nil)
14
+ parser = Snippet.default_parser if parser.blank?
14
15
  klass = Snippets::Parsers.const_get(parser.to_s.classify)
15
16
  klass.parse(text)
16
17
  end
18
+
19
+ def default_parser
20
+ 'html'
21
+ end
17
22
  end
18
23
 
19
24
  def to_s
@@ -23,7 +28,7 @@ class Snippet < ActiveRecord::Base
23
28
  private
24
29
 
25
30
  def compile_text
26
- self.parser = 'html' if parser.blank?
31
+ self.parser = Snippet.default_parser if parser.blank?
27
32
  self.compiled_text = Snippet.parse(text, parser)
28
33
  end
29
34
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: djanowski-snippets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Damian Janowski