grape-dsl 2.0.3 → 2.1.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 +4 -4
- data/VERSION +1 -1
- data/lib/grape-dsl/dsl.rb +10 -19
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dd5210f2f3fc7cdfc0973a9f972e9e19807cff64
|
4
|
+
data.tar.gz: c29cf6e0031d3f02f7b9c5db2cbca350affe0561
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f02b572c822716d842b58a836be1bd76d051d695845635605c77cbe4d07e4f4605bd16fc0cf7799d8abecfab464da20f98aba0575e7ef9d4e2727689e2438df
|
7
|
+
data.tar.gz: 7601cccfdad61d72c31c0fe2f8dca3ee4dc136f9a36956b5747972afecf0ba357f68d0ac42da1c1014ba531de6fc6b4575abade93605215ddfbb5dd94359ddb9
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0
|
1
|
+
2.1.0
|
data/lib/grape-dsl/dsl.rb
CHANGED
@@ -67,39 +67,30 @@ module GrapeDSL
|
|
67
67
|
# mount all the rest api classes that is subclass of the Grape::API
|
68
68
|
# make easy to manage
|
69
69
|
|
70
|
-
def
|
70
|
+
def mount_by opts= {}
|
71
71
|
|
72
|
-
unless opts.class <= Hash
|
73
|
-
raise ArgumentError,"invalid option object given, must be hash like!"
|
74
|
-
end
|
72
|
+
raise unless opts.class <= ::Hash
|
75
73
|
|
76
|
-
opts[:
|
77
|
-
opts[:
|
74
|
+
opts[:class] ||= opts[:klass] || opts[:k] || opts[:c] || Grape::API
|
75
|
+
opts[:ex] ||= opts[:except] || opts[:exception] || opts[:e] || []
|
76
|
+
opts[:in] ||= opts[:include] || opts[:inclusion] || opts[:i] || []
|
78
77
|
|
79
78
|
[:ex,:in].each{|sym| (opts[sym]=[opts[sym]]) unless opts[sym].class <= Array }
|
80
79
|
|
81
80
|
# mount components
|
82
|
-
|
83
|
-
|
84
|
-
unless opts[:ex].include?(component) || self == component
|
85
|
-
mount(component)
|
86
|
-
end
|
87
|
-
|
81
|
+
opts[:class].inherited_by.each do |component|
|
82
|
+
mount(component) unless opts[:ex].include?(component) || self == component
|
88
83
|
end
|
89
84
|
|
90
|
-
opts[:in].each{|
|
85
|
+
opts[:in].each{ |klass| self.mount(klass) }
|
91
86
|
|
92
87
|
return nil
|
93
88
|
|
94
89
|
end
|
95
90
|
|
96
|
-
alias :mount_apis :mount_api
|
97
|
-
|
98
91
|
def mount_subclasses(*exception)
|
99
|
-
|
100
|
-
end
|
101
|
-
|
102
|
-
alias :mount_classes :mount_subclasses
|
92
|
+
mount_by ex: exception
|
93
|
+
end;alias :mount_classes :mount_subclasses
|
103
94
|
|
104
95
|
# write out to the console the class routes
|
105
96
|
def console_write_out_routes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grape-dsl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Luzsi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mpatch
|