module Excalibur
the Excalibur
gem helps you to decorate a rails app with proper title and meta tags for every page. It does this by providing default configuration options, object based decorators for customization per object type and helpers to put in on the page.
setting version number for the Excalibur
gem
Constants
- VERSION
Attributes
configuration[W]
Public Class Methods
configuration()
click to toggle source
# File lib/excalibur.rb, line 17 def configuration @configuration ||= new_default_configuration end
configure() { |configuration| ... }
click to toggle source
# File lib/excalibur.rb, line 34 def configure yield(configuration) end
new_default_configuration()
click to toggle source
defines the gem default
# File lib/excalibur.rb, line 26 def new_default_configuration Configuration.new( new_default_title, new_default_description, new_default_meta_tags ) end
reset()
click to toggle source
# File lib/excalibur.rb, line 21 def reset @configuration = new_default_configuration end
Private Class Methods
new_default_description()
click to toggle source
# File lib/excalibur.rb, line 60 def new_default_description TruncateableContent.new( { body: 'Excalibur; a worthy title for a gem about titles.' }, { length: 155, omission: '...', separator: ' ' }, proc do |obj| if obj.present? d = obj.configuration.description length = d.options[:length] length -= d.get_content(:prefix, obj).length length -= d.get_content(:suffix, obj).length res = d.get_content(:prefix, obj) res += d.get_content(:body, obj).truncate(length, d.options) res + d.get_content(:suffix, obj) end end ) end
new_default_title()
click to toggle source
# File lib/excalibur.rb, line 40 def new_default_title TruncateableContent.new( { body: 'Excalibur' }, { length: 69, omission: '...', separator: '' }, proc do |obj| if obj.present? t = obj.configuration.title length = t.options[:length] length -= t.get_content(:prefix, obj).length length -= t.get_content(:suffix, obj).length res = t.get_content(:prefix, obj) res += t.get_content(:body, obj).truncate(length, t.options) res + t.get_content(:suffix, obj) end end ) end