Class: Hologram::LinkHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/hologram/link_helper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pages) ⇒ LinkHelper

Returns a new instance of LinkHelper.



3
4
5
6
7
8
9
10
# File 'lib/hologram/link_helper.rb', line 3

def initialize(pages)
  @all_links = {}
  pages.each do |page|
    page[:component_names].each do |component_name|
      @all_links[component_name] ||= "#{page[:name]}\##{component_name}"
    end
  end
end

Instance Attribute Details

Returns the value of attribute all_links.



12
13
14
# File 'lib/hologram/link_helper.rb', line 12

def all_links
  @all_links
end

Instance Method Details



14
15
16
# File 'lib/hologram/link_helper.rb', line 14

def link_for(component_name)
  all_links[component_name]
end