Sha256: 6891e7fc1c6419a339066bd89ddaeb2b0598c114f2865186f2d9d04860c5c9ff

Contents?: true

Size: 337 Bytes

Versions: 29

Compression:

Stored size: 337 Bytes

Contents

require 'sinatra'
class ApplicationController < Sinatra::Base; end
module Eucalypt
  def self.Controller(route:)
    name = File.basename(caller[0][/[^:]+/],'.*').camelize
    Object.const_set name, Class.new(::ApplicationController)
    name.constantize.instance_eval %{def router() "#{route}" end}
    ::ApplicationController
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
eucalypt-0.9.0 lib/eucalypt/controller.rb
eucalypt-0.8.0 lib/eucalypt/controller.rb
eucalypt-0.7.2 lib/eucalypt/controller.rb
eucalypt-0.7.1 lib/eucalypt/controller.rb
eucalypt-0.7.0 lib/eucalypt/controller.rb
eucalypt-0.6.2 lib/eucalypt/controller.rb
eucalypt-0.6.1 lib/eucalypt/controller.rb
eucalypt-0.6.0 lib/eucalypt/controller.rb
eucalypt-0.5.4 lib/eucalypt/controller.rb
eucalypt-0.5.3 lib/eucalypt/controller.rb
eucalypt-0.5.2 lib/eucalypt/controller.rb
eucalypt-0.5.1 lib/eucalypt/controller.rb
eucalypt-0.5.0 lib/eucalypt/controller.rb
eucalypt-0.4.2 lib/eucalypt/controller.rb
eucalypt-0.4.1 lib/eucalypt/controller.rb
eucalypt-0.4.0 lib/eucalypt/controller.rb
eucalypt-0.3.5 lib/eucalypt/controller.rb
eucalypt-0.3.4 lib/eucalypt/controller.rb
eucalypt-0.3.3 lib/eucalypt/controller.rb
eucalypt-0.3.2 lib/eucalypt/controller.rb