Skip to content

ssaha777/string_calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

String Calculator

Overview

StringCalculator is a simple Ruby class that has a class method add which adds numbers provided as a string supporting custom delimiters, including commas and new lines, but raises exception when negative numbers are present.

Features

  • Addition of numbers provided as a string
  • Support for different delimiters (comma, new line, custom delimiter)
  • Handling of negative numbers
  • Unit tests using RSpec for ensuring correctness

Usage

To use the String Calculator, follow these steps:

  1. Clone the repository:

    git clone [email protected]:ssaha777/string_calculator.git
    
  2. Install dependencies:

    bundle install
    
  3. Run the specs:

    bundle exec rspec
    
  4. Execution of the calculator

    require_relative 'string_calculator'
    
    result = StringCalculator.add("1,2,3")
    puts result 
    

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages