Sha256: 3e4b68ced2d0421984b7ba5675a6a36d0f99134baed74f460b5128823bc35eb9

Contents?: true

Size: 515 Bytes

Versions: 3

Compression:

Stored size: 515 Bytes

Contents

# coding: utf-8
module I18n
  module Tasks
    class Key
      module MatchPattern
        def key_match_pattern
          @key_match_pattern ||= begin
            k = key
            "#{k.gsub(/\#{.*?}/, '*')}#{'*' if k.end_with?('.')}"
          end
        end

        # A key interpolated with expression
        def expr?
          if @is_expr.nil?
            k        = key
            @is_expr = (k =~ /\#{.*?}/ || k.end_with?('.'))
          end
          @is_expr
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
i18n-tasks-0.4.5 lib/i18n/tasks/key/match_pattern.rb
i18n-tasks-0.4.4 lib/i18n/tasks/key/match_pattern.rb
i18n-tasks-0.4.3 lib/i18n/tasks/key/match_pattern.rb