Sha256: c37aff77677e6b38725e69f0f0fb45ac65efa8c6a38405b9061d0f8eebafea57

Contents?: true

Size: 1.27 KB

Versions: 6

Compression:

Stored size: 1.27 KB

Contents

meta '#hello', accept: %w[js html] | default is text/html, default / * not implemented yet
get '/' do
  send_data ... --> will make encoding chunked

  # set resp status
  status 302 | :not_found

  # content type is separated out from render
  content_type :js

  # terminal action : render view, or file for download
  render ..., layout: [a, b, c]

  render file # choose renderer by ext
  render :slim => template_content

  ... Fiber.yield

  s = stream ... # same arg as render
  ...
  r.resume
  ...
  r.resume

  render :slim, 'content'

  # terminal action
  redirect_to path_for '...'
  redirect_to '/'
  redirect_to :back # referrer

  # terminate process
  halt status

  # loop response
  loop do
    sleep 4
    send_data ...
  end

  # can use accept when meta is configured, raise error if not configured
  case accept
  when 'html'
    ...
  when 'js'
  end
end

# default is no scheme, the links start with // to fit all schemes
configure url_for, default_scheme nil / 'https'

url_for '#b', scheme: 'http', format: 'js', host: 'a.b.c:3000' # string keys are put in query

path_for 'cont#action', 12, 3, :format => 'js', # string keys are put in query, (what about hash tags?)

partial '...'

# for middleware, we use life cycle callbacks
# on :header_complete
# on :init

# before

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
nyara-0.0.1.pre.5 example/design.rb
nyara-0.0.1.pre.4 example/design.rb
nyara-0.0.1.pre.3 example/design.rb
nyara-0.0.1.pre.2 example/design.rb
nyara-0.0.1.pre.1 example/design.rb
nyara-0.0.1.pre example/design.rb