Sha256: b0c113198c608aaeb935afcd3b0192792178d73e981185d56af8ee2f6fce84bf

Contents?: true

Size: 712 Bytes

Versions: 16

Compression:

Stored size: 712 Bytes

Contents

module Lalala::Pages::RouteMapper

  # pages(:about, to: 'about#show')
  # pages(:about, to: 'about#show') do
  #   get '/team/:member', to: 'about#team_member'
  # end
  # pages(:about) do
  #   get '/team/:member', to: 'about#team_member'
  # end
  def pages(*args)
    options = args.extract_options!
    options = options.dup

    unless args.size == 1 and Symbol === args[0]
      raise ArgumentError, "expected a page type"
    end

    type    = args[0]
    options = { as: type }.merge(options)
    options[:constraints] = Lalala::Pages::PageTypeConstraint.new(type)

    match '/', options

    if block_given?
      scope(options.except(:to,:action,:controller)) { yield }
    end

    self
  end

end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
lalala-4.0.0.dev.191 lib/lalala/pages/route_mapper.rb
lalala-4.0.0.dev.190 lib/lalala/pages/route_mapper.rb
lalala-4.0.0.dev.189 lib/lalala/pages/route_mapper.rb
lalala-4.0.0.dev.188 lib/lalala/pages/route_mapper.rb
lalala-4.0.0.dev.187 lib/lalala/pages/route_mapper.rb
lalala-4.0.0.dev.186 lib/lalala/pages/route_mapper.rb
lalala-4.0.0.dev.185 lib/lalala/pages/route_mapper.rb
lalala-4.0.0.dev.184 lib/lalala/pages/route_mapper.rb
lalala-4.0.0.dev.183 lib/lalala/pages/route_mapper.rb
lalala-4.0.0.dev.181 lib/lalala/pages/route_mapper.rb
lalala-4.0.0.dev.180 lib/lalala/pages/route_mapper.rb
lalala-4.0.0.dev.179 lib/lalala/pages/route_mapper.rb
lalala-4.0.0.dev.178 lib/lalala/pages/route_mapper.rb
lalala-4.0.0.dev.177 lib/lalala/pages/route_mapper.rb
lalala-4.0.0.dev.176 lib/lalala/pages/route_mapper.rb
lalala-4.0.0.dev.170 lib/lalala/pages/route_mapper.rb