Class: SupportTableData::Documentation::YardDoc
- Inherits:
-
Object
- Object
- SupportTableData::Documentation::YardDoc
- Defined in:
- lib/support_table_data/documentation/yard_doc.rb
Instance Method Summary collapse
-
#attribute_helper_yard_doc(name, attribute_name) ⇒ String
Generate YARD documentation comment for the attribute method helper for the named instance.
-
#initialize(klass) ⇒ YardDoc
constructor
A new instance of YardDoc.
-
#instance_helper_yard_doc(name) ⇒ String
Generate YARD documentation comment for named instance singleton method.
-
#named_instance_yard_docs ⇒ String?
Generate YARD documentation class definition for the model’s helper methods.
-
#predicate_helper_yard_doc(name) ⇒ String
Generate YARD documentation comment for the predicate method for the named instance.
Constructor Details
#initialize(klass) ⇒ YardDoc
Returns a new instance of YardDoc.
7 8 9 |
# File 'lib/support_table_data/documentation/yard_doc.rb', line 7 def initialize(klass) @klass = klass end |
Instance Method Details
#attribute_helper_yard_doc(name, attribute_name) ⇒ String
Generate YARD documentation comment for the attribute method helper for the named instance.
52 53 54 55 56 57 58 59 60 61 |
# File 'lib/support_table_data/documentation/yard_doc.rb', line 52 def attribute_helper_yard_doc(name, attribute_name) <<~YARD.chomp("\n") # Get the #{attribute_name} attribute from the data file # for the named instance +#{name}+. # # @!method self.#{name}_#{attribute_name} # @return [Object] # @!visibility public YARD end |
#instance_helper_yard_doc(name) ⇒ String
Generate YARD documentation comment for named instance singleton method.
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/support_table_data/documentation/yard_doc.rb', line 23 def instance_helper_yard_doc(name) <<~YARD.chomp("\n") # Find the named instance +#{name}+ from the database. # # @!method self.#{name} # @return [#{klass.name}] # @raise [ActiveRecord::RecordNotFound] if the record does not exist # @!visibility public YARD end |
#named_instance_yard_docs ⇒ String?
Generate YARD documentation class definition for the model’s helper methods.
14 15 16 17 |
# File 'lib/support_table_data/documentation/yard_doc.rb', line 14 def named_instance_yard_docs instance_names = klass.instance_names generate_yard_docs(instance_names) end |
#predicate_helper_yard_doc(name) ⇒ String
Generate YARD documentation comment for the predicate method for the named instance.
38 39 40 41 42 43 44 45 46 |
# File 'lib/support_table_data/documentation/yard_doc.rb', line 38 def predicate_helper_yard_doc(name) <<~YARD.chomp("\n") # Check if this record is the named instance +#{name}+. # # @!method #{name}? # @return [Boolean] # @!visibility public YARD end |