downr 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # Downr
2
- [![Build Status](https://travis-ci.org/davidrivera/Downr.svg?branch=master)](https://travis-ci.org/davidrivera/Downr) [![Code Climate](https://codeclimate.com/github/davidrivera/Downr.png)](https://codeclimate.com/github/davidrivera/Downr) [![Gem Version](https://badge.fury.io/rb/downr.svg)](http://badge.fury.io/rb/downr) [![Dependency Status](https://gemnasium.com/davidrivera/Downr.svg)](https://gemnasium.com/davidrivera/Downr)
2
+ [![Build Status](https://travis-ci.org/davidrivera/Downr.svg?branch=master)](https://travis-ci.org/davidrivera/Downr) [![Code Climate](https://codeclimate.com/github/davidrivera/Downr.png)](https://codeclimate.com/github/davidrivera/Downr) [![Inline docs](http://inch-pages.github.io/github/davidrivera/Downr.png)](http://inch-pages.github.io/github/davidrivera/Downr) [![Gem Version](https://badge.fury.io/rb/downr.svg)](http://badge.fury.io/rb/downr) [![Dependency Status](https://gemnasium.com/davidrivera/Downr.svg)](https://gemnasium.com/davidrivera/Downr)
3
3
 
4
4
  Downr is an easy to use rails wrapper around a couple of different notable gems
5
5
  * [Redcarpet](https://github.com/vmg/redcarpet)
@@ -7,9 +7,10 @@ module Downr
7
7
  #
8
8
  # @option opts [Boolean] :pygmentize Code colors
9
9
  # @option opts [Boolean] :emojify Icons
10
- def initializer(opt)
11
- opt = clean_options
10
+ def initialize(opt)
11
+ opt = clean_options(opt)
12
12
  @options = opt
13
+ super
13
14
  end
14
15
 
15
16
  # Hook for Redcarpet render
@@ -19,7 +20,7 @@ module Downr
19
20
  #
20
21
  # @return [String] html
21
22
  def block_code(code, language)
22
- if(@options.pygmentize)
23
+ if(@options[:pygmentize])
23
24
  pygmentize(code, language)
24
25
  else
25
26
  return code
@@ -32,7 +33,7 @@ module Downr
32
33
  #
33
34
  # @return [String] html
34
35
  def paragraph(text)
35
- if(@options.emojify)
36
+ if(@options[:emojify])
36
37
  return emojify(text)
37
38
  else
38
39
  return text
@@ -51,19 +52,19 @@ module Downr
51
52
  def clean_options opts
52
53
  a = {}
53
54
 
54
- if(opts.has_key?(pygmentize))
55
- a[:pygmentize] = opts.pygmentize
55
+ if(opts.has_key?(:pygmentize))
56
+ a[:pygmentize] = opts[:pygmentize]
56
57
  else
57
58
  a[:pygmentize] = false
58
59
  end
59
60
 
60
- if(opts.has_key?(emojify))
61
- a[:emojify] = opts.emojify
61
+ if(opts.has_key?(:emojify))
62
+ a[:emojify] = opts[:emojify]
62
63
  else
63
64
  a[:emojify] = false
64
65
  end
65
66
 
66
- return opts
67
+ return a
67
68
  end
68
69
 
69
70
  # Uses RailsEmoji to insert icons
@@ -92,4 +93,4 @@ module Downr
92
93
  Pygmentize.process(code, language)
93
94
  end
94
95
  end
95
- end
96
+ end
@@ -1,3 +1,3 @@
1
1
  module Downr
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -1,6 +1,9 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Downr::Render do
4
+ before(:each) do
5
+ Downr::Render.any_instance.stub(:initialize).and_return(Downr::Render.new({}))
6
+ end
4
7
  it{ should respond_to(:block_code) }
5
8
  it{ should respond_to(:paragraph) }
6
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: downr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: