Code Monkey home page Code Monkey logo

family-tree's Introduction

family-tree

Steps to execute

  • extract the file
  • cd family_tree
  • bundle install
  • ruby src/input_processor.rb input.txt

To run tests

  • cd family_tree
  • cd spec
  • rspec create_initial_family_spec.rb
  • rspec family_tree_spec.rb

Description about each class

  • input.txt => contains sample input commands as mentioned in the question
  • basic_family.txt => contains input commands to create initial family try as given in the question
  • CreateInitialFamily => has functions that allows us to create an initial family tree as given in the question
  • FamilyTree => has functions that adds a child and gets all members as per the relationship
  • InputProcessor => is a main class which takes input validates it and passes it to responsible functions

Changes made in this submission

  • Removed duplication of code
    • earlier: had seperate methods for getting brother_in_laws and sister_in_laws

    • in this version modified to have a single method siblings_in_law

    • earlier - had seperate methods for getting daughters and sons

    • in this version- modified to have single method get_children

  • Renamed few class names and methods names
  • Moved creation of seed data to an input file and a method
  • Moved some methods to private scope
  • Created constant for Gender in family_tree. This helps us to know the types of genders present and helps in easy modifications/ additions in future.

family-tree's People

Contributors

praneethaml avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.