Module: FlavourSaver

Defined in:
lib/flavour_saver.rb,
lib/flavour_saver/lexer.rb,
lib/flavour_saver/nodes.rb,
lib/flavour_saver/parser.rb,
lib/flavour_saver/helpers.rb,
lib/flavour_saver/partial.rb,
lib/flavour_saver/runtime.rb,
lib/flavour_saver/version.rb,
lib/flavour_saver/template.rb,
lib/flavour_saver/rails_partial.rb

Defined Under Namespace

Modules: Helpers Classes: BlockExpressionNode, BlockExpressionNodeWithElse, BooleanNode, CallNode, CommentNode, Engine, ExpressionNode, FalseNode, Lexer, LiteralCallNode, LocalVarNode, Node, NumberNode, OutputNode, ParentCallNode, Parser, Partial, PartialNode, RailsPartial, Runtime, SafeExpressionNode, StringNode, Template, TemplateItemNode, TemplateNode, TrueNode, ValueNode

Constant Summary collapse

UnknownPartialException =
Class.new(StandardError)
UnknownNodeTypeException =
Class.new(StandardError)
UnknownContextException =
Class.new(StandardError)
InappropriateUseOfElseException =
Class.new(StandardError)
UndefinedPrivateVariableException =
Class.new(StandardError)
UnknownHelperException =
Class.new(RuntimeError)
VERSION =
"2.0.2"

Class Method Summary collapse

Class Method Details

.evaluate(template, context) ⇒ Object



48
49
50
# File 'lib/flavour_saver.rb', line 48

def evaluate(template,context)
  Runtime.run(parse(lex(template)), context)
end

.lex(template) ⇒ Object



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

def lex(template)
  Lexer.lex(template)
end

.loggerObject



68
69
70
# File 'lib/flavour_saver.rb', line 68

def logger
  @logger || @default_logger.call
end

.logger=(logger) ⇒ Object



72
73
74
# File 'lib/flavour_saver.rb', line 72

def logger=(logger)
  @logger=logger
end

.parse(tokens) ⇒ Object



44
45
46
# File 'lib/flavour_saver.rb', line 44

def parse(tokens)
  Parser.parse(tokens)
end

.register_helper(*args, &b) ⇒ Object



52
53
54
# File 'lib/flavour_saver.rb', line 52

def register_helper(*args,&b)
  Helpers.register_helper(*args,&b)
end

.register_partial(name, content = nil, &block) ⇒ Object



60
61
62
# File 'lib/flavour_saver.rb', line 60

def register_partial(name,content=nil,&block)
  Partial.register_partial(name,content,&block)
end

.reset_helpersObject



56
57
58
# File 'lib/flavour_saver.rb', line 56

def reset_helpers
  Helpers.reset_helpers
end

.reset_partialsObject



64
65
66
# File 'lib/flavour_saver.rb', line 64

def reset_partials
  Partial.reset_partials
end