The class which defines the behaviour of the ‘selectlist’ template directive.
(Not documented)
This directive doesn‘t allow formatting.
# File /Users/ged/source/ruby/Arrow/lib/arrow/template/selectlist.rb, line 47 47: def self::allows_format? 48: false 49: end
Create a new Arrow::Template::SelectListDirective object.
# File /Users/ged/source/ruby/Arrow/lib/arrow/template/selectlist.rb, line 53 53: def initialize( body, parser, state ) 54: @select_name = nil 55: super 56: end
Parse the contents of the directive
# File /Users/ged/source/ruby/Arrow/lib/arrow/template/selectlist.rb, line 72 72: def parse_directive_contents( parser, state ) 73: state.scanner.skip( WHITESPACE ) 74: 75: if state.scanner.scan( NAMEDLIST ) 76: @select_name = state.scanner[1] 77: end 78: 79: super 80: 81: return true 82: end
Render the directive‘s bracketed nodes once for each item in the iterated content.
# File /Users/ged/source/ruby/Arrow/lib/arrow/template/selectlist.rb, line 87 87: def render_subnodes( attribute, template, scope ) 88: res = [] 89: 90: res << %{<select name="%s">\n} % [ self.select_name || self.name ] 91: attribute.each do |attrib| 92: res << %{ <option value="%s">%s</option>\n} % [ attrib, attrib ] 93: end 94: res << %{</select>\n} 95: 96: return *res 97: end
--- SEC00168
--- ""
--- - name: select_name rw: R a_desc: ""
--- - methods: - visibility: public aref: M000179 name: allows_format? sourcecode: " <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/template/selectlist.rb, line 47</span>\n\ 47: <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-keyword kw\">self</span><span class=\"ruby-operator\">::</span><span class=\"ruby-identifier\">allows_format?</span>\n\ 48: <span class=\"ruby-keyword kw\">false</span>\n\ 49: <span class=\"ruby-keyword kw\">end</span>" m_desc: |- <p> This directive doesn‘t allow formatting. </p> params: () - visibility: public aref: M000180 name: new sourcecode: " <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/template/selectlist.rb, line 53</span>\n\ 53: <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">initialize</span>( <span class=\"ruby-identifier\">body</span>, <span class=\"ruby-identifier\">parser</span>, <span class=\"ruby-identifier\">state</span> )\n\ 54: <span class=\"ruby-ivar\">@select_name</span> = <span class=\"ruby-keyword kw\">nil</span>\n\ 55: <span class=\"ruby-keyword kw\">super</span>\n\ 56: <span class=\"ruby-keyword kw\">end</span>" m_desc: |- <p> Create a <a href="SelectListDirective.html#M000180">new</a> <a href="SelectListDirective.html">Arrow::Template::SelectListDirective</a> object. </p> params: ( body, parser, state ) category: Class type: Public - methods: - visibility: protected aref: M000181 name: parse_directive_contents sourcecode: " <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/template/selectlist.rb, line 72</span>\n\ 72: <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">parse_directive_contents</span>( <span class=\"ruby-identifier\">parser</span>, <span class=\"ruby-identifier\">state</span> )\n\ 73: <span class=\"ruby-identifier\">state</span>.<span class=\"ruby-identifier\">scanner</span>.<span class=\"ruby-identifier\">skip</span>( <span class=\"ruby-constant\">WHITESPACE</span> )\n\ 74: \n\ 75: <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-identifier\">state</span>.<span class=\"ruby-identifier\">scanner</span>.<span class=\"ruby-identifier\">scan</span>( <span class=\"ruby-constant\">NAMEDLIST</span> )\n\ 76: <span class=\"ruby-ivar\">@select_name</span> = <span class=\"ruby-identifier\">state</span>.<span class=\"ruby-identifier\">scanner</span>[<span class=\"ruby-value\">1</span>]\n\ 77: <span class=\"ruby-keyword kw\">end</span>\n\ 78: \n\ 79: <span class=\"ruby-keyword kw\">super</span>\n\ 80: \n\ 81: <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-keyword kw\">true</span>\n\ 82: <span class=\"ruby-keyword kw\">end</span>" m_desc: |- <p> Parse the contents of the directive </p> params: ( parser, state ) - visibility: protected aref: M000182 name: render_subnodes sourcecode: " <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/template/selectlist.rb, line 87</span>\n\ 87: <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">render_subnodes</span>( <span class=\"ruby-identifier\">attribute</span>, <span class=\"ruby-identifier\">template</span>, <span class=\"ruby-identifier\">scope</span> )\n\ 88: <span class=\"ruby-identifier\">res</span> = []\n\ 89: \n\ 90: <span class=\"ruby-identifier\">res</span> <span class=\"ruby-operator\"><<</span> <span class=\"ruby-value str\">%{<select name="%s">\\n}</span> <span class=\"ruby-operator\">%</span> [ <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">select_name</span> <span class=\"ruby-operator\">||</span> <span class=\"ruby-keyword kw\">self</span>.<span class=\"ruby-identifier\">name</span> ]\n\ 91: <span class=\"ruby-identifier\">attribute</span>.<span class=\"ruby-identifier\">each</span> <span class=\"ruby-keyword kw\">do</span> <span class=\"ruby-operator\">|</span><span class=\"ruby-identifier\">attrib</span><span class=\"ruby-operator\">|</span>\n\ 92: <span class=\"ruby-identifier\">res</span> <span class=\"ruby-operator\"><<</span> <span class=\"ruby-value str\">%{ <option value="%s">%s</option>\\n}</span> <span class=\"ruby-operator\">%</span> [ <span class=\"ruby-identifier\">attrib</span>, <span class=\"ruby-identifier\">attrib</span> ]\n\ 93: <span class=\"ruby-keyword kw\">end</span>\n\ 94: <span class=\"ruby-identifier\">res</span> <span class=\"ruby-operator\"><<</span> <span class=\"ruby-value str\">%{</select>\\n}</span>\n\ 95: \n\ 96: <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-operator\">*</span><span class=\"ruby-identifier\">res</span>\n\ 97: <span class=\"ruby-keyword kw\">end</span>" m_desc: |- <p> Render the directive‘s bracketed nodes once for each item in the iterated content. </p> params: ( attribute, template, scope ) category: Instance type: Protected
---
--- - name: SVNRev desc: |+ SVN Revision value: "%q$Rev: 406 $" - name: SVNId desc: |+ SVN Id value: "%q$Id: selectlist.rb 406 2007-07-18 17:01:59Z bbleything $" - name: NAMEDLIST value: CAPTURE[ IDENTIFIER ] + /\s+from\s+/i
Generated with the Darkfish Rdoc Generator.