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
-
#default ⇒ Object
readonly
Returns the value of attribute default.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#scope ⇒ Object
readonly
Returns the value of attribute scope.
-
#subject ⇒ Object
readonly
Returns the value of attribute subject.
-
#values ⇒ Object
readonly
Returns the value of attribute values.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #initialize(subject = nil, options = {}) ⇒ Object
- #to_s(variant = nil) ⇒ Object
Instance Attribute Details
#default ⇒ Object (readonly)
Returns the value of attribute default.
11 12 13 |
# File 'lib/i18n/message/base.rb', line 11 def default @default end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
9 10 11 |
# File 'lib/i18n/message/base.rb', line 9 def @options end |
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
9 10 11 |
# File 'lib/i18n/message/base.rb', line 9 def scope @scope end |
#subject ⇒ Object (readonly)
Returns the value of attribute subject.
9 10 11 |
# File 'lib/i18n/message/base.rb', line 9 def subject @subject end |
#values ⇒ Object (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, = {}) @subject, @options = subject, @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 |