Module: Styxie::Helpers

Defined in:
lib/styxie/helpers.rb

Instance Method Summary collapse

Instance Method Details

#this_namespace?(namespace) ⇒ Boolean

Returns:

  • (Boolean)


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

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

#this_page?(mask) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
7
8
9
# File 'lib/styxie/helpers.rb', line 4

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