Class: Brainstem::ApiDocs::Introspectors::AbstractIntrospector
- Inherits:
-
Object
- Object
- Brainstem::ApiDocs::Introspectors::AbstractIntrospector
- Includes:
- Concerns::Optional
- Defined in:
- lib/brainstem/api_docs/introspectors/abstract_introspector.rb
Direct Known Subclasses
Class Method Summary collapse
-
.with_loaded_environment(options = {}) ⇒ AbstractIntrospector
Returns a new instance of the introspector with the environment loaded, ready for introspection.
Instance Method Summary collapse
-
#controllers ⇒ Array<Class>
Override to return a collection of all controller classes.
-
#presenters ⇒ Array<Class>
Override to return a collection of all presenter classes.
-
#routes ⇒ Object
Override to return a collection of hashes with the minimum following keys:.
-
#valid? ⇒ Boolean
Provides both a sanity check to ensure that output confirms to interface and also confirms that there is actually something to generate docs for.
- #valid_options ⇒ Object
Methods included from Concerns::Optional
Class Method Details
.with_loaded_environment(options = {}) ⇒ AbstractIntrospector
Returns a new instance of the introspector with the environment loaded, ready for introspection.
18 19 20 |
# File 'lib/brainstem/api_docs/introspectors/abstract_introspector.rb', line 18 def self.with_loaded_environment( = {}) new().tap(&:load_environment!) end |
Instance Method Details
#controllers ⇒ Array<Class>
Override to return a collection of all controller classes.
26 27 28 |
# File 'lib/brainstem/api_docs/introspectors/abstract_introspector.rb', line 26 def controllers raise NotImplementedError end |
#presenters ⇒ Array<Class>
Override to return a collection of all presenter classes.
34 35 36 |
# File 'lib/brainstem/api_docs/introspectors/abstract_introspector.rb', line 34 def presenters raise NotImplementedError end |
#routes ⇒ Object
Override to return a collection of hashes with the minimum following keys:
+:path+ - the relative path (i.e. the endpoint)
+:controller+ - the managing controller
+:action+ - the managing action
+:http_method+ - an array of the HTTP methods this route is available on.
47 48 49 |
# File 'lib/brainstem/api_docs/introspectors/abstract_introspector.rb', line 47 def routes raise NotImplementedError end |
#valid? ⇒ Boolean
Provides both a sanity check to ensure that output confirms to interface and also confirms that there is actually something to generate docs for.
57 58 59 |
# File 'lib/brainstem/api_docs/introspectors/abstract_introspector.rb', line 57 def valid? valid_controllers? && valid_presenters? && valid_routes? end |
#valid_options ⇒ Object
9 10 11 |
# File 'lib/brainstem/api_docs/introspectors/abstract_introspector.rb', line 9 def [ ] end |