class Excalibur::Decorator

the Decorator class helps content to be derived from application base object and turn them into Excalibur titles and meta tags. It’s main responsibilities are to make local classes configurable and it acts as a connector between the application’s objects and Excalibur.

Attributes

configuration[W]
custom_configuration[RW]

Public Class Methods

configuration() click to toggle source
# File lib/excalibur/decorator.rb, line 25
def configuration
  @configuration ||= ::Excalibur.configuration.dup
end
exc_init(config = configuration) click to toggle source
# File lib/excalibur/decorator.rb, line 16
def exc_init(config = configuration)
  @configuration = config
end
exc_meta_tag(type, name, value = nil) click to toggle source
# File lib/excalibur/decorator.rb, line 44
def exc_meta_tag(type, name, value = nil)
  configuration.set_meta_tag(type, name, value)
end
excalibur_init(*args) click to toggle source
# File lib/excalibur/decorator.rb, line 20
def excalibur_init(*args)
  warn '[DEPRECATION] `excalibur_init` is deprecated.  Please use `exc_init` instead.'
  exc_init(*args)
end
excalibur_set_meta_tag(*args) click to toggle source
# File lib/excalibur/decorator.rb, line 48
def excalibur_set_meta_tag(*args)
  warn '[DEPRECATION] `excalibur_set_meta_tag` is deprecated.  Please use `exc_meta_tag` instead.'
  exc_meta_tag(*args)
end
method_missing(meth, *args) click to toggle source

methods: excalibur_set_title_content, excalibur_set_title_option, excalibur_set_title_combinator, excalibur_set_description_content, excalibur_set_description_option, excalibur_set_description_combinator

Calls superclass method
# File lib/excalibur/decorator.rb, line 33
def method_missing(meth, *args)
  if meth.to_s =~ /^exc_(title|description+)_(content|option|combinator+)$/
    configuration.send($1).send("update_#{$2}", *args)
  elsif meth.to_s =~ /^excalibur_set_(title|description+)_(content|option|combinator+)$/
    warn "[DEPRECATION] `excalibur_set_#{$1}_#{$2}` is deprecated.  Please use `exc_#{$1}_#{$2}` instead."
    send("exc_#{$1}_#{$2}", *args)
  else
    super
  end
end
new(object, options = {}) click to toggle source
Calls superclass method
# File lib/excalibur/decorator.rb, line 54
def initialize(object, options = {})
  configuration.merge!(options.delete(:config)) if options.key?(:config)

  super(object, options)
end

Public Instance Methods

configuration() click to toggle source
# File lib/excalibur/decorator.rb, line 60
def configuration
  @custom_configuration ||= self.class.configuration.dup
end
customize_configuration(config) click to toggle source
# File lib/excalibur/decorator.rb, line 64
def customize_configuration(config)
  configuration.merge!(config)
end
method_missing(meth, *args) click to toggle source

methods: render_title, render_description

Calls superclass method
# File lib/excalibur/decorator.rb, line 69
def method_missing(meth, *args)
  if meth.to_s =~ /^render_(title|description+)$/
    obj = args.first || self
    subject = configuration.send($1)

    subject.to_s(obj) if subject.present?
  else
    super
  end
end