Class: Rapidoc::ResourceDoc

Inherits:
Object
  • Object
show all
Defined in:
lib/rapidoc/resource_doc.rb

Overview

This class includes all info about a resource To extract info from controller file uses ControllerExtractor It includes an array of ActionDoc with each action information

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(resource_name, routes_actions_info) ⇒ ResourceDoc

Returns a new instance of ResourceDoc.

Parameters:

  • resource_name (String)

    resource name

  • routes_doc (RoutesDoc)

    routes documentation



17
18
19
20
21
22
# File 'lib/rapidoc/resource_doc.rb', line 17

def initialize( resource_name, routes_actions_info )
  @name = resource_name.to_s.split('/').last
  @controller_file = resource_name.to_s.pluralize + '_controller' + controllers_extension

  generate_info routes_actions_info
end

Instance Attribute Details

#actions_docObject (readonly)

Returns the value of attribute actions_doc.



11
12
13
# File 'lib/rapidoc/resource_doc.rb', line 11

def actions_doc
  @actions_doc
end

#controller_fileObject (readonly)

Returns the value of attribute controller_file.



11
12
13
# File 'lib/rapidoc/resource_doc.rb', line 11

def controller_file
  @controller_file
end

#descriptionObject (readonly)

Returns the value of attribute description.



11
12
13
# File 'lib/rapidoc/resource_doc.rb', line 11

def description
  @description
end

#nameObject (readonly)

Returns the value of attribute name.



11
12
13
# File 'lib/rapidoc/resource_doc.rb', line 11

def name
  @name
end

Instance Method Details

#simple_nameObject

Names with ‘/’ caracter produce problems in html ids



27
28
29
# File 'lib/rapidoc/resource_doc.rb', line 27

def simple_name
  return self.name.delete '/'
end