efo_nelfo 0.0.4 → 0.0.5

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: 6b620fd9d75306ced61c3f6148388f8374b72571
4
- data.tar.gz: 71f2bc405a4d973c56fe69c802e18863889ec9e0
3
+ metadata.gz: 26b8e9f4719970e00eef63fac39f609584966b05
4
+ data.tar.gz: daa8bd69f71f561c9afd61258a12a11c527cee57
5
5
  SHA512:
6
- metadata.gz: df7f92694016d934b40b32ba5ae9789b14a403026f4a9fa0ea100c873ea6eedf5bbed937901fd5417cbb2362e9a8afa000aa83cee78651b79a5a68f2d8f32ee9
7
- data.tar.gz: ce15e9bd79b5ef9de7165241eec3ab69e23da57241f74f077ae05bd40fd29515925755a7b6a0f465082b9cfb3b2cdb33e34724ac88c49f97ab8da4dda6e0cf03
6
+ metadata.gz: 5aa301f7e5b3b633ac34ca8cdd9afb3753415bcc340606c7afb3929421ee28ed73a08a804baaa78e1d572b99fac28ae5231a0bfb147be5ad5f85e5bf5e3a57fc
7
+ data.tar.gz: 3eb540f61970da6e5d28a5ba66eb7264dc21acdc46d49f77c8ba66aa421c0f01d7e3594ebcc3eaab44d972d734a545758e8b68e92cb81aae222591e4c8b20f48
@@ -45,16 +45,20 @@ module EfoNelfo
45
45
  end
46
46
 
47
47
  def formatted_for_csv(attr)
48
- value = send(attr)
49
-
50
- type = properties[attr][:type]
51
- case type
52
- when :date
53
- value ? value.strftime("%Y%m%d") : nil
54
- when :boolean
55
- value == true ? "J" : nil
48
+ if respond_to?("format_#{attr}")
49
+ value = send "format_#{attr}"
56
50
  else
57
- value
51
+ value = send attr
52
+
53
+ type = properties[attr][:type]
54
+ case type
55
+ when :date
56
+ value ? value.strftime("%Y%m%d") : nil
57
+ when :boolean
58
+ value == true ? "J" : nil
59
+ else
60
+ value
61
+ end
58
62
  end
59
63
  end
60
64
 
@@ -39,6 +39,10 @@ module EfoNelfo
39
39
  end
40
40
  end
41
41
 
42
+ def format_item_count
43
+ item_count ? item_count * 100 : nil
44
+ end
45
+
42
46
  end
43
47
 
44
48
  end
@@ -1,3 +1,3 @@
1
1
  module EfoNelfo
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -21,7 +21,7 @@ describe EfoNelfo::V40::Order do
21
21
 
22
22
  describe "to_csv" do
23
23
  before do
24
- order.add EfoNelfo::V40::Order::Line.new(order_number: 'foo', item_name: 'Ware')
24
+ order.add EfoNelfo::V40::Order::Line.new(order_number: 'foo', item_name: 'Ware', item_count: 6, splitable: true)
25
25
  order.add EfoNelfo::V40::Order::Text.new text: 'haha'
26
26
  end
27
27
 
@@ -29,6 +29,8 @@ describe EfoNelfo::V40::Order do
29
29
  csv.must_match /;EFONELFO;/
30
30
  csv.must_match /;4.0;/
31
31
  csv.must_match /;123;/
32
+ csv.must_match /;600;/
33
+ csv.must_match /;J;/
32
34
  end
33
35
 
34
36
  it "can be parsed" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: efo_nelfo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gudleik Rasch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-02-27 00:00:00.000000000 Z
11
+ date: 2013-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -112,7 +112,6 @@ files:
112
112
  - lib/efo_nelfo/array.rb
113
113
  - lib/efo_nelfo/attribute_assignment.rb
114
114
  - lib/efo_nelfo/errors.rb
115
- - lib/efo_nelfo/foo.rb
116
115
  - lib/efo_nelfo/post_type.rb
117
116
  - lib/efo_nelfo/property.rb
118
117
  - lib/efo_nelfo/reader/csv.rb
data/lib/efo_nelfo/foo.rb DELETED
@@ -1,26 +0,0 @@
1
- class Order
2
- def initialize
3
- @lines = [ ['c', 'd'] ]
4
- @attrs = [ 'a', 'b' ]
5
- end
6
-
7
- def to_a
8
- # [ @attrs ] << lines
9
- arr = [ @attrs ]
10
- lines.each do |i|
11
- arr += i
12
- end
13
- arr
14
- end
15
-
16
- def lines
17
- @lines
18
- end
19
-
20
- def to_csv
21
- to_a
22
- end
23
- end
24
-
25
-
26
- puts Order.new.to_csv.inspect