Class: TemplateMessage::Message

Inherits:
Object
  • Object
show all
Defined in:
lib/metro/template_message.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#detailsObject (readonly)

Returns the value of attribute details.



12
13
14
# File 'lib/metro/template_message.rb', line 12

def details
  @details
end

#nameObject (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

#actionsObject



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

#messageObject



27
28
29
# File 'lib/metro/template_message.rb', line 27

def message
  field_locale 'message'
end

#titleObject



23
24
25
# File 'lib/metro/template_message.rb', line 23

def title
  field_locale 'title'
end