Module: ButlerMainframe::ActiveRecord
- Included in:
- HostBase
- Defined in:
- lib/mainframe/customization/active_record.rb
Overview
This module can be use on rails project.
Create a polimorphic model: rails generate screen hook_id:integer ‘hook_type:string30’ ‘screen_type:integer1’ video:text ‘message:string160’ ‘cursor_x:integer1’ ‘cursor_y:integer1’
In the model to be related to screen we insert: has_many :screens, :as => :hook, :dependent => :destroy
Instance Method Summary collapse
-
#screenshot(screen_type, options = {}) ⇒ Object
screen_type: error, notice, warning…
Instance Method Details
#screenshot(screen_type, options = {}) ⇒ Object
screen_type: error, notice, warning…
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/mainframe/customization/active_record.rb', line 12 def screenshot screen_type, ={} = { :message => nil, :video => nil, :rails_model => Screen }.merge() screen = [:rails_model].new screen.screen_type = case screen_type when :notice then 1 when :warning then 2 else 0 #error end screen. = [:message] || screen.video = [:video] || scan(:y1 => 1, :x1 => 1, :y2 => 22, :x2 => 80) screen.cursor_y, screen.cursor_x = get_cursor_axes screen end |