crayfish 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -76,12 +76,24 @@ module Crayfish
76
76
  buf
77
77
  end
78
78
 
79
- def method_missing(meth, *args, &block)
80
- if @pdf.respond_to?(meth)
79
+ def method_missing(id,*args,&block)
80
+ case(id.to_s)
81
+ when /^fill_and_stroke_(.*)/
81
82
  flush
82
- @pdf.send(meth,*args)
83
+ @pdf.send($1,*args,&block); @pdf.fill_and_stroke
84
+ when /^stroke_(.*)/
85
+ flush
86
+ @pdf.send($1,*args,&block); @pdf.stroke
87
+ when /^fill_(.*)/
88
+ flush
89
+ @pdf.send($1,*args,&block); @pdf.fill
83
90
  else
84
- super
91
+ if @pdf.respond_to?(id)
92
+ flush
93
+ @pdf.send(id,*args,&block)
94
+ else
95
+ super
96
+ end
85
97
  end
86
98
  end
87
99
 
@@ -29,18 +29,20 @@ module Crayfish
29
29
  attr_reader :options
30
30
 
31
31
  def initialize(controller)
32
- controller_options = controller.send(:options) || {}
32
+ controller_options = controller ? controller.send(:options) || {} : {}
33
33
  @options = Crayfish::ActionController.options.merge(Hash[*controller_options.map{ |k,v| [k.to_sym,v] }.flatten])
34
34
 
35
- if options[:html]
36
- controller.response.content_type ||= Mime::HTML
37
- else
38
- controller.response.content_type ||= Mime::PDF
35
+ if controller
36
+ if options[:html]
37
+ controller.response.content_type ||= Mime::HTML
38
+ else
39
+ controller.response.content_type ||= Mime::PDF
40
+ end
39
41
  end
40
42
 
41
43
  inline = options[:inline] ? 'inline' : 'attachment'
42
44
  filename = options[:filename] ? "filename=#{options[:filename]}" : nil
43
- controller.headers["Content-Disposition"] = [inline,filename].compact.join(';')
45
+ controller.headers["Content-Disposition"] = [inline,filename].compact.join(';') if controller
44
46
  end
45
47
 
46
48
  end
@@ -21,5 +21,5 @@
21
21
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
22
 
23
23
  module Crayfish
24
- VERSION = "0.2.1"
24
+ VERSION = "0.2.2"
25
25
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crayfish
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-24 00:00:00.000000000Z
12
+ date: 2012-04-27 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &70124975686620 !ruby/object:Gem::Requirement
16
+ requirement: &70290046667320 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70124975686620
24
+ version_requirements: *70290046667320
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: prawn
27
- requirement: &70124975685640 !ruby/object:Gem::Requirement
27
+ requirement: &70290046666360 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70124975685640
35
+ version_requirements: *70290046666360
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: nokogiri
38
- requirement: &70124975684640 !ruby/object:Gem::Requirement
38
+ requirement: &70290046665540 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70124975684640
46
+ version_requirements: *70290046665540
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: sqlite3
49
- requirement: &70124975683300 !ruby/object:Gem::Requirement
49
+ requirement: &70290046663920 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70124975683300
57
+ version_requirements: *70290046663920
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: mocha
60
- requirement: &70124975664080 !ruby/object:Gem::Requirement
60
+ requirement: &70290046660760 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70124975664080
68
+ version_requirements: *70290046660760
69
69
  description: Crayfish - PDF templating for Rails
70
70
  email:
71
71
  - patrick.hanevold@gmail.com
@@ -133,7 +133,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
133
133
  version: '0'
134
134
  segments:
135
135
  - 0
136
- hash: 1879490550741620939
136
+ hash: 791229958043033619
137
137
  required_rubygems_version: !ruby/object:Gem::Requirement
138
138
  none: false
139
139
  requirements:
@@ -142,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
142
  version: '0'
143
143
  segments:
144
144
  - 0
145
- hash: 1879490550741620939
145
+ hash: 791229958043033619
146
146
  requirements: []
147
147
  rubyforge_project:
148
148
  rubygems_version: 1.8.15