i18nliner 0.2.3 → 0.2.5
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
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c65c8bd881edfdc231120af22f283b85770bfa2befdf3495d273848101393062
|
|
4
|
+
data.tar.gz: ce466b775c3e449efc57ba5d6083f59c8c5a0a63243a0301be8515dedca6c9f0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b4e7c18f79f693a815ea3f6b6b84f46be8b56d8e739cdf7c064e0d2632cef23138cfb1e75c344077c44ace0f9c63d4b79cce32f19c8df9a79a28f7a07a71e92d
|
|
7
|
+
data.tar.gz: 8455844299eeca26b8d017e17ccfca90172d597f942b5331069e2b07e409167e425c16ceb8d59511066b5035c96bdee587f1c2fa0abe6793987fc4d40a4cc3be
|
|
@@ -84,6 +84,9 @@ module I18nliner
|
|
|
84
84
|
end
|
|
85
85
|
|
|
86
86
|
def evaluate_expression(exp)
|
|
87
|
+
# value omissions in hashes will be nil and can just be considered UnsupportedExpression
|
|
88
|
+
# since they are equivalent to a method call
|
|
89
|
+
return UnsupportedExpression if exp.nil?
|
|
87
90
|
return raw(exp) if exp.sexp_type == :lit
|
|
88
91
|
return string_from(exp) if stringish?(exp)
|
|
89
92
|
return hash_from(exp) if exp.sexp_type == :hash
|
|
@@ -2,8 +2,6 @@ require 'i18nliner/errors'
|
|
|
2
2
|
require 'i18nliner/call_helpers'
|
|
3
3
|
require 'i18nliner/extractors/sexp_helper'
|
|
4
4
|
require 'nokogiri'
|
|
5
|
-
require 'ruby_parser'
|
|
6
|
-
require 'ruby2ruby'
|
|
7
5
|
|
|
8
6
|
module I18nliner
|
|
9
7
|
module PreProcessors
|
|
@@ -37,8 +35,14 @@ module I18nliner
|
|
|
37
35
|
DEFINITIONS = [
|
|
38
36
|
{:method => :link_to, :pattern => /link_to/, :arg => 0}
|
|
39
37
|
]
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
|
|
39
|
+
def self.parser
|
|
40
|
+
@parser ||= (require 'ruby_parser'; RubyParser.new)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def self.ruby2ruby
|
|
44
|
+
@ruby2ruby ||= (require 'ruby2ruby'; Ruby2Ruby.new)
|
|
45
|
+
end
|
|
42
46
|
|
|
43
47
|
def self.match_for(string)
|
|
44
48
|
DEFINITIONS.each do |info|
|
|
@@ -60,7 +64,7 @@ module I18nliner
|
|
|
60
64
|
def wrappable?
|
|
61
65
|
return @wrappable if !@wrappable.nil?
|
|
62
66
|
begin
|
|
63
|
-
sexps =
|
|
67
|
+
sexps = self.class.parser.parse(@source)
|
|
64
68
|
@wrappable = sexps.sexp_type == :call &&
|
|
65
69
|
sexps[1].nil? &&
|
|
66
70
|
sexps[2] == @method &&
|
|
@@ -75,10 +79,10 @@ module I18nliner
|
|
|
75
79
|
if stringish?(sexp)
|
|
76
80
|
@content = string_from(sexp)
|
|
77
81
|
else
|
|
78
|
-
@placeholder =
|
|
82
|
+
@placeholder = self.class.ruby2ruby.process(sexp)
|
|
79
83
|
end
|
|
80
84
|
sexps[@arg + SEXP_ARG_OFFSET] = Sexp.new(:str, "\\1")
|
|
81
|
-
@wrapper =
|
|
85
|
+
@wrapper = self.class.ruby2ruby.process(sexps)
|
|
82
86
|
end
|
|
83
87
|
end
|
|
84
88
|
|
|
@@ -49,6 +49,10 @@ describe I18nliner::Extractors::RubyExtractor do
|
|
|
49
49
|
{'foo' => "Foo"})
|
|
50
50
|
end
|
|
51
51
|
|
|
52
|
+
it "should handle omitted values in hashes" do
|
|
53
|
+
expect { extract("t('foo %{count}', count:)") }.not_to raise_error
|
|
54
|
+
end
|
|
55
|
+
|
|
52
56
|
it "should bail on invalid t calls" do
|
|
53
57
|
assert_error "t foo", I18nliner::InvalidSignatureError
|
|
54
58
|
assert_error "t :foo, foo", I18nliner::InvalidSignatureError
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: i18nliner
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jon Jensen
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: activesupport
|
|
@@ -224,7 +223,6 @@ files:
|
|
|
224
223
|
homepage: http://github.com/jenseng/i18nliner
|
|
225
224
|
licenses: []
|
|
226
225
|
metadata: {}
|
|
227
|
-
post_install_message:
|
|
228
226
|
rdoc_options: []
|
|
229
227
|
require_paths:
|
|
230
228
|
- lib
|
|
@@ -239,8 +237,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
239
237
|
- !ruby/object:Gem::Version
|
|
240
238
|
version: 1.3.5
|
|
241
239
|
requirements: []
|
|
242
|
-
rubygems_version: 3.
|
|
243
|
-
signing_key:
|
|
240
|
+
rubygems_version: 3.6.9
|
|
244
241
|
specification_version: 4
|
|
245
242
|
summary: I18n made simple
|
|
246
243
|
test_files: []
|