Module: I18n::Message::Base

Included in:
I18n::Message, Format
Defined in:
lib/i18n/message/base.rb

Overview

Encapsulates the patterns of:

* using a plain Message (as in validates_presence_of :email, :message => "can't be blank")
* translating a Symbol (as in validates_presence_of :email, :message => :blank)
* interpolating given values to the resulting string.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#defaultObject (readonly)

Returns the value of attribute default.



11
12
13
# File 'lib/i18n/message/base.rb', line 11

def default
  @default
end

#optionsObject (readonly)

Returns the value of attribute options.



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

def options
  @options
end

#scopeObject (readonly)

Returns the value of attribute scope.



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

def scope
  @scope
end

#subjectObject (readonly)

Returns the value of attribute subject.



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

def subject
  @subject
end

#valuesObject (readonly)

Returns the value of attribute values.



11
12
13
# File 'lib/i18n/message/base.rb', line 11

def values
  @values
end

Instance Method Details

#<=>(other) ⇒ Object



22
23
24
# File 'lib/i18n/message/base.rb', line 22

def <=>(other)
  to_s <=> other
end

#initialize(subject = nil, options = {}) ⇒ Object



13
14
15
16
# File 'lib/i18n/message/base.rb', line 13

def initialize(subject = nil, options = {})
  @subject, @options = subject, options
  @options ||= {}
end

#to_s(variant = nil) ⇒ Object



18
19
20
# File 'lib/i18n/message/base.rb', line 18

def to_s(variant = nil)
  resolve(subject)
end