Module: Rich::I18n::Core::Array::Merging

Included in:
Array
Defined in:
lib/rich/i18n/core/array/merging.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



8
9
10
11
12
# File 'lib/rich/i18n/core/array/merging.rb', line 8

def self.included(base)
  base.class_eval do
    alias_method_chain :join, :rich_i18n
  end
end

Instance Method Details

#join_with_rich_i18n(sep = $,) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/rich/i18n/core/array/merging.rb', line 14

def join_with_rich_i18n(sep = $,)
  if size == 1 && first.enriched?
    first
  else
    result = join_without_rich_i18n(sep)
    any?(&:enriched?) ? EnrichedString.new(result, nil, dup) : result
  end
end