Class: AxTags::TagLibrary

Inherits:
Object
  • Object
show all
Defined in:
lib/axtags/tag_library.rb

Class Method Summary collapse

Class Method Details

.build_tags {|context| ... } ⇒ Object

Yields:



57
58
59
# File 'lib/axtags/tag_library.rb', line 57

def self.build_tags(&block)
  yield context
end

.contextObject



42
43
44
# File 'lib/axtags/tag_library.rb', line 42

def self.context
  @@context ||= AxContext.new
end

.parse(document, options = {}) ⇒ Object



50
51
52
53
54
55
# File 'lib/axtags/tag_library.rb', line 50

def self.parse(document, options={})
  if locals = options.delete(:locals)
    locals.each {|arg, value| context.globals.send("#{arg}=", value) }
  end
  parser.parse(document)
end

.parserObject



46
47
48
# File 'lib/axtags/tag_library.rb', line 46

def self.parser
  @@parser ||= AxParser.new(context, :tag_prefix=>"ax")
end

.tag(name, options = {}, &block) ⇒ Object



61
62
63
64
65
# File 'lib/axtags/tag_library.rb', line 61

def self.tag(name, options={}, &block)
  build_tags do |c|
    c.define_tag(name, options, &block)
  end
end