Class: Starter::Rake::GrapeTasks

Inherits:
Rake::TaskLib
  • Object
show all
Includes:
Rack::Test::Methods
Defined in:
lib/starter/rake/grape_tasks.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_classObject (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

#resourceObject (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_routesObject



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