Sha256: 495e12e1c50cd47072ac1e09e117272902928566289648621df24f4cb50e5698
Contents?: true
Size: 541 Bytes
Versions: 30
Compression:
Stored size: 541 Bytes
Contents
class Tool include ActiveModel::Validations ALL = ['LineMeasureTool', 'AreaMeasureTool', 'PrevTool', 'NextTool', 'LinkTool', 'PrintTool', 'ExportTool', 'SelectTool'] #, 'EditTool' validates_presence_of :topic, :name attr_accessor :topic, :name def initialize(topic, name) @topic, @name = topic, name end def self.accessible_tools(topic, ability) tools = ALL.select do |tool| ability.can?(:show, Tool.new(topic, tool)) end tools << 'EditTool' if ability.can?(:edit, topic) tools end end
Version data entries
30 entries across 30 versions & 1 rubygems