Module: I18n::Backend::InterpolationCompiler::Compiler
- Extended by:
- Compiler
- Included in:
- Compiler
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/i18n-1.12.0/lib/i18n/backend/interpolation_compiler.rb
Constant Summary collapse
- TOKENIZER =
/(%%\{[^\}]+\}|%\{[^\}]+\})/
- INTERPOLATION_SYNTAX_PATTERN =
/(%)?(%\{([^\}]+)\})/
Instance Method Summary collapse
Instance Method Details
#compile_if_an_interpolation(string) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/i18n-1.12.0/lib/i18n/backend/interpolation_compiler.rb', line 27 def compile_if_an_interpolation(string) if interpolated_str?(string) string.instance_eval <<-RUBY_EVAL, __FILE__, __LINE__ def i18n_interpolate(v = {}) "#{compiled_interpolation_body(string)}" end RUBY_EVAL end string end |
#interpolated_str?(str) ⇒ Boolean
39 40 41 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/i18n-1.12.0/lib/i18n/backend/interpolation_compiler.rb', line 39 def interpolated_str?(str) str.kind_of?(::String) && str =~ INTERPOLATION_SYNTAX_PATTERN end |