Method: Volt::Modes::ClassMethods#run_in_mode_if

Defined in:
lib/volt/utils/modes.rb

#run_in_mode_if(conditional, mode_name) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/volt/utils/modes.rb', line 30

def run_in_mode_if(conditional, mode_name)
  if conditional
    # Yes, run in the mode
    Volt.run_in_mode(mode_name) do
      yield
    end
  else
    # Just run normally
    yield
  end
end