Class: InterMine::PathQuery::TemplateBuilder
- Inherits:
-
QueryBuilder
- Object
- QueryBuilder
- InterMine::PathQuery::TemplateBuilder
- Defined in:
- lib/intermine/query.rb
Instance Method Summary collapse
-
#initialize(model) ⇒ TemplateBuilder
constructor
A new instance of TemplateBuilder.
- #process_constraint(attrs) ⇒ Object
- #query ⇒ Object
- #tag_start(name, attrs) ⇒ Object
Methods inherited from QueryBuilder
Constructor Details
#initialize(model) ⇒ TemplateBuilder
Returns a new instance of TemplateBuilder.
157 158 159 160 |
# File 'lib/intermine/query.rb', line 157 def initialize(model) super @template_attrs = {} end |
Instance Method Details
#process_constraint(attrs) ⇒ Object
179 180 181 182 183 184 185 186 187 188 189 |
# File 'lib/intermine/query.rb', line 179 def process_constraint(attrs) super unless attrs.has_key? "type" if attrs.has_key?("editable") and attrs["editable"].downcase == "false" @coded_constraints.last[:editable] = false else @coded_constraints.last[:editable] = true end @coded_constraints.last[:switchable] = attrs["switchable"] || "locked" end end |
#query ⇒ Object
171 172 173 174 175 176 177 |
# File 'lib/intermine/query.rb', line 171 def query template = super @template_attrs.each do |k,v| template.send(k + '=', v) end return template end |
#tag_start(name, attrs) ⇒ Object
162 163 164 165 166 167 168 169 |
# File 'lib/intermine/query.rb', line 162 def tag_start(name, attrs) super if name == "template" attrs.each do |a| @template_attrs[a.first] = a.last end end end |