Module: Renee::Core::Transform

Included in:
Renee::Core
Defined in:
lib/renee_core/transform.rb

Overview

Module used for transforming arbitrary values using the registerd variable types.

See Also:

  • #register_variable_name.

Instance Method Summary collapse

Instance Method Details

#transform(type, value) ⇒ Object

Transforms a value according to the rules specified by #register_variable_name.

Parameters:

  • name (Symbol)

    The name of the variable type.

  • value (String)

    The value to transform.

Returns:

  • The transformed value or nil.



11
12
13
14
15
# File 'lib/renee_core/transform.rb', line 11

def transform(type, value)
  if self.class.variable_types.key?(type) and m = self.class.variable_types[type][value]
    m.first == value ? m.last : nil
  end
end