Class: Mullet::HTML::MessageAttributeCommand

Inherits:
Object
  • Object
show all
Includes:
AttributeCommand
Defined in:
lib/mullet/html/message_attribute_command.rb

Overview

Operation to set attribute value from translation.

Instance Method Summary collapse

Methods included from AttributeCommand

#execute

Constructor Details

#initialize(attribute_name, message) ⇒ MessageAttributeCommand

Constructor

Parameters:

  • attribute_name (Symbol)

    name of attribute this command sets

  • message (Message)

    message to format to get attribute value



15
16
17
18
# File 'lib/mullet/html/message_attribute_command.rb', line 15

def initialize(attribute_name, message)
  super(attribute_name)
  @message = message
end

Instance Method Details

#get_value(render_context) ⇒ Object

Gets attribute value by formatting localized message.

Parameters:

Returns:

  • attribute value



25
26
27
# File 'lib/mullet/html/message_attribute_command.rb', line 25

def get_value(render_context)
  return @message.translate(render_context)
end