This guide explains the comprehensive RDoc documentation that has been added to the MixinBot gem.
# Using Rake (recommended)
rake rdoc
# Or using RDoc directly
rdoc --main README.md --title "MixinBot - Ruby SDK for Mixin Network"
# Or using YARD (alternative)
gem install yard
yard doc
yard server # Browse at http://localhost:8808After generation, open doc/index.html in your browser:
# macOS
open doc/index.html
# Linux
xdg-open doc/index.html
# Windows
start doc/index.htmlAll documentation follows Ruby community conventions and RDoc format:
##
# Brief one-line description.
#
# Detailed description with multiple paragraphs.
#
# == Sections
#
# [Term] Description
#
# == Examples
#
# code_example
# # => result
#
module/class Name##
# Brief description of what the method does.
#
# Longer description with details about behavior,
# edge cases, and important notes.
#
# @param param_name [Type] description of parameter
# @option kwargs [Type] :key description of option
# @return [Type] description of return value
# @raise [ExceptionClass] when exception occurs
#
# @example Basic usage
# result = method_name(param)
# puts result
#
# @see RelatedClass#method
# @see https://example.com/docs
#
def method_name(param, **kwargs)-
MixinBot Module (
lib/mixin_bot.rb)- Complete module documentation
- Installation and setup guide
- Quick start examples
- Error handling patterns
- All module-level methods
- All error classes
-
MixinBot::API (
lib/mixin_bot/api.rb)- Comprehensive API overview
- All initialization options
- Usage patterns (global vs. instance)
- Key methods with examples
- API categorization
-
MixinBot::Configuration (
lib/mixin_bot/configuration.rb)- Configuration options
- Key management and conversion
- Validation methods
- Usage examples
-
MixinBot::Client (
lib/mixin_bot/client.rb)- HTTP client documentation
- Error handling
- Request/response flow
- Authentication details
-
MixinBot::UUID (
lib/mixin_bot/uuid.rb)- UUID format conversions
- All methods with examples
- Usage patterns
-
MixinBot::Utils (
lib/mixin_bot/utils.rb)- Utility module overview
- Sub-modules description
- Common use cases
-
MixinBot::Utils::Crypto (
lib/mixin_bot/utils/crypto.rb)- Cryptographic operations
- Key generation
- Token authentication
- UUID operations
- Signing and encryption
-
API Modules
MixinBot::API::Me- Profile managementMixinBot::API::Asset- Asset operationsMixinBot::API::Transfer- Transfer operations
-
MVM Module (
lib/mvm.rb)- MVM overview
- Components description
- Usage examples
-
MVM Components
MVM::Bridge- Cross-chain operationsMVM::Client- HTTP client
Every public interface is documented with:
- Purpose: What it does
- Parameters: Types and descriptions
- Return Values: Type and structure
- Examples: Real-world usage
- Exceptions: Error conditions
- Related Links: Cross-references
# Simple example
api.me
# => { "user_id" => "...", "full_name" => "..." }
# Complex example with error handling
begin
result = api.create_transfer(
members: 'recipient-id',
asset_id: 'asset-id',
amount: '0.01',
memo: 'Payment'
)
puts result['snapshot_id']
rescue MixinBot::InsufficientBalanceError => e
puts "Insufficient balance: #{e.message}"
endDocumentation is organized by:
- Modules: Top-level namespaces
- Classes: Core functionality
- Methods: Individual operations
- Examples: Usage patterns
- Errors: Exception handling
Links between related components:
# @see MixinBot::API#create_transfer
# @see https://developers.mixin.one/docs/api/transfer- Start with the main module: Read
MixinBotmodule documentation - Explore by use case: Find your operation (transfers, messaging, etc.)
- Check examples: Every method has usage examples
- Handle errors: See error class documentation
- Refer to API docs: Links to Mixin Network documentation
- Document all public methods: No exceptions
- Include examples: At least one per method
- Specify types: Use
[Type]notation - Explain edge cases: Document special behaviors
- Cross-reference: Link to related functionality
- Update module docs: When adding new features
# = Level 1 (Document Title)
# == Level 2 (Major Section)
# === Level 3 (Subsection)# Bulleted list:
# - Item 1
# - Item 2
#
# Numbered list:
# 1. First
# 2. Second
#
# Definition list:
# [Term] Definition# Inline code: +code+
# Code block (indented):
# code_here
# more_code# External: {Link Text}[https://example.com]
# Internal: ClassName#method_name
# See also: @see ClassName#method# *bold*
# _italic_
# +code+##
# @param name [String] the user name
# @option opts [Integer] :age (18) the user age
# @return [Hash] user information
# @raise [ArgumentError] if name is invalid
# @example
# create_user("John", age: 25)
# @see User
# @since 1.0.0
# @deprecated Use #new_method instead##
# This method is documented.
def public_method
end
# :nodoc:
# This method is not included in docs.
def internal_method
end# Rakefile
RDoc::Task.new do |rdoc|
rdoc.main = 'README.md'
rdoc.rdoc_dir = 'doc'
rdoc.title = 'MixinBot Documentation'
rdoc.options << '--line-numbers'
rdoc.options << '--charset=UTF-8'
rdoc.options << '--all' # Include private methods
rdoc.rdoc_files.include('lib/**/*.rb', 'README.md')
end# Basic
rdoc
# With options
rdoc --main README.md \
--title "MixinBot" \
--line-numbers \
--output doc \
lib/**/*.rb README.md
# Specific files only
rdoc lib/mixin_bot.rb lib/mixin_bot/api.rb# Generate and open
rake rdoc
open doc/index.html# Using YARD
yard server
# Using RDoc (via gem server)
gem server
# Visit http://localhost:8808When published to RubyGems.org, documentation is automatically available at:
https://www.rubydoc.info/gems/mixin_bot
When modifying code:
- ✅ Update method documentation
- ✅ Update examples if API changes
- ✅ Update class overview if behavior changes
- ✅ Regenerate documentation:
rake rdoc - ✅ Review changes in browser
- All public methods documented
- Parameters and return values described
- At least one example per method
- Error conditions documented
- Cross-references added
- Examples tested and working
- Typos checked
- Links valid
##
# = ModuleName
#
# Brief overview in one sentence.
#
# == Detailed Description
#
# Multiple paragraphs explaining the module's purpose,
# key concepts, and overall architecture.
#
# == Usage
#
# basic_example
# # => result
#
# == Key Concepts
#
# [Concept 1] Explanation
# [Concept 2] Explanation
#
module ModuleName##
# Brief description of the method.
#
# Detailed explanation of what the method does,
# including edge cases and important behaviors.
#
# @param name [String] the name parameter
# @param age [Integer] the age parameter
# @param opts [Hash] optional parameters
# @option opts [String] :city the city name
# @option opts [String] :country the country code
# @return [Hash] the result hash containing:
# - name: the provided name
# - age: the provided age
# - location: the combined location
# @raise [ArgumentError] if age is negative
#
# @example Simple usage
# result = process("John", 25)
# # => { name: "John", age: 25 }
#
# @example With options
# result = process("John", 25, city: "NYC", country: "US")
# # => { name: "John", age: 25, location: "NYC, US" }
#
def process(name, age, **opts)✅ Comprehensive RDoc documentation added ✅ Follows Ruby community standards ✅ Rich examples and usage patterns ✅ Clear structure and organization ✅ Easy to generate and browse ✅ Maintainable and extensible
The MixinBot gem now has production-ready documentation following the Ruby way!