class Tml::Tokens::Method
Method
Token Forms
{user.name}
{user.name:gender}
Public Class Methods
expression()
click to toggle source
# File lib/tml/tokens/method.rb, line 43 def self.expression /(%?\{{1,2}\s*[\w]+\.\w*\s*(:\s*\w+)*\s*(::\s*\w+)*\s*\}{1,2})/ end
Public Instance Methods
object_method_name()
click to toggle source
# File lib/tml/tokens/method.rb, line 51 def object_method_name @object_method_name ||= short_name.split(".").last end
object_name()
click to toggle source
# File lib/tml/tokens/method.rb, line 47 def object_name @object_name ||= short_name.split(".").first end
substitute(label, context, language, options = {})
click to toggle source
# File lib/tml/tokens/method.rb, line 55 def substitute(label, context, language, options = {}) object = Tml::Utils.hash_value(context, object_name) return label unless object object_value = sanitize(object.send(object_method_name), object, language, options.merge(:safe => false)) label.gsub(full_name, decorate(object_value, options)) end