Class: Munge::Application
- Inherits:
-
Object
- Object
- Munge::Application
- Defined in:
- lib/munge/application.rb
Instance Method Summary collapse
- #build_virtual_item(relpath, content, **frontmatter) ⇒ Object
- #create(*args) ⇒ Object
-
#initialize(system) ⇒ Application
constructor
A new instance of Application.
- #items ⇒ Object
- #nonrouted ⇒ Object
- #routed ⇒ Object
- #vomit(component_name) ⇒ Object
Constructor Details
#initialize(system) ⇒ Application
Returns a new instance of Application.
3 4 5 |
# File 'lib/munge/application.rb', line 3 def initialize(system) @system = system end |
Instance Method Details
#build_virtual_item(relpath, content, **frontmatter) ⇒ Object
19 20 21 |
# File 'lib/munge/application.rb', line 19 def build_virtual_item(relpath, content, **frontmatter) @system.items.build(relpath: relpath, content: content, frontmatter: frontmatter) end |
#create(*args) ⇒ Object
23 24 25 26 27 |
# File 'lib/munge/application.rb', line 23 def create(*args) item = build_virtual_item(*args) @system.items.push(item) [item] end |
#items ⇒ Object
7 8 9 |
# File 'lib/munge/application.rb', line 7 def items @system.items end |
#nonrouted ⇒ Object
11 12 13 |
# File 'lib/munge/application.rb', line 11 def nonrouted items.select { |item| item.route.nil? } end |
#routed ⇒ Object
15 16 17 |
# File 'lib/munge/application.rb', line 15 def routed items.select(&:route) end |
#vomit(component_name) ⇒ Object
29 30 31 |
# File 'lib/munge/application.rb', line 29 def vomit(component_name) @system.public_send(component_name) end |