Module: Styx::Helpers

Extended by:
ActiveSupport::Concern
Defined in:
lib/styx/helpers.rb

Instance Method Summary collapse

Instance Method Details

#this_namespace?(namespace) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
19
# File 'lib/styx/helpers.rb', line 16

def this_namespace?(namespace)
  # TODO: support nested namespaces?
  namespace == controller_path.split('/').first
end

#this_page?(mask) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
12
13
14
# File 'lib/styx/helpers.rb', line 9

def this_page?(mask)
  [*mask].any? do |m|
    c, a = m.to_s.split('#')
    !(c.present? && c != controller_name || a.present? && a != action_name)
  end
end