Class: Mullet::HTML::ScopeAttributeCommand

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

Overview

Operation to set attribute to value resolved from a scope.

Instance Method Summary collapse

Methods included from AttributeCommand

#execute

Constructor Details

#initialize(attribute_name, variable_name) ⇒ ScopeAttributeCommand

Constructor

Parameters:

  • attribute_name (Symbol)

    name of attribute this command sets

  • variable_name (Symbole)

    variable name to lookup to get value



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

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

Instance Method Details

#get_value(render_context) ⇒ Object

Gets attribute value by looking up variable name.

Parameters:

Returns:

  • attribute value



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

def get_value(render_context)
  return render_context.get_variable_value(@variable_name)
end