Class: ContentNetwork::PathParams
- Inherits:
-
Object
- Object
- ContentNetwork::PathParams
- Defined in:
- lib/content_network/path_params.rb
Constant Summary collapse
- ATTRS =
i(element_type section_name entry_type entry_id)
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(element_type: 'Entry', section_name: 'all', entry_type: 'all', entry_id: 'all') ⇒ PathParams
constructor
A new instance of PathParams.
- #path ⇒ Object
Constructor Details
#initialize(element_type: 'Entry', section_name: 'all', entry_type: 'all', entry_id: 'all') ⇒ PathParams
Returns a new instance of PathParams.
11 12 13 14 15 16 |
# File 'lib/content_network/path_params.rb', line 11 def initialize(element_type: 'Entry', section_name: 'all', entry_type: 'all', entry_id: 'all') @element_type = element_type @section_name = section_name @entry_type = entry_type @entry_id = entry_id end |
Class Method Details
.build(params) ⇒ Object
3 4 5 |
# File 'lib/content_network/path_params.rb', line 3 def self.build(params) new(params.slice(*ATTRS)) end |
Instance Method Details
#path ⇒ Object
18 19 20 |
# File 'lib/content_network/path_params.rb', line 18 def path [@element_type, @section_name, @entry_type, @entry_id].join('/') end |