grape-dsl 2.0.3 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/lib/grape-dsl/dsl.rb +10 -19
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c082b667ab1be80b65db4c1f4e851720a3f3dbe5
4
- data.tar.gz: 8dabf70adebcf63f065c8a6b438c7b61ae1a9673
3
+ metadata.gz: dd5210f2f3fc7cdfc0973a9f972e9e19807cff64
4
+ data.tar.gz: c29cf6e0031d3f02f7b9c5db2cbca350affe0561
5
5
  SHA512:
6
- metadata.gz: e2a574f5483751fea3e2ead8cbc7abefdca25b6908c60e5b4f7b2d26f7c1569729cc66635ad26c530333fc6d3a47a76db5194018b8ae639a4f9532e4aa542ae2
7
- data.tar.gz: 7792e998a3608b9613b1277d636aef4ccedaef55b4d52118a5095ab77e53e0719ca4b62b87eec3b94fec78a040dba8a2e15efeb600e3958615c670de1d020221
6
+ metadata.gz: 8f02b572c822716d842b58a836be1bd76d051d695845635605c77cbe4d07e4f4605bd16fc0cf7799d8abecfab464da20f98aba0575e7ef9d4e2727689e2438df
7
+ data.tar.gz: 7601cccfdad61d72c31c0fe2f8dca3ee4dc136f9a36956b5747972afecf0ba357f68d0ac42da1c1014ba531de6fc6b4575abade93605215ddfbb5dd94359ddb9
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.3
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 mount_api opts= {}
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[:ex] ||= opts[:except] || opts[:exception] || opts[:e] || []
77
- opts[:in] ||= opts[:include] || opts[:inclusion] || opts[:i] || []
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
- Grape::API.inherited_by.each do |component|
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{|cls| self.mount(cls) }
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
- mount_api ex: exception
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.3
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-05-22 00:00:00.000000000 Z
11
+ date: 2014-06-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mpatch