entangled 0.0.13 → 0.0.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/entangled.rb +2 -68
- data/lib/entangled/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c6ac5244a3b45da0b0a85bf605bd99bd1a5ccfa
|
4
|
+
data.tar.gz: f034dc5dcd3e972d1e520ae583bfca86d6bcbdb1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 937b68e66473799b9c1e503379404b02bf0c3eebbb5abd4260ebf368621b8f718cb5eaa3275c82b64ed667cf6fa1b71534b394f66c3375d096e51b4c85eb21f5
|
7
|
+
data.tar.gz: 65e270104ebb80fcb2fcde17f90be7aaa81f41947efdf38b770c8ead3570e65d61381faa8c5fae4934202d8e8b693063d8acf66c1f532c9cd5b80db5dfb8b16a
|
data/lib/entangled.rb
CHANGED
@@ -1,73 +1,7 @@
|
|
1
1
|
require 'redis'
|
2
|
+
require 'rails/all'
|
2
3
|
require 'entangled/version'
|
3
4
|
require 'entangled/helpers'
|
4
5
|
require 'entangled/model'
|
5
6
|
require 'entangled/controller'
|
6
|
-
require '
|
7
|
-
require 'active_support/concern'
|
8
|
-
|
9
|
-
module ActionDispatch::Routing
|
10
|
-
class Mapper
|
11
|
-
private
|
12
|
-
def sockets_for(resource, options = {})
|
13
|
-
@resources = resource.to_s.underscore.pluralize.to_sym
|
14
|
-
@resource = resource.to_s.underscore.singularize.to_sym
|
15
|
-
|
16
|
-
if options.any?
|
17
|
-
if options[:only]
|
18
|
-
if options[:only].is_a? Symbol
|
19
|
-
send :"draw_#{options[:only]}"
|
20
|
-
elsif options[:only].is_a? Array
|
21
|
-
options[:only].each do |option|
|
22
|
-
send :"draw_#{option}"
|
23
|
-
end
|
24
|
-
end
|
25
|
-
elsif options[:except]
|
26
|
-
if options[:except].is_a? Symbol
|
27
|
-
(default_options - [options[:except]]).each do |option|
|
28
|
-
send :"draw_#{option}"
|
29
|
-
end
|
30
|
-
elsif options[:except].is_a? Array
|
31
|
-
(default_options - options[:except]).each do |option|
|
32
|
-
send :"draw_#{option}"
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
else
|
37
|
-
draw_all
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
def default_options
|
42
|
-
[:index, :create, :show, :destroy, :update]
|
43
|
-
end
|
44
|
-
|
45
|
-
def draw_all
|
46
|
-
draw_index
|
47
|
-
draw_create
|
48
|
-
draw_show
|
49
|
-
draw_destroy
|
50
|
-
draw_update
|
51
|
-
end
|
52
|
-
|
53
|
-
def draw_index
|
54
|
-
get :"/#{@resources}", to: "#{@resources}#index", as: @resources
|
55
|
-
end
|
56
|
-
|
57
|
-
def draw_create
|
58
|
-
get :"/#{@resources}/create", to: "#{@resources}#create", as: :"create_#{@resource}"
|
59
|
-
end
|
60
|
-
|
61
|
-
def draw_show
|
62
|
-
get :"/#{@resources}/:id", to: "#{@resources}#show", as: @resource
|
63
|
-
end
|
64
|
-
|
65
|
-
def draw_destroy
|
66
|
-
get :"/#{@resources}/:id/destroy", to: "#{@resources}#destroy", as: :"destroy_#{@resource}"
|
67
|
-
end
|
68
|
-
|
69
|
-
def draw_update
|
70
|
-
get :"/#{@resources}/:id/update", to: "#{@resources}#update", as: :"update_#{@resource}"
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
7
|
+
require 'entangled/routes'
|
data/lib/entangled/version.rb
CHANGED