Class: Getto::Elm::Layout::Router::Container
- Inherits:
- BasicObject
- Defined in:
- lib/getto/elm/layout/router/container.rb
Instance Method Summary collapse
-
#initialize(path, app) ⇒ Container
constructor
A new instance of Container.
- #namespace(path, config = {}, &block) ⇒ Object
- #page(page, title, config = {}) ⇒ Object
Constructor Details
#initialize(path, app) ⇒ Container
Returns a new instance of Container.
5 6 7 8 9 |
# File 'lib/getto/elm/layout/router/container.rb', line 5 def initialize(path,app) @path = path @app = app @config = {} end |
Instance Method Details
#namespace(path, config = {}, &block) ⇒ Object
11 12 13 |
# File 'lib/getto/elm/layout/router/container.rb', line 11 def namespace(path,config={},&block) @config.merge! Container.new(@path.dup.push(path),@app.deep_merge(config)).instance_exec(&block) end |
#page(page, title, config = {}) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/getto/elm/layout/router/container.rb', line 14 def page(page,title,config={}) path = @path + [page] path_str = path.join("/") @config.merge!( path_str => @app.deep_merge(config).deep_merge( title: title, module: path.map{|p| "_#{p}".gsub(/_./){|k| k[1].upcase} }.join("."), path: path_str, ) ) end |