dyi_rails 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,65 @@
1
+ # -*- encoding: UTF-8 -*-
2
+
3
+ # Copyright (c) 2009-2012 Sound-F Co., Ltd. All rights reserved.
4
+ #
5
+ # Author:: Mamoru Yuo
6
+ #
7
+ # This file is part of "DYI for Rails".
8
+ #
9
+ # "DYI for Rails" is free software: you can redistribute it and/or modify
10
+ # it under the terms of the GNU General Public License as published by
11
+ # the Free Software Foundation, either version 3 of the License, or
12
+ # (at your option) any later version.
13
+ #
14
+ # "DYI for Rails" is distributed in the hope that it will be useful,
15
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
+ # GNU General Public License for more details.
18
+ #
19
+ # You should have received a copy of the GNU General Public License
20
+ # along with "DYI for Rails". If not, see <http://www.gnu.org/licenses/>.
21
+
22
+
23
+ module DyiRails
24
+
25
+ # Provides a set of methods for sending the image using DYI on the Rails'
26
+ # controller.
27
+ module Streaming
28
+
29
+ # Sends image the image using DYI on the Rails' controller.
30
+ # @param [DYI::Canvas, DYI::Chart::Base] canvas a canvas that hold the image
31
+ # @option options [Symbol, String] :format format of the image. Default to
32
+ # +:svg+
33
+ # @option options [String] :namespace XML namespace when XML format (e.g.
34
+ # SVG) is specified at +:format+ option. If nothing is specified,
35
+ # XML namespace is not used
36
+ # @option options [String] :file_name suggests a filename for the browser to
37
+ # use
38
+ # @option options [String] :disposition specifies whether the file will be
39
+ # shown inline or downloaded. Valid values are <tt>'inline'</tt> and
40
+ # <tt>'attachment'</tt> (default)
41
+ # @option options [String] :status specifies the status code to send with
42
+ # the response. Defaults to <tt>'200 OK'</tt>
43
+ # @example
44
+ # class TeamsController < ApplicationController
45
+ # include DyiRails::Streaming
46
+ #
47
+ # # responses /teams/emblem/any_id.svg
48
+ # def emblem
49
+ # # creates image using DYI
50
+ # canvas = DYI::Canvas.new(200, 150)
51
+ # # codes to draw an image
52
+ #
53
+ # # sends image data
54
+ # send_dyi_image(canvas, :format => params['format'])
55
+ # end
56
+ # end
57
+ def send_dyi_image(canvas, options={})
58
+ opt = options.clone
59
+ format = opt.delete(:format) || :svg
60
+ namespace = opt.delete(:namespace)
61
+ opt[:type] = DyiRails.mime_type(format)
62
+ send_data(canvas.string(format, :namespace => namespace), opt)
63
+ end
64
+ end
65
+ end
metadata ADDED
@@ -0,0 +1,102 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dyi_rails
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.0
6
+ platform: ruby
7
+ authors:
8
+ - Mamoru Yuo
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2012-04-06 00:00:00 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: dyi
17
+ prerelease: false
18
+ requirement: &id001 !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.0.0
24
+ type: :development
25
+ version_requirements: *id001
26
+ - !ruby/object:Gem::Dependency
27
+ name: rails
28
+ prerelease: false
29
+ requirement: &id002 !ruby/object:Gem::Requirement
30
+ none: false
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: 2.0.0
35
+ type: :development
36
+ version_requirements: *id002
37
+ - !ruby/object:Gem::Dependency
38
+ name: dyi
39
+ prerelease: false
40
+ requirement: &id003 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: 1.0.0
46
+ type: :runtime
47
+ version_requirements: *id003
48
+ - !ruby/object:Gem::Dependency
49
+ name: rails
50
+ prerelease: false
51
+ requirement: &id004 !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: 2.0.0
57
+ type: :runtime
58
+ version_requirements: *id004
59
+ description: " \"DYI for Rails\" is a library for use DYI on Rails.\n \"DYI for Rails\" provides some helpers and module for drawing a image of DYI.\n"
60
+ email: dyi_support@sound-f.jp
61
+ executables: []
62
+
63
+ extensions: []
64
+
65
+ extra_rdoc_files: []
66
+
67
+ files:
68
+ - CHANGES
69
+ - COPYING
70
+ - lib/dyi_rails/dyi_helper.rb
71
+ - lib/dyi_rails/streaming.rb
72
+ - lib/dyi_rails.rb
73
+ - README
74
+ homepage: http://sourceforge.net/projects/dyi-rails/
75
+ licenses:
76
+ - GPL-3
77
+ post_install_message:
78
+ rdoc_options: []
79
+
80
+ require_paths:
81
+ - lib
82
+ required_ruby_version: !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ version: 1.8.7
88
+ required_rubygems_version: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: "0"
94
+ requirements: []
95
+
96
+ rubyforge_project:
97
+ rubygems_version: 1.8.10
98
+ signing_key:
99
+ specification_version: 3
100
+ summary: A library to use DYI on Rails
101
+ test_files: []
102
+