PoParser 1.0.2 → 1.0.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9b3b3b754a563da373fb40d8e901d4a4124eb0b2
4
- data.tar.gz: 7eec9bfd122d8c8b8fcb00978b098a1d06d3c21f
3
+ metadata.gz: 8036d5aecfd813ef156edec1a8595a2351757e62
4
+ data.tar.gz: c5ae7091bcd9688b6222ef1b0f184092bd47fbd3
5
5
  SHA512:
6
- metadata.gz: 20e9febb7b8c5318e571fd38c21763514ed1ad3d04876991c2f7953af0d25c315e576c3fc62e63b444bcb50c6af4c873217803dcb6ee432f21d0a602c18add67
7
- data.tar.gz: a6bf0c4b73d1dfa215981ee77227e95d1786370e9c20996b13c4bd0602383575d9edf19f2ed89c837715e8f8a2ded95c326542c6d702c362492cb37b7a5ef218
6
+ metadata.gz: 57d9bc1dce5ff0212d027de02621ab56a6e1f4e32a8ccec4df69d3e053457d571029098e820cb0117e7d9fc524deb9e8a0db106ceaea16a2a2b335f267ca7f22
7
+ data.tar.gz: efcd02494737acea74a7a773d4cd551daec9ce83d5bb672e8f72e6cf08a04d095486f95460b2d88f40d6050a611f138f5300729a8fe68c3d08038186486f84db
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## Version 1.0.3
2
+ * Add `obsolete` alias for `cached` entries. Now you can use `Po#obsolete` or `Entry#obsolete?`
3
+
1
4
  ## Version 1.0.2
2
5
  * Update dependencies
3
6
  * Handle empty lines in .po file (thanks to @roland9)
data/README.md CHANGED
@@ -38,9 +38,8 @@ The `parse` method returns a `PO` object which contains all `Entries`:
38
38
  # get all entries
39
39
  po.entries # or .all alias
40
40
 
41
- # including cached entries (started with "#~", these
42
- # entries are just kept by program for later use and are
43
- # not counted as active entries)
41
+ # including cached/obsolete entries (started with "#~")
42
+ # more info: https://www.gnu.org/software/gettext/manual/html_node/Obsolete-Entries.html
44
43
  po.entries(true)
45
44
 
46
45
  # get all fuzzy entries
@@ -52,6 +51,9 @@ po.untranslated
52
51
  # get all translated entries
53
52
  po.translated
54
53
 
54
+ # get all cached/obsolete entries
55
+ po.cached # or .obsolete alias
56
+
55
57
  # returns a hash representation of the PO file
56
58
  po.to_h
57
59
 
@@ -124,6 +126,8 @@ entry.fuzzy?
124
126
  #=> true
125
127
  entry.plural?
126
128
  #=> false
129
+ entry.cached? # or .obsolete?
130
+ #=> false
127
131
  ```
128
132
 
129
133
  You can get or edit each property of the `Entry`:
@@ -27,6 +27,7 @@ module PoParser
27
27
  def cached?
28
28
  !@cached.nil?
29
29
  end
30
+ alias_method :obsolete?, :cached?
30
31
 
31
32
  # Checks if the entry is untraslated
32
33
  #
@@ -71,7 +72,7 @@ module PoParser
71
72
  self
72
73
  end
73
74
 
74
- # Set flag to a custome string
75
+ # Set flag to a custom string
75
76
  def flag_as(flag)
76
77
  raise ArgumentError if flag.class != String
77
78
  @flag = flag
data/lib/poparser/po.rb CHANGED
@@ -78,6 +78,16 @@ module PoParser
78
78
  end
79
79
  end
80
80
 
81
+ # Finds all cached entries
82
+ #
83
+ # @return [Array] an array of cached entries
84
+ def cached
85
+ find_all do |entry|
86
+ entry.cached?
87
+ end
88
+ end
89
+ alias_method :obsolete, :cached
90
+
81
91
  # Count of all entries without counting cached entries
82
92
  #
83
93
  # @return [String]
@@ -1,3 +1,3 @@
1
1
  module PoParser
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.3"
3
3
  end
@@ -99,6 +99,7 @@ describe PoParser::Entry do
99
99
 
100
100
  it 'checks for chached entries' do
101
101
  expect(@entry.cached?).to be_truthy
102
+ expect(@entry.obsolete?).to be_truthy
102
103
  end
103
104
 
104
105
  it 'shouldn be counted as untranslated' do
@@ -39,6 +39,13 @@ describe PoParser::Po do
39
39
  expect(@po.untranslated.size).to eq 2
40
40
  end
41
41
 
42
+ it 'returns all cached strings' do
43
+ entry2, entry3 = entry.dup, entry.dup
44
+ [entry2, entry3].each { |en| en[:cached] = 'test' }
45
+ @po << [entry, entry2, entry3]
46
+ expect(@po.cached.size).to eq 2
47
+ end
48
+
42
49
  it 'shows stats' do
43
50
  entry2, entry3, entry4 = entry.dup, entry.dup, entry.dup
44
51
  [entry2, entry3].each { |en| en[:msgstr] = '' }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: PoParser
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arash Mousavi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-15 00:00:00.000000000 Z
11
+ date: 2016-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parslet
@@ -118,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
118
  version: '0'
119
119
  requirements: []
120
120
  rubyforge_project:
121
- rubygems_version: 2.6.4
121
+ rubygems_version: 2.6.8
122
122
  signing_key:
123
123
  specification_version: 4
124
124
  summary: A PO file parser, editor and generator.
@@ -140,4 +140,3 @@ test_files:
140
140
  - spec/poparser/tokenizer_spec.rb
141
141
  - spec/poparser/transformer_spec.rb
142
142
  - spec/spec_helper.rb
143
- has_rdoc: