Module: I18n::Message::Variants

Defined in:
lib/i18n/message/variants.rb

Overview

Encapsulates the pattern of strings having multiple variations as :short message, :full message etc.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#variantObject (readonly)

Returns the value of attribute variant.



6
7
8
# File 'lib/i18n/message/variants.rb', line 6

def variant
  @variant
end

Instance Method Details

#to_s(variant = nil) ⇒ Object



8
9
10
11
# File 'lib/i18n/message/variants.rb', line 8

def to_s(variant = nil)
  @variant = variant
  resolve(Hash === subject ? subject[variant || :short] : subject)
end