Module: Rabarber::Helpers

Includes:
Core::Roleable
Defined in:
lib/rabarber/helpers/helpers.rb

Instance Method Summary collapse

Methods included from Core::Roleable

#roleable, #roleable_roles

Instance Method Details

#hidden_from(*roles, context: nil, &block) ⇒ Object



11
12
13
# File 'lib/rabarber/helpers/helpers.rb', line 11

def hidden_from(*roles, context: nil, &block)
  capture(&block) unless roleable.has_role?(*roles, context:)
end

#visible_to(*roles, context: nil, &block) ⇒ Object



7
8
9
# File 'lib/rabarber/helpers/helpers.rb', line 7

def visible_to(*roles, context: nil, &block)
  capture(&block) if roleable.has_role?(*roles, context:)
end