calco 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4dff627df1a1920dd84f04840b38bd72f6ad821d
4
- data.tar.gz: 53b3752b2a38c3549832f653572ccc093bb72916
3
+ metadata.gz: a5707d4a21a4635524c7c6f979f289244416e63d
4
+ data.tar.gz: 08b02c592036444641c85f22c323b18eccb4bfcb
5
5
  SHA512:
6
- metadata.gz: 53853ba1e0e3cbf02b859e99189cbc14c8f9dc0d5fdeed55336140630b538390d0d0c01b96d765eabdd6fb01adc1421c044a65ad67d288090219d52de526d670
7
- data.tar.gz: 549d49ceb97b325170072cb6250984f01c80564cf7f675b3bd9de5feacd6a216c68a33adc1e8c5a9245eb8ae71cf46bf8d51b0d4e703607c273f9de33948e209
6
+ metadata.gz: 8aaab8c7481340e72160a003b50c9c5e784f88835b8fb9d46ee7edec95ae187f2eea0f076297e907411cb1d6890b8bdcac0f078dce1982b8e2e37c0cbf5238f1
7
+ data.tar.gz: 16ee8d319c4931296165f878c623b988c41179f67a34a906322d85dab425fab8e4605de3ec2cdd2db32b0b725164e41067b83d54580065c3128d7578fc54e068
data/README.md CHANGED
@@ -288,6 +288,7 @@ The time values are real time values, not strings. The formulas are computed.
288
288
 
289
289
  ## Todo
290
290
 
291
+ 0. Mutliple sheets and cross-sheet references
291
292
  0. office engine
292
293
  * problems with UTF-8
293
294
  0. change styles when generating...
@@ -11,10 +11,10 @@ module Calco
11
11
  # of class objects
12
12
  def self.declare name, arity, type = :any
13
13
 
14
- unless arity == :n or arity.is_a?(Integer)
14
+ unless arity == :n || arity.is_a?(Integer)
15
15
  raise ArgumentError, "Artity must be an integer or :n but was a #{arity.class}"
16
16
  end
17
- unless type.is_a?(Class) or (type.respond_to?(:all?) and type.all?{|t| t.is_a?(Class)})
17
+ unless type.is_a?(Class) || (type.respond_to?(:all?) && type.all?{|t| t.is_a?(Class)})
18
18
  raise ArgumentError, "Type should be a Class or an array of Class objects"
19
19
  end
20
20
 
@@ -25,7 +25,7 @@ module Calco
25
25
 
26
26
  def generate row
27
27
 
28
- if self.reference_type == :absolute and self.absolute_row != row
28
+ if self.reference_type == :absolute && self.absolute_row != row
29
29
  nil
30
30
  else
31
31
  @statement.generate(row)
@@ -31,7 +31,7 @@ module Calco
31
31
 
32
32
  def generate row
33
33
 
34
- return nil if @variable.absolute_row and @variable.absolute_row != row
34
+ return nil if @variable.absolute_row && @variable.absolute_row != row
35
35
 
36
36
  @engine.value(self)
37
37
 
@@ -15,7 +15,7 @@ module Calco
15
15
 
16
16
  def write_row sheet, row_id
17
17
 
18
- row_id += 1 if row_id > 0 and sheet.has_titles?
18
+ row_id += 1 if row_id > 0 && sheet.has_titles?
19
19
 
20
20
  cells = sheet.row(row_id)
21
21
 
@@ -105,9 +105,9 @@ module Calco
105
105
  if ! element.respond_to?(:value)
106
106
  element.inspect
107
107
  elsif element.value.is_a?(Time)
108
- res = element.value.strftime("%H:%M:%S")
108
+ element.value.strftime("%H:%M:%S")
109
109
  elsif element.value.is_a?(Date)
110
- res = element.value.strftime("%Y-%m-%d")
110
+ element.value.strftime("%Y-%m-%d")
111
111
  else
112
112
  element.value.inspect
113
113
  end
@@ -52,7 +52,7 @@ module Calco
52
52
 
53
53
  def write_row sheet, row_id
54
54
 
55
- return if row_id == 0 and sheet.has_titles?
55
+ return if row_id == 0 && sheet.has_titles?
56
56
 
57
57
  row_id += 1 # office sheet indexes start at 1
58
58
 
@@ -75,7 +75,7 @@ module Calco
75
75
  def generate_cell row_number, column, cell_style, column_style, column_type
76
76
 
77
77
  return '<table:table-cell/>' unless column
78
- return '<table:table-cell/>' if column.absolute_row and column.absolute_row != row_number
78
+ return '<table:table-cell/>' if column.absolute_row && column.absolute_row != row_number
79
79
 
80
80
  cell = column.generate(row_number)
81
81
 
@@ -30,7 +30,7 @@ module Calco
30
30
 
31
31
  def write_row sheet, row_id
32
32
 
33
- return if sheet.has_titles? and row_id == 0
33
+ return if sheet.has_titles? && row_id == 0
34
34
 
35
35
  names = column_names(sheet)
36
36
 
@@ -42,7 +42,7 @@ module Calco
42
42
 
43
43
  next unless value
44
44
 
45
- value = value.to_s if value.is_a?(Date) or value.is_a?(Time)
45
+ value = value.to_s if value.is_a?(Date) || value.is_a?(Time)
46
46
 
47
47
  @out_stream.write "%#{longest_name}s = #{value.inspect}\n" % names[i]
48
48
 
@@ -64,7 +64,7 @@ module Calco
64
64
  # id => id associated to the column
65
65
  def column name, options = {}
66
66
 
67
- if name.is_a?(Numeric) or name.is_a?(String)
67
+ if name.is_a?(Numeric) || name.is_a?(String)
68
68
  @columns << Constant.wrap(name)
69
69
  elsif name.is_a?(ValueExtractor)
70
70
  @columns << name
@@ -150,7 +150,7 @@ module Calco
150
150
  return
151
151
  end
152
152
 
153
- if new_content.is_a?(Numeric) or new_content.is_a?(String)
153
+ if new_content.is_a?(Numeric) || new_content.is_a?(String)
154
154
  new_content = Constant.new(new_content)
155
155
  assign_engine new_content, @engine
156
156
  elsif @definitions.variable?(new_content)
@@ -328,7 +328,7 @@ module Calco
328
328
 
329
329
  def assign_engine el, engine
330
330
 
331
- return unless el.is_a?(Calco::Element) or el.is_a?(Calco::Style)
331
+ return unless el.is_a?(Calco::Element) || el.is_a?(Calco::Style)
332
332
 
333
333
  current_engine = el.instance_variable_get(:@engine)
334
334
 
@@ -1,3 +1,3 @@
1
1
  module Calco
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calco
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jean Lazarou
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-07 00:00:00.000000000 Z
11
+ date: 2014-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec