Class: TemplateMessage::Message
- Inherits:
-
Object
- Object
- TemplateMessage::Message
- Defined in:
- lib/metro/template_message.rb
Instance Attribute Summary collapse
-
#details ⇒ Object
readonly
Returns the value of attribute details.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #actions ⇒ Object
- #field_locale(field) ⇒ Object
-
#initialize(name, details) ⇒ Message
constructor
A new instance of Message.
- #message ⇒ Object
- #title ⇒ Object
Constructor Details
#initialize(name, details) ⇒ Message
Returns a new instance of Message.
14 15 16 17 |
# File 'lib/metro/template_message.rb', line 14 def initialize(name,details) @name = name @details = details end |
Instance Attribute Details
#details ⇒ Object (readonly)
Returns the value of attribute details.
12 13 14 |
# File 'lib/metro/template_message.rb', line 12 def details @details end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
12 13 14 |
# File 'lib/metro/template_message.rb', line 12 def name @name end |
Instance Method Details
#actions ⇒ Object
31 32 33 |
# File 'lib/metro/template_message.rb', line 31 def actions Array( field_locale('actions') ).map {|action| "* #{action}" }.join("\n") end |
#field_locale(field) ⇒ Object
19 20 21 |
# File 'lib/metro/template_message.rb', line 19 def field_locale(field) I18n.t("#{name}.#{field}",details) end |
#message ⇒ Object
27 28 29 |
# File 'lib/metro/template_message.rb', line 27 def field_locale 'message' end |
#title ⇒ Object
23 24 25 |
# File 'lib/metro/template_message.rb', line 23 def title field_locale 'title' end |