Class: Sinicum::Navigation::NavigationHandler
- Inherits:
-
Object
- Object
- Sinicum::Navigation::NavigationHandler
- Includes:
- Jcr::ApiClient
- Defined in:
- lib/sinicum/navigation/navigation_handler.rb
Overview
Public: Handles the API communication and initializes the NavigationElement instances.
Class Method Summary collapse
- .children(base_node_or_path, depth, navigation_element_class = DefaultNavigationElement) ⇒ Object
- .parents(base_node_or_path, navigation_element_class = DefaultNavigationElement) ⇒ Object
Instance Method Summary collapse
- #elements ⇒ Object
-
#initialize(axis, base_node_or_path, navigation_element_class, options = {}) ⇒ NavigationHandler
constructor
A new instance of NavigationHandler.
Methods included from Jcr::ApiClient
Methods included from Logger
Constructor Details
#initialize(axis, base_node_or_path, navigation_element_class, options = {}) ⇒ NavigationHandler
Returns a new instance of NavigationHandler.
8 9 10 11 12 13 14 15 |
# File 'lib/sinicum/navigation/navigation_handler.rb', line 8 def initialize(axis, base_node_or_path, , = {}) = if axis == :children @elements = fetch_children(base_node_or_path, [:depth]) elsif axis == :parents @elements = fetch_parents(base_node_or_path) end end |
Class Method Details
.children(base_node_or_path, depth, navigation_element_class = DefaultNavigationElement) ⇒ Object
21 22 23 24 |
# File 'lib/sinicum/navigation/navigation_handler.rb', line 21 def self.children(base_node_or_path, depth, = ) new(:children, base_node_or_path, , depth: depth) end |
.parents(base_node_or_path, navigation_element_class = DefaultNavigationElement) ⇒ Object
26 27 28 |
# File 'lib/sinicum/navigation/navigation_handler.rb', line 26 def self.parents(base_node_or_path, = ) new(:parents, base_node_or_path, ) end |
Instance Method Details
#elements ⇒ Object
17 18 19 |
# File 'lib/sinicum/navigation/navigation_handler.rb', line 17 def elements .new(@elements) end |