Class: Bookbinder::Subnav::TemplateCreator::LinkHolder
- Inherits:
-
Object
- Object
- Bookbinder::Subnav::TemplateCreator::LinkHolder
- Defined in:
- lib/bookbinder/subnav/template_creator.rb
Instance Attribute Summary collapse
-
#links ⇒ Object
readonly
Returns the value of attribute links.
Instance Method Summary collapse
- #escape_html(str) ⇒ Object
- #get_binding ⇒ Object
-
#initialize(links, template) ⇒ LinkHolder
constructor
A new instance of LinkHolder.
- #links?(links) ⇒ Boolean
- #render_links(some_links) ⇒ Object
- #submenu_class(link) ⇒ Object
Constructor Details
#initialize(links, template) ⇒ LinkHolder
Returns a new instance of LinkHolder.
42 43 44 45 |
# File 'lib/bookbinder/subnav/template_creator.rb', line 42 def initialize(links, template) @links = links @template = template end |
Instance Attribute Details
#links ⇒ Object (readonly)
Returns the value of attribute links.
47 48 49 |
# File 'lib/bookbinder/subnav/template_creator.rb', line 47 def links @links end |
Instance Method Details
#escape_html(str) ⇒ Object
65 66 67 |
# File 'lib/bookbinder/subnav/template_creator.rb', line 65 def escape_html(str) Rack::Utils.escape_html(str) end |
#get_binding ⇒ Object
49 50 51 |
# File 'lib/bookbinder/subnav/template_creator.rb', line 49 def get_binding binding end |
#links?(links) ⇒ Boolean
61 62 63 |
# File 'lib/bookbinder/subnav/template_creator.rb', line 61 def links?(links) (links || []).empty? end |
#render_links(some_links) ⇒ Object
53 54 55 |
# File 'lib/bookbinder/subnav/template_creator.rb', line 53 def render_links(some_links) @template.result(LinkHolder.new(some_links, @template).get_binding) end |
#submenu_class(link) ⇒ Object
57 58 59 |
# File 'lib/bookbinder/subnav/template_creator.rb', line 57 def (link) 'has_submenu' unless links?(link[:nested_links]) end |