Class: Metamagic::CustomTag

Inherits:
Tag
  • Object
show all
Defined in:
lib/metamagic/tags/custom_tag.rb

Instance Attribute Summary collapse

Attributes inherited from Tag

#context, #key, #value

Instance Method Summary collapse

Methods inherited from Tag

#<=>, #==, #method_missing, #sort_order

Constructor Details

#initialize(context, key, value, render_proc) ⇒ CustomTag

Returns a new instance of CustomTag.



5
6
7
8
# File 'lib/metamagic/tags/custom_tag.rb', line 5

def initialize(context, key, value, render_proc)
  super(context, key, value)
  @render_proc = render_proc
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Metamagic::Tag

Instance Attribute Details

#render_procObject (readonly)

Returns the value of attribute render_proc.



3
4
5
# File 'lib/metamagic/tags/custom_tag.rb', line 3

def render_proc
  @render_proc
end

Instance Method Details

#to_htmlObject



10
11
12
# File 'lib/metamagic/tags/custom_tag.rb', line 10

def to_html
  instance_exec key, value, &render_proc
end