Class: TaskInputFormControllerCreate
- Inherits:
-
Object
- Object
- TaskInputFormControllerCreate
- Defined in:
- lib/task/controllers/task_input_form_controller_create.rb
Instance Method Summary collapse
-
#initialize(parent_controller) ⇒ TaskInputFormControllerCreate
constructor
A new instance of TaskInputFormControllerCreate.
- #on_view_created ⇒ Object
- #process_fields(fields) ⇒ Object
- #set_view(view) ⇒ Object
Constructor Details
#initialize(parent_controller) ⇒ TaskInputFormControllerCreate
Returns a new instance of TaskInputFormControllerCreate.
5 6 7 8 |
# File 'lib/task/controllers/task_input_form_controller_create.rb', line 5 def initialize(parent_controller) @parent_controller = parent_controller @task_rep = TaskDbDataSource.new end |
Instance Method Details
#on_view_created ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/task/controllers/task_input_form_controller_create.rb', line 14 def on_view_created # begin # @student_rep = StudentRepository.new(DBSourceAdapter.new) # rescue Mysql2::Error::ConnectionError # on_db_conn_error # end end |
#process_fields(fields) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/task/controllers/task_input_form_controller_create.rb', line 22 def process_fields(fields) begin values = fields.values values.insert(-2, Time.now.strftime("%Y-%m-%d")) item = Task.new(-1, *values) item = @task_rep.add(item) @parent_controller.state_notifier.add(item) @view.close rescue ArgumentError => e api = Win32API.new('user32', 'MessageBox', ['L', 'P', 'P', 'L'], 'I') api.call(0, e., 'Error', 0) end end |
#set_view(view) ⇒ Object
10 11 12 |
# File 'lib/task/controllers/task_input_form_controller_create.rb', line 10 def set_view(view) @view = view end |