class Tml::Decorators::Base

Public Class Methods

decorator(options = {}) click to toggle source
# File lib/tml/decorators/base.rb, line 35
def self.decorator(options = {})
  decorator_klass = Tml.config.decorator_class
  if options[:decorator]
    decorator_klass = "Tml::Decorators::#{options[:decorator].camelcase}".constantize
  end
  decorator_klass.new
end

Public Instance Methods

decorate(translated_label, translation_language, target_language, translation_key, options = {}) click to toggle source
# File lib/tml/decorators/base.rb, line 43
def decorate(translated_label, translation_language, target_language, translation_key, options = {})
  translated_label
end
decorate_element(token, value, options = {}) click to toggle source
# File lib/tml/decorators/base.rb, line 55
def decorate_element(token, value, options = {})
  value
end
decorate_language_case(language_case, rule, original, transformed, options = {}) click to toggle source
# File lib/tml/decorators/base.rb, line 47
def decorate_language_case(language_case, rule, original, transformed, options = {})
  transformed
end
decorate_token(token, value, options = {}) click to toggle source
# File lib/tml/decorators/base.rb, line 51
def decorate_token(token, value, options = {})
  value
end
decoration_element(default, options) click to toggle source
# File lib/tml/decorators/base.rb, line 68
def decoration_element(default, options)
  return 'span' if options[:use_span]
  return 'div' if options[:use_div]
  default
end
enabled?(options) click to toggle source
# File lib/tml/decorators/base.rb, line 63
def enabled?(options)
  return false if options[:skip_decorations]
  inline_mode?
end
inline_mode?() click to toggle source
# File lib/tml/decorators/base.rb, line 59
def inline_mode?
  Tml.session.current_translator and Tml.session.current_translator.inline?
end