Module: Comatose

Defined in:
lib/comatose/page_wrapper.rb,
lib/comatose.rb,
lib/comatose/drop.rb,
lib/comatose/engine.rb,
lib/comatose/logger.rb,
lib/comatose/routes.rb,
lib/comatose/version.rb,
app/models/comatose/page.rb,
lib/comatose/text_filters.rb,
lib/comatose/configuration.rb,
lib/comatose/locale_constraint.rb,
lib/comatose/processing_context.rb,
app/helpers/comatose/base_helper.rb,
app/controllers/comatose/base_controller.rb,
app/controllers/comatose/admin_controller.rb,
lib/generators/comatose/comatose_generator.rb,
app/controllers/comatose/application_controller.rb

Overview

This is the rendering context object you have access to in text processing…

Defined Under Namespace

Modules: AdminHelper, ApplicationHelper, BaseHelper, Generators, Routes Classes: AdminController, ApplicationController, BaseController, Configuration, ConfigurationError, Drop, Engine, Logger, Page, PageWrapper, ProcessingContext, TextFilters

Constant Summary collapse

VERSION =
"3.0.5"
VERSION_STRING =
"#{VERSION}  (beta)"

Class Method Summary collapse

Class Method Details

.add_mount_point(path, info = {:index=>''}) ⇒ Object

Adds a ‘mount’ point to the list of known roots…



20
21
22
23
24
# File 'lib/comatose/configuration.rb', line 20

def self.add_mount_point(path, info={:index=>''})
  path = "/#{path}" unless path.starts_with? '/'
  info[:root]=path
  mount_points << info
end

.configObject



3
4
5
# File 'lib/comatose/configuration.rb', line 3

def self.config
  @@config ||= Configuration.new
end

.configure {|config| ... } ⇒ Object

Yields:



7
8
9
10
11
12
# File 'lib/comatose/configuration.rb', line 7

def self.configure(&block)
  raise "#configure must be sent a block" unless block_given?
  yield config
  config.validate!
  config.include!
end

.define_drop(name, &block) ⇒ Object

Simple wrapper around the ProcessingContext.define method I think Comatose.define_drop is probably simpler to remember too



35
36
37
# File 'lib/comatose/drop.rb', line 35

def define_drop(name, &block)
  Comatose::Drop.define(name, &block)
end

.gem_rootObject



31
32
33
# File 'lib/comatose.rb', line 31

def gem_root
  gem_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
end

.loggerObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/comatose.rb', line 15

def logger
  comatose_logger = nil
  begin
    comatose_logger = Rails.logger
  rescue
  end

  if comatose_logger.blank?
    comatose_logger = Comatose::Logger.new(File.join(self.root, 'comatose.log'))
    comatose_logger.level = Logger::DEBUG
    comatose_logger.formatter = Logger::Formatter.new
  end
  return comatose_logger
end

.mount_pointsObject

All of the ‘mount’ points for Comatose



15
16
17
# File 'lib/comatose/configuration.rb', line 15

def self.mount_points
  @@mount_points ||= []
end

.register_filter(module_name) ⇒ Object

Registers a ‘filter’ for Liquid use



40
41
42
# File 'lib/comatose/drop.rb', line 40

def register_filter(module_name)
  Liquid::Template.register_filter(module_name)
end

.registered_dropsObject

Returns/initializes a hash for storing ComatoseDrops



29
30
31
# File 'lib/comatose/drop.rb', line 29

def registered_drops
  @registered_drops ||= {}
end

.rootObject



36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/comatose.rb', line 36

def root
  comatose_root = nil
  begin
    comatose_root = Rails.root
  rescue
  end

  if comatose_root.blank?
    comatose_root = Comatose.gem_root
  end
  return comatose_root
end

.versionObject



5
6
7
# File 'lib/comatose/version.rb', line 5

def self.version
  VERSION
end