Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Latest commit

 

History

History
60 lines (43 loc) · 1.89 KB

CONTRIBUTING.md

File metadata and controls

60 lines (43 loc) · 1.89 KB

GurmukhiUtils Project Structure

This project follows a standard Ruby gem structure. Here's a brief overview of the main directories and files:

  • lib/: Contains the main source code for the GurmukhiUtils gem.
    • gurmukhi_utils.rb: The main entry point for the gem. This file requires all other necessary files.
    • <feature>.rb files: Each additional file in this directory represents a specific feature/module of the gem.
  • spec/: Contains the RSpec test files for the gem. Test files should be placed in this directory, following the naming convention lib/<feature>_spec.rb.
  • Gemfile: Specifies the gem dependencies for development and testing.
  • Gemfile.lock: Generated by Bundler, this file contains the exact gem versions and their dependencies used in the project.
  • gurmukhi_utils.gemspec: The gem specification file, which provides information about the gem. We need this to publish and release the gem.

Adding New Features to GurmukhiUtils

To add a new feature to GurmukhiUtils, follow these steps:

Step 1. Create a new file in the lib/ directory for the new feature, and place the new functionality within the GurmukhiUtils module.

For example, if you want to create an ascii method, create a new file called ascii.rb:

# lib/ascii.rb

module GurmukhiUtils
  def self.helpers
    # ...
  end

  def self.other_methods
    # ...
  end

  def self.ascii
    # ...
  end
end

Step 2. Update the lib/gurmukhi_utils.rb file to require the new feature file using require_relative:

# lib/gurmukhi_utils.rb

require_relative 'gurmukhi_utils/version'
require_relative 'unicode'
require_relative 'ascii' # Add this line for the new feature

Step 3. Test the feature

Write tests for the new feature in the spec directory.

You can also use irb and do:

001 > require_relative "lib/gurmukhi_utils"
 => true
002 > GurmukhiUtils.ascii("...")
 => "..."