puttext 0.2.0 → 0.2.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: 17a3eeac3b04d7960efb45c4bb8612d6d27e7dd0
4
- data.tar.gz: c7f567b35813bbda434db72d9d78d808c0cdcc92
3
+ metadata.gz: 30ea19d0b5142d39af84debf1a5554e54cd7b28e
4
+ data.tar.gz: 7e5b71ded6723ffc5a5eab512b871baedb1fe9ce
5
5
  SHA512:
6
- metadata.gz: c3aee3dda5612c226367c922913b1250f6693f62a372d2c7c9a9e7b5d362888c3d647a578fd5b72858831d7b57373b8d8437323eed0f3da374713b60cd185f82
7
- data.tar.gz: baf6b7a5508f58c0adac8ecb8fb64d55c80eba49879bbd224192e1a885bf7e58599259e127b1ff24cbd9d2f053ebad709e7fd3f809f13d0a518d34c5853e80e0
6
+ metadata.gz: c31494729c4e056cdd9eb79f983a232e99f0840ea0786bac4cab16f60b5322ad66d8af1f17e06a00e49c10f2076e4ef9c17f9e396480c8aa6a31dd84558aac3c
7
+ data.tar.gz: 8d30e26ee2bbbf93ea71260094f23859459fbb6f99723dc0d185111c3fe8a50ecbe7f177425e1028cfd9a0764f5b1a6aa2532cfee4c4ee027ba99070e2cfba10
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- puttext (0.2.0)
4
+ puttext (0.2.1)
5
5
  parser (>= 2.4.0.0, < 3.0)
6
6
  unindent
7
7
 
@@ -67,4 +67,4 @@ DEPENDENCIES
67
67
  timecop
68
68
 
69
69
  BUNDLED WITH
70
- 1.14.6
70
+ 1.15.1
@@ -12,14 +12,11 @@ module PutText
12
12
  # be placed in this file.
13
13
  def initialize(entries)
14
14
  @entries = entries
15
-
16
- now = Time.now.strftime('%Y-%m-%d %H:%M%z')
17
-
18
15
  @header_entry = POEntry.new(
19
16
  flags: ['fuzzy'],
20
17
  msgid: '',
21
18
  msgstr: <<-STRING.unindent
22
- POT-Creation-Date: #{now}
19
+ POT-Creation-Date: #{Time.now.strftime('%Y-%m-%d %H:%M%z')}
23
20
  MIME-Version: 1.0
24
21
  Content-Type: text/plain; charset=UTF-8
25
22
  STRING
@@ -45,6 +42,16 @@ module PutText
45
42
  end
46
43
  end
47
44
 
45
+ # Merge the contents of another POFile to this POFile.
46
+ # @param [POFile] other_file the file to merge the contents of to this file.
47
+ def merge(other_file)
48
+ unless other_file.is_a?(POFile)
49
+ raise ArgumentError, 'argument must be a PutText::POFile'
50
+ end
51
+
52
+ @entries += other_file.entries
53
+ end
54
+
48
55
  def ==(other)
49
56
  @entries.sort == other.entries.sort
50
57
  end
@@ -4,7 +4,7 @@ require 'date'
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = 'puttext'
7
- s.version = '0.2.0'
7
+ s.version = '0.2.1'
8
8
  s.date = Date.today.to_s
9
9
  s.summary = 'Extract gettext strings from Ruby source'
10
10
  s.authors = ['Mantas Norvaiša']
@@ -65,4 +65,25 @@ describe PutText::POFile do
65
65
  PO
66
66
  end
67
67
  end
68
+
69
+ describe '#merge' do
70
+ let(:entry_1) { PutText::POEntry.new(msgid: 'One error occurred') }
71
+ let(:entry_2) { PutText::POEntry.new(msgid: 'Another error occurred') }
72
+ let(:file_1) { described_class.new([entry_1]) }
73
+ let(:file_2) { described_class.new([entry_2]) }
74
+
75
+ context 'POFile is passed as an argument' do
76
+ before { file_1.merge(file_2) }
77
+
78
+ it 'merges the contents of two POFiles' do
79
+ expect(file_1.entries).to contain_exactly(entry_1, entry_2)
80
+ end
81
+ end
82
+
83
+ context 'an object that is not a POFile is passed as an argument' do
84
+ it 'raises an ArgumentError' do
85
+ expect { file_1.merge('string') }.to raise_error(ArgumentError)
86
+ end
87
+ end
88
+ end
68
89
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puttext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mantas Norvaiša
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-04 00:00:00.000000000 Z
11
+ date: 2017-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser