Class: Radius::PacketContext
- Inherits:
-
Context
- Object
- Context
- Radius::PacketContext
- Defined in:
- lib/orange-more/slices/resources/radius.rb
Instance Method Summary collapse
-
#render_tag(name, attributes = {}, packet = false, &block) ⇒ Object
Returns the value of a rendered tag.
-
#stack(name, attributes, packet, block) ⇒ Object
A convienence method for managing the various parts of the tag binding stack.
Instance Method Details
#render_tag(name, attributes = {}, packet = false, &block) ⇒ Object
Returns the value of a rendered tag. Used internally by Parser#parse.
89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/orange-more/slices/resources/radius.rb', line 89 def render_tag(name, attributes = {}, packet = false, &block) if name =~ /^(.+?):(.+)$/ render_tag($1) { render_tag($2, attributes, packet, &block) } else tag_definition_block = @definitions[qualified_tag_name(name.to_s)] if tag_definition_block stack(name, attributes, packet, block) do |tag| tag_definition_block.call(tag).to_s end else tag_missing(name, attributes, &block) end end end |
#stack(name, attributes, packet, block) ⇒ Object
A convienence method for managing the various parts of the tag binding stack.
105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/orange-more/slices/resources/radius.rb', line 105 def stack(name, attributes, packet, block) previous = @tag_binding_stack.last previous_locals = previous.nil? ? @globals : previous.locals locals = DelegatingOpenStruct.new(previous_locals) locals.packet = packet binding = TagBinding.new(self, locals, name, attributes, block) @tag_binding_stack.push(binding) result = yield(binding) @tag_binding_stack.pop result end |