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, &block) ⇒ Object



13
14
15
16
17
# File 'lib/rabarber/helpers/helpers.rb', line 13

def hidden_from(*roles, &block)
  return if roleable_roles.intersection(Rabarber::Input::Roles.new(roles).process).any?

  capture(&block)
end

#visible_to(*roles, &block) ⇒ Object



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

def visible_to(*roles, &block)
  return unless roleable_roles.intersection(Rabarber::Input::Roles.new(roles).process).any?

  capture(&block)
end