rghost-ruby1.9-beta 0.8.7.2

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 (132) hide show
  1. data/lib/rghost.rb +18 -0
  2. data/lib/rghost/border.rb +44 -0
  3. data/lib/rghost/callback.rb +58 -0
  4. data/lib/rghost/circle.rb +102 -0
  5. data/lib/rghost/color.rb +175 -0
  6. data/lib/rghost/constants.rb +626 -0
  7. data/lib/rghost/convert.rb +43 -0
  8. data/lib/rghost/cursor.rb +124 -0
  9. data/lib/rghost/dash.rb +59 -0
  10. data/lib/rghost/document.rb +546 -0
  11. data/lib/rghost/document_callback_facade.rb +64 -0
  12. data/lib/rghost/dsc_entry.rb +20 -0
  13. data/lib/rghost/dynamic_document_callback.rb +15 -0
  14. data/lib/rghost/eps.rb +31 -0
  15. data/lib/rghost/font.rb +48 -0
  16. data/lib/rghost/font_map.rb +54 -0
  17. data/lib/rghost/frame.rb +105 -0
  18. data/lib/rghost/function.rb +38 -0
  19. data/lib/rghost/gif.rb +41 -0
  20. data/lib/rghost/graphic.rb +26 -0
  21. data/lib/rghost/grid/base_grid.rb +228 -0
  22. data/lib/rghost/grid/callback_facade.rb +136 -0
  23. data/lib/rghost/grid/csv_grid.rb +51 -0
  24. data/lib/rghost/grid/dynamic_callback.rb +12 -0
  25. data/lib/rghost/grid/field_format.rb +43 -0
  26. data/lib/rghost/grid/grid.rb +15 -0
  27. data/lib/rghost/grid/header.rb +120 -0
  28. data/lib/rghost/grid/matrix.rb +10 -0
  29. data/lib/rghost/grid/rails_grid.rb +74 -0
  30. data/lib/rghost/grid/static_callback.rb +13 -0
  31. data/lib/rghost/grid/style/border_lines.rb +44 -0
  32. data/lib/rghost/grid/style/bottom_lines.rb +28 -0
  33. data/lib/rghost/grid/style/old_forms.rb +28 -0
  34. data/lib/rghost/grid/style/style.rb +8 -0
  35. data/lib/rghost/gs_alone.rb +25 -0
  36. data/lib/rghost/helpers.rb +13 -0
  37. data/lib/rghost/horizontal_line.rb +45 -0
  38. data/lib/rghost/how_to.rb +75 -0
  39. data/lib/rghost/image.rb +26 -0
  40. data/lib/rghost/jpeg.rb +39 -0
  41. data/lib/rghost/line.rb +89 -0
  42. data/lib/rghost/line_width.rb +28 -0
  43. data/lib/rghost/load.rb +43 -0
  44. data/lib/rghost/newpath.rb +19 -0
  45. data/lib/rghost/paper.rb +147 -0
  46. data/lib/rghost/parse_text.rb +53 -0
  47. data/lib/rghost/pdf_security.rb +36 -0
  48. data/lib/rghost/point.rb +23 -0
  49. data/lib/rghost/point_with_command.rb +17 -0
  50. data/lib/rghost/polygon.rb +75 -0
  51. data/lib/rghost/ps/AdobeExpert.enc +258 -0
  52. data/lib/rghost/ps/AdobeLatinEncoding.enc +258 -0
  53. data/lib/rghost/ps/Bengali.enc +386 -0
  54. data/lib/rghost/ps/CodePage1250.enc +258 -0
  55. data/lib/rghost/ps/CodePage1251.enc +258 -0
  56. data/lib/rghost/ps/CodePage1252.enc +258 -0
  57. data/lib/rghost/ps/CodePage1253.enc +258 -0
  58. data/lib/rghost/ps/CodePage1254.enc +258 -0
  59. data/lib/rghost/ps/CodePage1256.enc +258 -0
  60. data/lib/rghost/ps/CodePage1257.enc +258 -0
  61. data/lib/rghost/ps/CodePage1258.enc +258 -0
  62. data/lib/rghost/ps/CodePage874.enc +258 -0
  63. data/lib/rghost/ps/Fontmap +5 -0
  64. data/lib/rghost/ps/IsoLatin.enc +352 -0
  65. data/lib/rghost/ps/MacCentralEuropean.enc +258 -0
  66. data/lib/rghost/ps/MacCyrillice.desnc +258 -0
  67. data/lib/rghost/ps/MacGreek.enc +258 -0
  68. data/lib/rghost/ps/MacHebrew.enc +258 -0
  69. data/lib/rghost/ps/TeX-CorkEncoding.enc +258 -0
  70. data/lib/rghost/ps/TeX-LGR-Greek.enc +258 -0
  71. data/lib/rghost/ps/TeX-T2AModified2Encoding.enc +258 -0
  72. data/lib/rghost/ps/TeX-T2BAdobeEncoding.enc +258 -0
  73. data/lib/rghost/ps/TeX-T2CAdobeEncoding.enc +258 -0
  74. data/lib/rghost/ps/TeX-X2AdobeEncoding.enc +258 -0
  75. data/lib/rghost/ps/TeX-XL2encoding.enc +258 -0
  76. data/lib/rghost/ps/TeXMathExtensionEncoding.enc +258 -0
  77. data/lib/rghost/ps/TeXMathItalicEncoding.enc +258 -0
  78. data/lib/rghost/ps/TeXMathSymbolEncoding.enc +258 -0
  79. data/lib/rghost/ps/US-ASCII.enc +258 -0
  80. data/lib/rghost/ps/UTF-8.enc +3 -0
  81. data/lib/rghost/ps/_cusor.ps +46 -0
  82. data/lib/rghost/ps/basic.ps +25 -0
  83. data/lib/rghost/ps/begin_document.ps +8 -0
  84. data/lib/rghost/ps/callbacks.ps +175 -0
  85. data/lib/rghost/ps/code128.font +344 -0
  86. data/lib/rghost/ps/code39.font +195 -0
  87. data/lib/rghost/ps/cursor.ps +106 -0
  88. data/lib/rghost/ps/datagrid.ps +55 -0
  89. data/lib/rghost/ps/developer.ps +237 -0
  90. data/lib/rghost/ps/ean.font +150 -0
  91. data/lib/rghost/ps/eps.ps +42 -0
  92. data/lib/rghost/ps/font.ps +38 -0
  93. data/lib/rghost/ps/frame.ps +16 -0
  94. data/lib/rghost/ps/gif.ps +150 -0
  95. data/lib/rghost/ps/horizontal_line.ps +4 -0
  96. data/lib/rghost/ps/i25.font +103 -0
  97. data/lib/rghost/ps/jpeg.ps +122 -0
  98. data/lib/rghost/ps/link.ps +22 -0
  99. data/lib/rghost/ps/paper.ps +8 -0
  100. data/lib/rghost/ps/rect_link.ps +17 -0
  101. data/lib/rghost/ps/rectangle.ps +5 -0
  102. data/lib/rghost/ps/rghost_default_template.eps +1532 -0
  103. data/lib/rghost/ps/row.ps +4 -0
  104. data/lib/rghost/ps/show.ps +21 -0
  105. data/lib/rghost/ps/table_callbacks.ps +96 -0
  106. data/lib/rghost/ps/text.ps +63 -0
  107. data/lib/rghost/ps/textarea.ps +11 -0
  108. data/lib/rghost/ps/type.ps +1 -0
  109. data/lib/rghost/ps/unit.ps +3 -0
  110. data/lib/rghost/ps/vertical_line.ps +12 -0
  111. data/lib/rghost/ps/virtual_pages.ps +55 -0
  112. data/lib/rghost/ps_facade.rb +253 -0
  113. data/lib/rghost/ps_object.rb +55 -0
  114. data/lib/rghost/rectangle_link.rb +65 -0
  115. data/lib/rghost/rgengine.so +0 -0
  116. data/lib/rghost/ruby_ghost_config.rb +243 -0
  117. data/lib/rghost/ruby_ghost_engine.rb +156 -0
  118. data/lib/rghost/ruby_ghost_version.rb +8 -0
  119. data/lib/rghost/ruby_to_ps.rb +78 -0
  120. data/lib/rghost/scale.rb +29 -0
  121. data/lib/rghost/shape_content.rb +23 -0
  122. data/lib/rghost/show.rb +88 -0
  123. data/lib/rghost/static_document_callback.rb +18 -0
  124. data/lib/rghost/text.rb +44 -0
  125. data/lib/rghost/text_in.rb +51 -0
  126. data/lib/rghost/text_link_in.rb +42 -0
  127. data/lib/rghost/textarea.rb +88 -0
  128. data/lib/rghost/units.rb +82 -0
  129. data/lib/rghost/variable.rb +12 -0
  130. data/lib/rghost/vertical_line.rb +37 -0
  131. data/lib/rghost/virtual_pages.rb +42 -0
  132. metadata +185 -0
@@ -0,0 +1,228 @@
1
+ require 'enumerator'
2
+ # RGhost::Grid::Base is a helper object to create a tabular
3
+ # representations, composed of rows, columns and a title. This
4
+ # prototype used to join the common attributes for data grids. To use
5
+ # a Grid you must first setup the columns, then load the data.
6
+ #
7
+ # Example:
8
+ # grid=Grid::Matrix.new
9
+ # grid.column :title => "Code", :width => 1
10
+ # grid.column :title => "Name", :width => 3, :align => :center
11
+ # grid.column :title => "Date", :width => 3, :align => :center
12
+ #
13
+ # Note that both the width and align of the last two columns are
14
+ # identical. To avoid repetition, you can specify a default width upon
15
+ # creating the DataGrid::Grid object. Any columns that do not specify
16
+ # an explicit width and align property will inherit the defaults.
17
+ #
18
+ # Example:
19
+ #
20
+ # grid=Grid::Matrix.new :width => 3, :align => :center
21
+ # grid.column :title => "Code", :width => 1 #:width => 1, :align => :center
22
+ # grid.column :title => "Name" #:width => 3, :align => :center
23
+ # grid.column :title => "Date" #:width => 3, :align => :center
24
+ #
25
+ # The actual content needs to be passed in as an array of arrays
26
+ #
27
+ # values=[
28
+ # [1,"Name 1", Time.now],
29
+ # [2,"Name 2", Time.now],
30
+ # [3,"Name 3", Time.now],
31
+ # [4,"Name 4", Time.now],
32
+ # [5,"Name 5", Time.now]
33
+ # ]
34
+ #
35
+ # Bind the content to the grid:
36
+ # grid.data(values)
37
+ # Add the Grid to a document
38
+ # d=Document.new
39
+ # d.set grid
40
+ #
41
+ class RGhost::Grid::Base < RGhost::PsObject
42
+ attr_reader :header
43
+ attr_accessor :column_padding
44
+ include RGhost::RubyToPs
45
+ include RGhost::Grid::CallbackFacade
46
+
47
+ #===Options
48
+ #* <tt>:headings</tt> - To disable headers set this attribute to false.
49
+ #* <tt>:column_padding</tt> - Padding between column content and its edge.
50
+ #* <tt>:width</tt> - Width for all columns.
51
+ #* <tt>:align</tt> - Align for all data(:left, :center and :right).
52
+ #* <tt>:title_align</tt> - Align for all the header's name(:left, :center and :right).
53
+ def initialize(options={})
54
+
55
+ @header=RGhost::Grid::Header.new( (options[:headings] == false)?false:true )
56
+ @header.default_options(options)
57
+ @callbacks=RGhost::PsObject.new
58
+ @column_padding= options[:column_padding] || 0.1
59
+ @record_count=1
60
+ @data=[]
61
+ @data[0]=[]
62
+ @data_index=0
63
+ @max_stack=RGhost::Config::GS[:stack_elements]
64
+ end
65
+
66
+
67
+ # Defines properties of a column. Parameters are the same as for new,
68
+ # plus some additional ones like :format.
69
+ # * <tt>:format</tt> - Format of the data. You can format data in four
70
+ # different ways with Rghost, passing in a Symbol
71
+ # a String a Class or Proc.
72
+ #
73
+ # ==== :format Parameters type
74
+ # * Symbol - Searches for a method defined as Grid::FieldFormat::method_name
75
+ # :format => :eurodate
76
+ # * Class - A class that inherits Grid::FieldFormat::Custom with a overridden format method.
77
+ # :format => MyFormat
78
+ # * String - Formats using the same parameters used in sprintf
79
+ # :format => "%0.2f"
80
+ # * Proc - A block. In the example a text limited to 9 characters.
81
+ # :format => lambda {|s| s.gsub(/^(.{9}).*$/,'\1...')}
82
+ # ====Customizing formats
83
+ # Replace spaces with a double dash.
84
+ # class MyFormat < DataGrid::FieldFormat::Custom
85
+ # def format
86
+ # @value.to_s.gsub(/ /,'--')
87
+ # end
88
+ # end
89
+ #
90
+ # Using
91
+ #
92
+ # grid.column :title => "Name", :format => MyFormat
93
+ #
94
+ # Below, the columns with their proper formats.
95
+ #
96
+ # grid.column :title => "Code",:format => "(%d)", :width => 1
97
+ # grid.column :title => "Name", :format => MyFormat
98
+ # grid.column :title => "Date", :format => lambda {|date| date.strftime("%d/%m/%Y") }
99
+ # values=[
100
+ # [1,"Name 1", Time.now],
101
+ # [2,"Name 2", Time.now],
102
+ # [3,"Name 3", Time.now],
103
+ # [4,"Name 4", Time.now],
104
+ # [5,"Name 5", Time.now]
105
+ # ]
106
+ # grid.data(values)
107
+ # Add the Grid to a document
108
+ #
109
+ # d=Document.new
110
+ # d.set grid
111
+ # link:images/format01.png
112
+ def col(title="", options={})
113
+ if title.is_a? Hash
114
+
115
+ @header.col(title[:title],title)
116
+ else
117
+
118
+ @header.col(title,options)
119
+ end
120
+ end
121
+ #Alias for col
122
+ def column(title="", options={})
123
+ col(title,options)
124
+
125
+ end
126
+
127
+ def format_field(value,type) #:nodoc:
128
+ case type
129
+ when Symbol
130
+ RGhost::Grid::FieldFormat.send(type,value)
131
+ when String
132
+ RGhost::Grid::FieldFormat.string(type % value)
133
+ when NilClass
134
+ RGhost::Grid::FieldFormat.string(value)
135
+ when Class
136
+ type.new(value).gs_format
137
+ when Proc
138
+ RGhost::Grid::FieldFormat.string(type.call(value))
139
+
140
+ else raise TypeError.new("type=#{type}, value type=#{value.class}")
141
+ end
142
+
143
+ end
144
+ def width
145
+ @header.size
146
+ end
147
+ def proc_line(line) #:nodoc:
148
+ h=@header.data_types
149
+ rec=[]
150
+ line.each_with_index do |v,i|
151
+ #puts "#{i} == #{h[i]} = #{v}, #{format_field(v,h[i])}"
152
+ rec << format_field(v,h[i])
153
+ end
154
+ @data[@data_index] << "[#{rec}]\n"
155
+
156
+
157
+ if @record_count == @max_stack
158
+ @record_count=0
159
+ @data_index+=1
160
+ @data[@data_index]=[]
161
+ end
162
+ @record_count+=1
163
+
164
+
165
+ end
166
+ #Defines data to grid processor.
167
+ def data(data)
168
+
169
+ end
170
+ public
171
+
172
+ def ps
173
+
174
+
175
+ grid_names=[]
176
+ p=RGhost::PsObject.new
177
+ p.set RGhost::Variable.new(:col_padding,RGhost::Units::parse(@column_padding))
178
+ @data.each do |ary|
179
+ r=(rand*99999).to_i
180
+ p.raw "/data#{r}[\n#{ary.join}\n] def"
181
+ grid_names << r
182
+ end
183
+ p.raw "#{@header.ps} #{@callbacks}"
184
+
185
+ g=RGhost::Graphic.new do
186
+ raw :before_table_create
187
+ raw grid_names.map{|m| " data#{m} table_proc \n" }.join
188
+ raw :after_table_create
189
+ end
190
+ p.set g
191
+ p.raw :nrdp
192
+ p
193
+
194
+
195
+ end
196
+
197
+ # Grid has 3 preset styles :bottom_lines, :border_lines and
198
+ # old_forms. To set any of them, use:
199
+ #
200
+ # grid.style(:border_lines)
201
+ #
202
+ # :border_lines - instance of Grid::Style::BorderLines
203
+ #
204
+ # link:images/setstyle01.png
205
+ #
206
+ # :bottom_lines - instance of Grid::Style::BottomLines
207
+ #
208
+ # link:images/setstyle02.png
209
+ #
210
+ # :old_forms - instance of Grid::Style::OldForms
211
+ #
212
+ # link:images/setstyle03.png
213
+ def style(type=:border_lines)
214
+ st=case type
215
+ when :border_lines
216
+ RGhost::Grid::Style::BorderLines.new
217
+ when :old_forms
218
+ RGhost::Grid::Style::OldForms.new
219
+ when :bottom_lines
220
+ RGhost::Grid::Style::BottomLines.new
221
+ else raise NameError.new("Why? #{type} ?")
222
+ end
223
+
224
+ st.set_style(self)
225
+
226
+ end
227
+
228
+ end
@@ -0,0 +1,136 @@
1
+
2
+ module RGhost::Grid
3
+ # The callbacks for the grid are defined here. Let's see them in action.
4
+ # ===Grid::CallbackFacade examples
5
+ # grid=Grid::Matrix.new :column_padding => 1
6
+ # grid.column :title => "Id", :width => 1
7
+ # grid.column :title => "Name", :width => 3, :align => :center
8
+ # grid.column :title => "Date", :width => 3, :align => :right, :title_align => :center, :format => lambda{|v| v.strftime("%d/%m/%Y")}
9
+ # values=('A'..'E').to_a.map{|v| [v,"Name #{v}", Time.now]}
10
+ #
11
+ # even_row:
12
+ # grid.even_row do |e|
13
+ # e.background_row(:size => grid.width)
14
+ # end
15
+ # link:images/grid01.png
16
+ #
17
+ # Now before_row to create a top and bottom line:
18
+ # grid.before_row do |b|
19
+ # b.horizontal_line(:top, :size => grid.width )
20
+ # b.horizontal_line(:bottom, :size => grid.width)
21
+ # end
22
+ #
23
+ # link:images/grid02.png
24
+ #
25
+ # before_column:
26
+ # grid.before_column do |v|
27
+ # v.vertical_line_row
28
+ # end
29
+ #
30
+ # link:images/grid03.png
31
+ #
32
+ # after_column:
33
+ # grid.after_column {|c| c.vertical_line_row }
34
+ #
35
+ #
36
+ # link:images/grid04.png
37
+ #
38
+ # Moving to the header
39
+ # grid.header.before_create do |b|
40
+ # b.horizontal_line(:top, :size => grid.width)
41
+ # end
42
+ #
43
+ # link:images/grid05.png
44
+ #
45
+ # Finishing the grid lines:
46
+ # grid.header.before_column do |b|
47
+ # b.vertical_line_row
48
+ # end
49
+ #
50
+ #
51
+ # grid.header.after_column do |b|
52
+ # b.vertical_line_row
53
+ # end
54
+ #
55
+ # link:images/grid06.png
56
+ #
57
+ # Now a adding a bold font to the header
58
+ # grid.header.before_create do |b|
59
+ # b.horizontal_line(:top, :size => grid.width)
60
+ # b.use_tag :bold
61
+ # end
62
+ #
63
+ # link:images/grid07.png
64
+ #
65
+ # Oops. Not quite what we expected, the entire grid used bold
66
+ # face. We need to use a header callback to reset the font.
67
+ #
68
+ # grid.header.after_create do
69
+ # b.use_tag :normal
70
+ # end
71
+ #
72
+ # link:images/grid08.png
73
+ #
74
+ # Don't forget
75
+ #
76
+ # doc=Document.new
77
+ # doc.set grid
78
+ module CallbackFacade
79
+
80
+ # Executes before processing row. Responds to :only and :except
81
+ # options.
82
+ def before_row(options={},&block)
83
+ new_dynamic_callback(:before_row,options,&block)
84
+ end
85
+
86
+ # Executes on creating an odd rows. Responds to :only and :except
87
+ # options.
88
+ def odd_row(options={},&block)
89
+ new_dynamic_callback(:odd_row,options,&block)
90
+ end
91
+
92
+ # Executes upon creating even rows. Responds to :only and :except
93
+ # options.
94
+ def even_row(options={},&block)
95
+ new_dynamic_callback(:even_row,options,&block)
96
+ end
97
+
98
+ # Executes before creating a column. Responds to :only and :except
99
+ # options.
100
+ def before_column(options={},&block)
101
+ new_dynamic_callback(:before_column,options,&block)
102
+ end
103
+
104
+ # Executes after a column was created. Responds to :only and
105
+ # :except options.
106
+ def after_column(options={},&block)
107
+ new_dynamic_callback(:after_column,options,&block)
108
+ end
109
+
110
+ # Executes when creating an odd column. Responds to :only and
111
+ # :except options.
112
+ def odd_column(options={},&block)
113
+ new_dynamic_callback(:odd_column,options,&block)
114
+ end
115
+
116
+ # Executes upon creating an even column. Responds to :only and
117
+ # :except options.
118
+ def even_column(options={},&block)
119
+ new_dynamic_callback(:even_column,options,&block)
120
+ end
121
+
122
+
123
+ private
124
+
125
+ def new_dynamic_callback(name,options={},&block)
126
+ @callbacks.set RGhost::Callback.new(name,options,&block)
127
+ end
128
+ def new_static_callback(name,&block)
129
+
130
+ callback_body= RGhost::PsFacade.new(&block)
131
+ @callbacks.set RGhost::Function.new(name,callback_body)
132
+ end
133
+
134
+
135
+ end
136
+ end
@@ -0,0 +1,51 @@
1
+
2
+ # Grid::CSV allows you to import data from a csv file.
3
+
4
+ # ===Example
5
+ #
6
+ # grid=Grid::CSV.new :width => 2
7
+ # grid.column :title => "User", :align => :right
8
+ # grid.column :title => "Password", :format => lambda{|v| (v.to_s == "x") ? "Yes" : "No"}
9
+ # grid.column :title => "UID", :width => 1
10
+ # grid.column :title => "GID"
11
+ # grid.column :title => "Gecos", :width => 2.5
12
+ # grid.column :title => "Home Dir", :width => 4
13
+ # grid.column :title => "Shell"
14
+ # grid.style :bottom_lines
15
+ # grid.data("/etc/passwd",/:/)
16
+ #
17
+ # link:images/csvgrid01.png
18
+ #
19
+ class RGhost::Grid::CSV < RGhost::Grid::Base
20
+ # Pass in path to file and the record separator:
21
+ # grid.data("/mydir/myfile.csv", ';')
22
+ # You can use a regular expression for record separator:
23
+ # grid.data("/mydir/myfile.csv", /[^\w]/)
24
+
25
+ def data(filepath,col_sep=';')
26
+ _data=filepath
27
+ first=true
28
+ _data=File.open(_data) if _data.is_a? String
29
+ _data.each do |line|
30
+ l=line.split(Regexp.new(col_sep)) if col_sep.is_a?(String)
31
+ l=line.split(col_sep) if col_sep.is_a?(Regexp)
32
+ if first
33
+ v=l.size-@header.titles.size
34
+ #v.times{@header.titles << "tt"}
35
+ #l.each {|h| col(h)} if @header.titles.size == 0
36
+ l.each {|h| col("")} if @header.titles.size == 0
37
+ proc_line(l)
38
+ first=false
39
+
40
+ next
41
+ else
42
+
43
+ proc_line(l)
44
+ end
45
+ end
46
+
47
+ end
48
+
49
+
50
+
51
+ end
@@ -0,0 +1,12 @@
1
+ require "rghost/callback"
2
+ #Dynamic Callbacks
3
+ class RGhost::Grid::DynamicCallback < RGhost::Callback
4
+ ACCEPT=[:before_row, :after_row, :even_row,
5
+ :odd_row, :before_column, :after_column, :even_column, :odd_column]
6
+
7
+ def initialize(name,options={},&block)
8
+ raise NameError.new("#{name} no accept in #{self.class}") unless ACCEPT.include? name
9
+ super(name,options,&block)
10
+ end
11
+
12
+ end
@@ -0,0 +1,43 @@
1
+ $LOAD_PATH << File.dirname(__FILE__)+File::SEPARATOR+"../"
2
+
3
+ require 'rghost/ps_object'
4
+
5
+ require 'rghost/ruby_to_ps'
6
+
7
+ module RGhost::Grid
8
+ module FieldFormat
9
+ extend RGhost::RubyToPs
10
+ #Format Time/Date to %d/%m/%Y
11
+ def self.eurodate(value)
12
+
13
+ string(value.strftime("%d/%m/%Y"))
14
+ end
15
+ #Cut all blank spaces
16
+ def self.no_space(value)
17
+ string(value.to_s.gsub(/\s/,''))
18
+ end
19
+
20
+ def self.string(value)
21
+ to_string(value)
22
+ end
23
+
24
+ end
25
+ end
26
+ #Prototype to override format method.
27
+ class RGhost::Grid::FieldFormat::Custom
28
+
29
+ def initialize(value)
30
+ @value=value
31
+ end
32
+
33
+ def gs_format
34
+ RGhost::Grid::FieldFormat.string(self.format)
35
+ end
36
+
37
+ def format
38
+ @value.to_s
39
+ end
40
+
41
+ end
42
+
43
+