rghost 0.8.6.3 → 0.8.6.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.
@@ -45,10 +45,11 @@ class RGhost::Callback < RGhost::PsObject
45
45
  private
46
46
  def num_to_array(value)
47
47
  case value
48
- when Fixnum:
48
+ when Fixnum
49
49
  a=[]
50
50
  a << value
51
- when NilClass: []
51
+ when NilClass
52
+ []
52
53
  else
53
54
  value
54
55
  end
data/lib/rghost/color.rb CHANGED
@@ -35,14 +35,14 @@ class RGhost::Color < RGhost::PsObject
35
35
  def self.create(color="FFAA99")
36
36
 
37
37
  return case color
38
- when String: RGhost::RGB.new(color)
39
- when Symbol:
38
+ when String then RGhost::RGB.new(color)
39
+ when Symbol
40
40
  c=RGhost::Constants::Colors::RGB[color]
41
41
  raise ArgumentError.new("#{color}##{color.class}") unless c
42
42
  self.create c
43
43
 
44
- when Array, Hash:
45
- if color.size == 3
44
+ when Array, Hash
45
+ if color.size == 3
46
46
  RGhost::RGB.new(color)
47
47
  elsif color.size == 4
48
48
  RGhost::CMYK.new(color)
@@ -51,7 +51,7 @@ class RGhost::Color < RGhost::PsObject
51
51
  else
52
52
  raise ArgumentError.new("#{color}##{color.class}")
53
53
  end
54
- when Numeric: RGhost::Gray.new(color)
54
+ when Numeric then RGhost::Gray.new(color)
55
55
  else
56
56
  raise ArgumentError.new("#{color}##{color.class}")
57
57
  end
@@ -93,10 +93,14 @@ class RGhost::RGB < RGhost::Color
93
93
  end
94
94
  def color_params
95
95
  case @color
96
- when Hash: [@color[:red] || @color[:r],@color[:green] || @color[:g],@color[:blue] || @color[:b]]
97
- when Array: @color
98
- when String: hex_to_rgb(@color)
99
- when NilClass: [0,0,1]
96
+ when Hash
97
+ [@color[:red] || @color[:r],@color[:green] || @color[:g],@color[:blue] || @color[:b]]
98
+ when Array
99
+ @color
100
+ when String
101
+ hex_to_rgb(@color)
102
+ when NilClass
103
+ [0,0,1]
100
104
  end
101
105
 
102
106
 
@@ -126,8 +130,10 @@ class RGhost::CMYK < RGhost::Color
126
130
 
127
131
  def ps
128
132
  value=case @color
129
- when Hash: [@color[:cyan] || @color[:c],@color[:magenta] || @color[:m],@color[:yellow] || @color[:y],@color[:black] || @color[:k]]
130
- when Array: @color
133
+ when Hash
134
+ [@color[:cyan] || @color[:c],@color[:magenta] || @color[:m],@color[:yellow] || @color[:y],@color[:black] || @color[:k]]
135
+ when Array
136
+ @color
131
137
  end
132
138
 
133
139
  array_to_stack(value.map{|n| n > 1 ? n/100.0: n})+"setcmykcolor"
@@ -147,8 +153,10 @@ class RGhost::CMYKSpot < RGhost::Color
147
153
 
148
154
  def ps
149
155
  value=case @color
150
- when Hash: [@color[:cyan] || @color[:c],@color[:magenta] || @color[:m],@color[:yellow] || @color[:y],@color[:black] || @color[:k]]
151
- when Array: @color
156
+ when Hash
157
+ [@color[:cyan] || @color[:c],@color[:magenta] || @color[:m],@color[:yellow] || @color[:y],@color[:black] || @color[:k]]
158
+ when Array
159
+ @color
152
160
  end
153
161
 
154
162
  array_to_stack(value.map{|n| n > 1 ? n/100.0: n}) + "(#{@name.to_s}) findcmykcustomcolor \n/#{@name.to_s.gsub(' ', '_')} exch def\n\n#{@name.to_s.gsub(' ', '_')} 1 setcustomcolor"
data/lib/rghost/font.rb CHANGED
@@ -34,9 +34,12 @@ class RGhost::Font < RGhost::PsObject #:nodoc:
34
34
 
35
35
  size= o[:size]
36
36
  str_ret+=case size
37
- when Hash: "/#{@name} findfont [ #{size[:width]} 0 0 #{size[:height]} 0 0] makefont setfont "
38
- when Array: "/#{@name} findfont [ #{size[0]} 0 0 #{size[1]} 0 0] makefont setfont "
39
- when Fixnum: "/#{@name} findfont #{size} scalefont setfont "
37
+ when Hash
38
+ "/#{@name} findfont [ #{size[:width]} 0 0 #{size[:height]} 0 0] makefont setfont "
39
+ when Array
40
+ "/#{@name} findfont [ #{size[0]} 0 0 #{size[1]} 0 0] makefont setfont "
41
+ when Fixnum
42
+ "/#{@name} findfont #{size} scalefont setfont "
40
43
  end
41
44
  str_ret
42
45
  end
@@ -126,11 +126,16 @@ class RGhost::Grid::Base < RGhost::PsObject
126
126
 
127
127
  def format_field(value,type) #:nodoc:
128
128
  case type
129
- when Symbol: RGhost::Grid::FieldFormat.send(type,value)
130
- when String: RGhost::Grid::FieldFormat.string(type % value)
131
- when NilClass: RGhost::Grid::FieldFormat.string(value)
132
- when Class: type.new(value).gs_format
133
- when Proc: RGhost::Grid::FieldFormat.string(type.call(value))
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))
134
139
 
135
140
  else raise TypeError.new("type=#{type}, value type=#{value.class}")
136
141
  end
@@ -207,9 +212,12 @@ class RGhost::Grid::Base < RGhost::PsObject
207
212
  # link:images/setstyle03.png
208
213
  def style(type=:border_lines)
209
214
  st=case type
210
- when :border_lines: RGhost::Grid::Style::BorderLines.new
211
- when :old_forms: RGhost::Grid::Style::OldForms.new
212
- when :bottom_lines: RGhost::Grid::Style::BottomLines.new
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
213
221
  else raise NameError.new("Why? #{type} ?")
214
222
  end
215
223
 
@@ -45,9 +45,12 @@ class RGhost::Grid::Rails < RGhost::Grid::Base
45
45
  _data.collect do |d|
46
46
  line=@rails_cols.collect do |c|
47
47
  case c[:field_name]
48
- when Symbol: d[c[:field_name]]
49
- when String: d.instance_eval c[:field_name]
50
- when Proc: d.instance_eval(&c[:field_name])
48
+ when Symbol
49
+ d[c[:field_name]]
50
+ when String
51
+ d.instance_eval c[:field_name]
52
+ when Proc
53
+ d.instance_eval(&c[:field_name])
51
54
  end
52
55
  end
53
56
  proc_line(line)
data/lib/rghost/paper.rb CHANGED
@@ -87,8 +87,10 @@ class RGhost::Paper < RGhost::PsObject
87
87
 
88
88
 
89
89
  return case RGhost::Config::GS[:unit].new
90
- when RGhost::Units::Cm: (value.to_f*72/2.545).to_i
91
- when RGhost::Units::Inch: (value.to_f*72).to_i
90
+ when RGhost::Units::Cm
91
+ (value.to_f*72/2.545).to_i
92
+ when RGhost::Units::Inch
93
+ (value.to_f*72).to_i
92
94
  else
93
95
  value
94
96
  end
@@ -105,9 +107,10 @@ class RGhost::Paper < RGhost::PsObject
105
107
  #end
106
108
 
107
109
  case @options[:margin]
108
- when Numeric: mt=mr=mb=ml=RGhost::Units::parse(@options[:margin])
109
- when Array:
110
- mt=RGhost::Units::parse(@options[:margin][0] || DEFAULT_OPTIONS[:margin_top] )
110
+ when Numeric
111
+ mt=mr=mb=ml=RGhost::Units::parse(@options[:margin])
112
+ when Array
113
+ mt=RGhost::Units::parse(@options[:margin][0] || DEFAULT_OPTIONS[:margin_top] )
111
114
  mr=RGhost::Units::parse(@options[:margin][1] || DEFAULT_OPTIONS[:margin_right])
112
115
  mb=RGhost::Units::parse(@options[:margin][2] || DEFAULT_OPTIONS[:margin_bottom])
113
116
  ml=RGhost::Units::parse(@options[:margin][3] || DEFAULT_OPTIONS[:margin_left] )
@@ -124,12 +127,11 @@ class RGhost::Paper < RGhost::PsObject
124
127
  def format_paper
125
128
 
126
129
  case @paper
127
- when Symbol:
128
-
129
- p=RGhost::Constants::Papers::STANDARD[@paper.to_s.downcase.to_sym]
130
+ when Symbol
131
+ p=RGhost::Constants::Papers::STANDARD[@paper.to_s.downcase.to_sym]
130
132
  p.reverse! if @options[:landscape]
131
133
  {:rg => "/pagesize #{to_array( p ) } def\n", :gs => p, :done => true}
132
- when Array:
134
+ when Array
133
135
  @paper.reverse! if @options[:landscape]
134
136
  {:rg => "/pagesize #{to_array( @paper.map{|v| to_pt(v) } ) } def\n", :gs => @paper, :done => false}
135
137
  end
@@ -5,10 +5,10 @@ module RGhost::ParseText #:nodoc:
5
5
 
6
6
  unless @tag_parse
7
7
  case @options[:text_align]
8
- when :center, :right:
8
+ when :center, :right
9
9
  @text.split(/\n/).map{|l| "#{to_string(l)} :text_proc_cr :nbw " }.to_s
10
10
  jump_with=':nbw'
11
- when :left,nil:
11
+ when :left,nil
12
12
  if self.class == RGhost::Text
13
13
  return @text.split(/\n/).map{|l| " :text #{to_string(l)} :text_proc nrdp " }.to_s
14
14
 
@@ -54,16 +54,16 @@ class RGhost::Engine
54
54
 
55
55
 
56
56
  case @document
57
- when RGhost::Document:
57
+ when RGhost::Document
58
58
  file_in="#{tmp_filename}.rgin"
59
59
  params.concat @document.gs_paper
60
60
  fi=File.open(file_in,'w')
61
61
  fi.puts @document.ps
62
62
  fi.close
63
- when File:
63
+ when File
64
64
  file_in=@document.path
65
65
  #@delete_input=false unless @options[:debug]
66
- when String:
66
+ when String
67
67
  file_in=@document
68
68
  #@delete_input=false unless @options[:debug]
69
69
  end
@@ -103,10 +103,10 @@ class RGhost::Engine
103
103
 
104
104
  def clear_output
105
105
  case @output
106
- when File:
106
+ when File
107
107
  @output.close
108
108
  File.delete(@output.path)
109
- when Array:
109
+ when Array
110
110
  @output.each do |f|
111
111
  f.close
112
112
  File.delete(f.path)
@@ -135,13 +135,13 @@ class RGhost::Engine
135
135
  def format_params(v,pre="-d")
136
136
  r=[]
137
137
  case v
138
- when Symbol:
138
+ when Symbol
139
139
  r << "#{pre}#{v}"
140
- when Array:
140
+ when Array
141
141
  v.each do |av|
142
142
  r << format_params(av,pre).to_s
143
143
  end
144
- when Hash:
144
+ when Hash
145
145
  v.each do |k,v|
146
146
  r << "#{pre}#{k}=#{v.to_s.gsub(/ /,'')}"
147
147
  end
@@ -38,10 +38,14 @@ module RGhost::RubyToPs
38
38
  ps_arr=[]
39
39
  arr.each do |a|
40
40
  ps_arr << case a
41
- when TrueClass,FalseClass: to_bool(a)
42
- when Numeric: a
43
- when Proc: a.to_s
44
- when Array: to_array(a)
41
+ when TrueClass,FalseClass
42
+ to_bool(a)
43
+ when Numeric
44
+ a
45
+ when Proc
46
+ a.to_s
47
+ when Array
48
+ to_array(a)
45
49
  else
46
50
  to_string(a.to_s)
47
51
  end
@@ -66,7 +70,8 @@ module RGhost::RubyToPs
66
70
  tudo=""
67
71
  s.each do |v|
68
72
  case v
69
- when /^%/: tudo << "#{v.gsub(/%/,'')} to_s show "
73
+ when /^%/
74
+ tudo << "#{v.gsub(/%/,'')} to_s show "
70
75
  else
71
76
  tudo << "(#{ps_escape(v)}) show "
72
77
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rghost
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.6.3
4
+ version: 0.8.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shairon Toledo
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-01-14 00:00:00 -05:00
12
+ date: 2009-04-14 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies: []
15
15