Class: AmaLayout::Agent::Navigation

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Model
Defined in:
lib/ama_layout/agent/navigation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Navigation

Returns a new instance of Navigation.



12
13
14
15
# File 'lib/ama_layout/agent/navigation.rb', line 12

def initialize(args = {})
  args = defaults.merge args
  super
end

Instance Attribute Details

#current_urlObject

Returns the value of attribute current_url.



10
11
12
# File 'lib/ama_layout/agent/navigation.rb', line 10

def current_url
  @current_url
end

#display_nameObject

Returns the value of attribute display_name.



10
11
12
# File 'lib/ama_layout/agent/navigation.rb', line 10

def display_name
  @display_name
end

Returns the value of attribute nav_file_path.



10
11
12
# File 'lib/ama_layout/agent/navigation.rb', line 10

def nav_file_path
  @nav_file_path
end

#userObject

Returns the value of attribute user.



10
11
12
# File 'lib/ama_layout/agent/navigation.rb', line 10

def user
  @user
end

Instance Method Details

#decorateObject



6
7
8
# File 'lib/ama_layout/agent/navigation.rb', line 6

def decorate
  AmaLayout::Agent::NavigationDecorator.new(self)
end

#itemsObject



17
18
19
20
21
# File 'lib/ama_layout/agent/navigation.rb', line 17

def items
  navigation_items.map do |n|
    NavigationItem.new n.merge({ current_url: current_url})
  end
end


23
24
25
# File 'lib/ama_layout/agent/navigation.rb', line 23

def navigation_items
  YAML.load ERB.new(File.read nav_file_path).result
end