Module: Styx::Helpers::InstanceMethods

Defined in:
lib/styx/helpers.rb

Instance Method Summary collapse

Instance Method Details

#this_namespace?(namespace) ⇒ Boolean

Returns:

  • (Boolean)


33
34
35
36
37
# File 'lib/styx/helpers.rb', line 33

def this_namespace?(namespace)
  current = controller_path.split('/').first

  return namespace == current
end

#this_page?(mask) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/styx/helpers.rb', line 11

def this_page?(mask)
  mask = [mask] unless mask.is_a?(Array)

  flag = false

  mask.each do |m|
    m = m.to_s.split('#')

    c = m[0]
    a = m[1]

    f = true

    f = false if !c.blank? && c != controller_name
    f = false if !a.blank? && a != action_name

    flag ||= f
  end

  flag
end