| Class | Display |
| In: |
app/models/display.rb
|
| Parent: | ActiveRecord::Base |
画面のモデル
| ITEM_DEFAULT_OPTIONS | = | { }.freeze |
現在の画面を返す。
# File app/models/display.rb, line 56
56: def self.current
57: ccache = CacheEachRequest.current
58: ccache ? ccache[:display] : nil
59: end
現在の画面を設定する。
# File app/models/display.rb, line 62
62: def self.current=(d)
63: CacheEachRequest.current[:display] = d
64: end
現在の画面の ID を返す。
# File app/models/display.rb, line 67
67: def self.current_id
68: (current) ? current.id : nil
69: end
権限にしたがって利用可能かどうかを判定する。 NOTE: 判定はサブクラスで実装する。
# File app/models/display.rb, line 78
78: def available?
79: raise NotImplementedError, "available? is not implemented"
80: end
「戻る」ボタンの有無を返す。 NOTE: 判定はサブクラスで実装する。既定値は false。
# File app/models/display.rb, line 90
90: def button_back?
91: false
92: end
「閉じる」ボタンの有無を返す。 NOTE: 判定はサブクラスで実装する。既定値は false。
# File app/models/display.rb, line 84
84: def button_close?
85: false
86: end
ビジネスロジックに定義された処理を行う。
# File app/models/display.rb, line 101
101: def inject_logic(position, x, action)
102: return x unless __send__("logic_#{position}?")
103: require(logic_path)
104: logic_class = "#{x.class}Logic".constantize
105: logic = logic_class.new
106: raise ArgumentError, "#{logic_class} is not a subclass of BusinessLogic" unless logic.is_a?(BusinessLogic)
107: return logic.__send__("#{position}process", action, User.current, x)
108: end
テーブルのカラムに対応する項目のリストを返す。
# File app/models/display.rb, line 111
111: def proper_items
112: items.select {|item| item.is_a?(ItemProper)}
113: end