Module: Card::Format::Error
- Included in:
- Card::Format
- Defined in:
- card/lib/card/format/error.rb
Overview
permissions and errors in card format classes
Instance Method Summary collapse
-
#anyone_can?(task) ⇒ Boolean
-
#monitor_depth ⇒ Object
-
#ok?(task) ⇒ Boolean
-
#view_for_denial(view, task) ⇒ Object
-
#view_for_unknown(setting_view) ⇒ Object
Instance Method Details
#anyone_can?(task) ⇒ Boolean
10 11 12 13 14 15 16 |
# File 'card/lib/card/format/error.rb', line 10 def anyone_can? task return false unless task.is_a? Symbol @anyone_can ||= {} @anyone_can[task] = card.anyone_can? task if @anyone_can[task].nil? @anyone_can[task] end |
#monitor_depth ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'card/lib/card/format/error.rb', line 33 def monitor_depth max = Card.config.max_depth if depth >= max || voo.depth >= max raise Card::Error::UserError, t(:format_too_deep) end yield end |
#ok?(task) ⇒ Boolean
5 6 7 8 |
# File 'card/lib/card/format/error.rb', line 5 def ok? task task = :create if task == :update && card.new_card? card.ok? task end |