diy_rails 0.1.3 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c727c698f21390b3a70a7254fb270efc843eeb4ac6c94e609a3ba1192fd9f317
4
- data.tar.gz: 2e76f14981c08a7601186449fbcb0ddfc0a1fd1ac166a95b191b7494f0346bc6
3
+ metadata.gz: 3f13f1bd2f521709ca90c6e7b24a5b9ba2b161da6cc9ff6759b0ac6391f1bd4a
4
+ data.tar.gz: 51a40bde1c79fce866e6e3dd6b0c08bf66ed84d98cd18e8733dce1c21a5055a8
5
5
  SHA512:
6
- metadata.gz: b6bd31a640c68293234c92cc364059eab8345be71270254ddd535d3a4f0214fbc0c35b43ff3830fbcefdff4192a02fd792bc07bdb0e7e487ba1fee96ec9dde76
7
- data.tar.gz: ad9e04a3112d732171295f5403c019b33a81844d73dc346253f0449437eabf89736e271e9933e60e8986f137428b270354734d7897b02248c65e9bee58cfae95
6
+ metadata.gz: cd0d4cbf89e067efd8379c56466e3bed27957ffe45e3b04e537e1045ba740e86b7315bd50660ae91a399257b763166d5f13165a8b18398b57a542a1d3ff12968
7
+ data.tar.gz: b936b46406ec80302451a7387c95b2ab9ad6f6e3acce6294e5bebf31a823aab0919b85cfd015453820f451f3fb390ead6e3ac339f8454edb7236e30bc859f643
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- diy_rails (0.1.3)
4
+ diy_rails (0.2.0)
5
5
  rack (~> 2.2, >= 2.2.2)
6
6
 
7
7
  GEM
@@ -0,0 +1,10 @@
1
+ module Rulers
2
+ class Application
3
+ def get_controller_and_action(env)
4
+ _, cont, action, after = env["PATH_INFO"].split('/', 4)
5
+ cont = cont.capitalize # "People"
6
+ cont += "Controller" # "PeopleController"
7
+ [Object.const_get(cont), action]
8
+ end
9
+ end
10
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DiyRails
4
- VERSION = "0.1.3"
4
+ VERSION = "0.2.0"
5
5
  end
data/lib/diy_rails.rb CHANGED
@@ -2,13 +2,29 @@
2
2
 
3
3
  require_relative "diy_rails/version"
4
4
  require_relative "diy_rails/array"
5
+ require "diy_rails/routing"
5
6
 
6
7
  module DiyRails
7
8
  class Application
8
9
  `echo debug > debug.txt`;
9
10
  def call(env)
10
- [200, {'Content-Type' => 'text/html'},
11
- ["Hello from DIY RoR"]]
11
+ klass, act = get_controller_and_action(env)
12
+ controller = klass.new(env)
13
+ text = controller.send(act)
14
+
15
+ [200, {'Content-Type' => 'text/html'},
16
+ ["Hello from DIY RoR"]]
17
+ end
18
+ end
19
+
20
+ class Controller
21
+ def initialize(env)
22
+ @env = env
12
23
  end
24
+
25
+ def env
26
+ @env
27
+ end
28
+
13
29
  end
14
30
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: diy_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sahil Kapoor
@@ -58,6 +58,7 @@ files:
58
58
  - Rakefile
59
59
  - lib/diy_rails.rb
60
60
  - lib/diy_rails/array.rb
61
+ - lib/diy_rails/routing.rb
61
62
  - lib/diy_rails/version.rb
62
63
  - sig/diy_rails.rbs
63
64
  homepage: https://rubygems.org/gems/diy_rails