Module: OLE_QA::Framework::Page_Helpers
- Included in:
- Page
- Defined in:
- lib/module/qa_page_helpers.rb
Overview
Copyright 2005-2013 The Kuali Foundation
Licensed under the Educational Community License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at:
http://www.opensource.org/licenses/ecl2.php
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Instance Method Summary collapse
-
#set_line(name, klas, force = false) ⇒ Object
(also: #line)
Set a line object definition on a page object.
Instance Method Details
#set_line(name, klas, force = false) ⇒ Object Also known as: line
Set a line object definition on a page object.
-
A line object created with this method becomes an accessor attribute associated with an instance variable on the page or data object on which it is created.
32 33 34 35 36 37 38 39 |
# File 'lib/module/qa_page_helpers.rb', line 32 def set_line(name, klas, force = false) raise StandardError, "Name must be a symbol. Given: #{name} (#{name.class})" unless name.instance_of?(Symbol) raise StandardError, "Klas must be a class. Given: #{klas} (#{klas.class})" unless klas.instance_of?(Class) raise StandardError, "Line object is already defined. (Use the 'force = true' option to suppress this error.)" if @lines.include?(name) && ! force instance_variable_set("@#{name}", klas.new(@ole, 1)) make_reader(name) unless force @lines << name unless force end |