Module: Evil::Plugin::Tag

Included in:
BlockTag, SingletonTag
Defined in:
lib/evil/plugin/tag.rb

Constant Summary collapse

Syntax =
/((#{Liquid::TagAttributes}\s?,?\s?)*)/

Class Method Summary collapse

Class Method Details

.evaluate(options, context) ⇒ Object



20
21
22
23
24
25
# File 'lib/evil/plugin/tag.rb', line 20

def self.evaluate(options, context)
  options.inject({}) do |evaluated, pair| 
    opt, value = pair
    evaluated[opt] = context[value]; evaluated
  end
end

.included(base) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/evil/plugin/tag.rb', line 6

def self.included(base)
  base.instance_eval do
    def from(&block)
      tag = Class.new(self)
      
      class << tag
        attr_accessor :tag_proc
      end
      
      tag.tag_proc = block; tag
    end
  end
end