calco 0.1.0 → 0.1.1
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.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/lib/calco/elements/builtin_function.rb +2 -2
- data/lib/calco/elements/formula.rb +1 -1
- data/lib/calco/elements/value_extractor.rb +1 -1
- data/lib/calco/engines/csv_engine.rb +1 -1
- data/lib/calco/engines/default_engine.rb +2 -2
- data/lib/calco/engines/office_engine.rb +2 -2
- data/lib/calco/engines/simple_calculator_engine.rb +2 -2
- data/lib/calco/sheet.rb +3 -3
- data/lib/calco/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a5707d4a21a4635524c7c6f979f289244416e63d
|
4
|
+
data.tar.gz: 08b02c592036444641c85f22c323b18eccb4bfcb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8aaab8c7481340e72160a003b50c9c5e784f88835b8fb9d46ee7edec95ae187f2eea0f076297e907411cb1d6890b8bdcac0f078dce1982b8e2e37c0cbf5238f1
|
7
|
+
data.tar.gz: 16ee8d319c4931296165f878c623b988c41179f67a34a906322d85dab425fab8e4605de3ec2cdd2db32b0b725164e41067b83d54580065c3128d7578fc54e068
|
data/README.md
CHANGED
@@ -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
|
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)
|
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
|
|
@@ -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
|
-
|
108
|
+
element.value.strftime("%H:%M:%S")
|
109
109
|
elsif element.value.is_a?(Date)
|
110
|
-
|
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
|
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
|
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?
|
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)
|
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
|
|
data/lib/calco/sheet.rb
CHANGED
@@ -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)
|
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)
|
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)
|
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
|
|
data/lib/calco/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2014-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|