Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nasa_rovers

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nasa_rovers

  • 1.0.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Table of Contents

  • Scope
  • Design
  • Usage

Scope

This gem is the Ruby implementation of the for the NASA rovers code kata.

Design

Footprint

The code keeps a minimal footprint, relying on standard library only and reducing it to its minimum (i.e. optparse was overkill for the simple CLI interface).

SRP

The code design follows the single responsibility principle by using a dedicated class for any specific task.

Test

The code is covered by fast, isolated unit testing, implemented by minitest spec (a standard, faster and as same as powerful alternative to rspec).
To run tests just execute rake:

bundle exec rake
Run options: --seed 4303

# Running:

.....................

Finished in 0.004475s, 4692.7374 runs/s, 7374.3017 assertions/s.

Usage

Library

Just execute the bundle console command and pass an array of instructions to the Rover.instruct method:

nasa_data = ["5 5", "1 2 N", "LMLMLMLMM", "3 3 E", "MMRMMRMRRM"]
puts NasaRovers::Rover.instruct(nasa_data)
#1 3 N
#5 1 E
#=> nil

CLI

The library provides a CLI interface via the nasa_rovers command from the terminal.

Help

You can print CLI help by:

$ ./bin/nasa_rovers -h
Usage: nasa_rovers ./nasa_data.txt
    -h --help               Print this help
    <path-to-file>          Instruct rovers with NASA data
Input

The program accepts as input a file containing the NASA data (for more info check ``SUMMARY.md`)

# ./nasa_data.txt
5 5
1 2 N
LMLMLMLMM
3 3 E
MMRMMRMRRM

Just pass the file path to the program:

$ ./bin/nasa_rovers ./nasa_data.txt
1 3 N
5 1 E

FAQs

Package last updated on 11 Dec 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc