Class: Ekylibre::Navigation::Page

Inherits:
Object
  • Object
show all
Defined in:
lib/ekylibre/navigation/page.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(to) ⇒ Page

Returns a new instance of Page.


6
7
8
9
# File 'lib/ekylibre/navigation/page.rb', line 6

def initialize(to)
  @path = to
  @controller, @action = @path.split('#')[0..1]
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action


4
5
6
# File 'lib/ekylibre/navigation/page.rb', line 4

def action
  @action
end

#controllerObject (readonly)

Returns the value of attribute controller


4
5
6
# File 'lib/ekylibre/navigation/page.rb', line 4

def controller
  @controller
end

#pathObject (readonly)

Returns the value of attribute path


4
5
6
# File 'lib/ekylibre/navigation/page.rb', line 4

def path
  @path
end

Instance Method Details

#==(other) ⇒ Object


15
16
17
# File 'lib/ekylibre/navigation/page.rb', line 15

def ==(other)
  @path == other.path
end

#human_nameObject


19
20
21
# File 'lib/ekylibre/navigation/page.rb', line 19

def human_name
  "actions.#{@controller}.#{@action}".t
end

#to_hashObject


11
12
13
# File 'lib/ekylibre/navigation/page.rb', line 11

def to_hash
  { controller: '/' + @controller, action: @action }
end