Class: Hologram::LinkHelper
- Inherits:
-
Object
- Object
- Hologram::LinkHelper
- Defined in:
- lib/hologram/link_helper.rb
Instance Attribute Summary collapse
-
#all_links ⇒ Object
readonly
Returns the value of attribute all_links.
Instance Method Summary collapse
-
#initialize(pages) ⇒ LinkHelper
constructor
A new instance of LinkHelper.
- #link_for(component_name) ⇒ Object
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
#all_links ⇒ Object (readonly)
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
#link_for(component_name) ⇒ Object
14 15 16 |
# File 'lib/hologram/link_helper.rb', line 14 def link_for(component_name) all_links[component_name] end |