Module: Arrow::Template::ConditionalDirective

Included in:
ElsifDirective, IfDirective, UnlessDirective
Defined in:
lib/arrow/template/nodes.rb

Overview

Mixin which adds the notion of boolean evaluability to a directive.

Constant Summary collapse

SVNRev =

SVN Revision

%q$Rev$
SVNId =

SVN Id

%q$Id$

Instance Method Summary collapse

Instance Method Details

#evaluate(template, scope) ⇒ Object

Returns true if this Directive, in the context of the given template (an Arrow::Template) and scope (a Binding object), should be considered “true”.



722
723
724
725
726
727
728
# File 'lib/arrow/template/nodes.rb', line 722

def evaluate( template, scope )
  rval = self.call_methodchain( template, scope )

  #self.log.debug "Methodchain evaluated to %s: %p" %
  #  [ rval ? "true" : "false", rval ]
  return rval ? true : false
end

#is_rendering_node?Boolean

Returns true for nodes which generate output themselves (as opposed to ones which generate output through subnodes). This is used for eliding blank lines from the node tree.



714
715
716
# File 'lib/arrow/template/nodes.rb', line 714

def is_rendering_node?
  false
end