Class: Pageflow::EntryTypes
- Inherits:
-
Object
- Object
- Pageflow::EntryTypes
- Includes:
- Enumerable
- Defined in:
- lib/pageflow/entry_types.rb
Overview
A collection of EntryType objects.
Instance Method Summary collapse
- #each(&block) ⇒ Object private
- #find_by_name!(name) ⇒ Object private
-
#initialize ⇒ EntryTypes
constructor
private
A new instance of EntryTypes.
-
#register(entry_type) ⇒ Object
Register an entry type.
- #routes(router) ⇒ Object private
Constructor Details
#initialize ⇒ EntryTypes
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of EntryTypes.
9 10 11 |
# File 'lib/pageflow/entry_types.rb', line 9 def initialize @entry_types_by_name = {} end |
Instance Method Details
#each(&block) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
28 29 30 |
# File 'lib/pageflow/entry_types.rb', line 28 def each(&block) @entry_types_by_name.values.each(&block) end |
#find_by_name!(name) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
21 22 23 24 25 |
# File 'lib/pageflow/entry_types.rb', line 21 def find_by_name!(name) @entry_types_by_name.fetch(name) do raise "Unknown entry type with name #{name}." end end |
#register(entry_type) ⇒ Object
Register an entry type.
16 17 18 |
# File 'lib/pageflow/entry_types.rb', line 16 def register(entry_type) @entry_types_by_name[entry_type.name] = entry_type end |
#routes(router) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/pageflow/entry_types.rb', line 33 def routes(router) each do |entry_type| next unless entry_type.editor_app router.instance_eval do nested do scope '/:entry_type', constraints: {entry_type: entry_type.name} do mount entry_type.editor_app, at: '/' end end end end end |