thomler 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3c1f5b0477e201d6778f864e033eccb925db4de2
4
- data.tar.gz: a9d5dc5e3ba94d071ec2cbe33feeb0e36817dd48
3
+ metadata.gz: eb6225c0faf1a460b76b1fd6b0f07e577ac212b3
4
+ data.tar.gz: 5f8b874d592523b0c5b7819694101fb5183712d6
5
5
  SHA512:
6
- metadata.gz: 305adaa0a20cd881f9c38769a941ea4ca3ec739210690bdfbfec819cb19c7d151d64fd1f84f573b7f8133df0edfab5ae7b670c952453ded493f5a413972625d4
7
- data.tar.gz: 29e57fbd6dcdff64048a63a5d4aa677cd1ea78d874f283d60a30fc2fb005b2b7f10f191c94830240204a451c5dad273bfb8f54d0bb247fe0f8e74912176712f9
6
+ metadata.gz: c1d8e96609dddbd06c72f85978f0370fe997f2ea442723adcd2aefa08bdf348868043fb88ad2c9ec36d1c094dc87e5c6622207c7e64334b86850738e88bd4316
7
+ data.tar.gz: 51d6a60283f43f32949630a40da2ff1d23f2e3473b9f23f6063e5cac18f5f207e9ff9c4df225e30954e488e0f26ef810ecda813d838787527bec2ff346de2cf2
data/lib/thomler.rb CHANGED
@@ -4,7 +4,20 @@ require "thomler/array"
4
4
  module Thomler
5
5
  class Application
6
6
  def call env
7
+ klass, act = get_controller_and_action(env)
8
+ controller = klass.new(env)
9
+ text = controller.send(act)
7
10
  [200, {'Content-Type' => 'text/html'}, ["Hello from Ruby on Thomler!"]]
8
11
  end
9
12
  end
13
+
14
+ class Controller
15
+ def initialize env
16
+ @env = env
17
+ end
18
+
19
+ def env
20
+ @env
21
+ end
22
+ end
10
23
  end
@@ -0,0 +1,11 @@
1
+ module Thomler
2
+ class Application
3
+ def get_controller_and_action env
4
+ _, cont, action, after = env["PATH_INFO"].split('/', 4)
5
+ cont = cont.capitalize
6
+ cont += "Controller"
7
+
8
+ [Object.const_get(cont), action]
9
+ end
10
+ end
11
+ end
@@ -1,3 +1,3 @@
1
1
  module Thomler
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -17,5 +17,4 @@ class ThomlerTestApp < Test::Unit::TestCase
17
17
  body = last_response.body
18
18
  assert body["Hello"]
19
19
  end
20
-
21
20
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thomler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Osborn
@@ -82,6 +82,7 @@ files:
82
82
  - lib/.DS_Store
83
83
  - lib/thomler.rb
84
84
  - lib/thomler/array.rb
85
+ - lib/thomler/routing.rb
85
86
  - lib/thomler/version.rb
86
87
  - test/.DS_Store
87
88
  - test/test_application.rb