Sha256: e6c7f24047504eb420ff8feaee8e539413d0d86283e8f1946b081f67a0847666

Contents?: true

Size: 680 Bytes

Versions: 59

Compression:

Stored size: 680 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) { yield }
    end

    self
  end

end

Version data entries

59 entries across 59 versions & 1 rubygems

Version Path
lalala-4.0.0.dev.168 lib/lalala/pages/route_mapper.rb
lalala-4.0.0.dev.165 lib/lalala/pages/route_mapper.rb
lalala-4.0.0.dev.162 lib/lalala/pages/route_mapper.rb
lalala-4.0.0.dev.161 lib/lalala/pages/route_mapper.rb
lalala-4.0.0.dev.160 lib/lalala/pages/route_mapper.rb
lalala-4.0.0.dev.157 lib/lalala/pages/route_mapper.rb
lalala-4.0.0.dev.156 lib/lalala/pages/route_mapper.rb
lalala-4.0.0.dev.155 lib/lalala/pages/route_mapper.rb
lalala-4.0.0.dev.154 lib/lalala/pages/route_mapper.rb
lalala-4.0.0.dev.153 lib/lalala/pages/route_mapper.rb
lalala-4.0.0.dev.152 lib/lalala/pages/route_mapper.rb
lalala-4.0.0.dev.149 lib/lalala/pages/route_mapper.rb
lalala-4.0.0.dev.146 lib/lalala/pages/route_mapper.rb
lalala-4.0.0.dev.144 lib/lalala/pages/route_mapper.rb
lalala-4.0.0.dev.141 lib/lalala/pages/route_mapper.rb
lalala-4.0.0.dev.136 lib/lalala/pages/route_mapper.rb
lalala-4.0.0.dev.135 lib/lalala/pages/route_mapper.rb
lalala-4.0.0.dev.134 lib/lalala/pages/route_mapper.rb
lalala-4.0.0.dev.133 lib/lalala/pages/route_mapper.rb
lalala-4.0.0.dev.132 lib/lalala/pages/route_mapper.rb