Class: Starter::Rake::GrapeTasks
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- Starter::Rake::GrapeTasks
- Includes:
- Rack::Test::Methods
- Defined in:
- lib/starter/rake/grape_tasks.rb
Instance Attribute Summary collapse
-
#api_class ⇒ Object
readonly
Returns the value of attribute api_class.
-
#resource ⇒ Object
readonly
Returns the value of attribute resource.
Instance Method Summary collapse
- #api_routes ⇒ Object
-
#initialize(api_class = nil) ⇒ GrapeTasks
constructor
A new instance of GrapeTasks.
Constructor Details
#initialize(api_class = nil) ⇒ GrapeTasks
Returns a new instance of GrapeTasks.
17 18 19 20 21 22 |
# File 'lib/starter/rake/grape_tasks.rb', line 17 def initialize(api_class = nil) super() @api_class = api_class define_tasks end |
Instance Attribute Details
#api_class ⇒ Object (readonly)
Returns the value of attribute api_class.
15 16 17 |
# File 'lib/starter/rake/grape_tasks.rb', line 15 def api_class @api_class end |
#resource ⇒ Object (readonly)
Returns the value of attribute resource.
14 15 16 |
# File 'lib/starter/rake/grape_tasks.rb', line 14 def resource @resource end |
Instance Method Details
#api_routes ⇒ Object
24 25 26 27 28 |
# File 'lib/starter/rake/grape_tasks.rb', line 24 def api_routes api_class.routes.each_with_object([]) do |route, memo| memo << { verb: route.request_method, path: build_path(route), description: route.description } end end |