Giter Club home page Giter Club logo

zinc's Introduction

Zinc Challenge

Part 1 - cli_macbeth file completes the task. Run ruby bin/run.rb. To run the tests ruby spec/macbethLines.rb.

Used VCR on tests to avoid calling the ibiblio server.

Part 2 & 3 - Created rails application. This is rails_macbeth. Migrate the database and then start the server. Models include version, character, and line_count. Line_count belongs to character and version. To query for character lines in a specific version would just do character.line_counts.find_by(version: version).

Doing it this way allowed me to avoid new instances of version class for each character or new instances of character class for each version (if wanted a belongs to relationship between them).

I thought about a rake task to input the data into the DB but the instructions seemed to ask for it to come from user input.

The home page offers links to either look at all versions (version index page), add a version (input 'http://www.ibiblio.org/xml/examples/shakespeare/macbeth.xml' to do this), or see the latest versions show page. The show page includes the table and chart (using chartkick) showing line count by character. I use a service model (app/services/analyzer) to handle the parsing and saving to DB.

The version model includes a method to extract a hash of character name and line count for all characters and a method to do this for just the characters with the 5 largest line counts for the index page. Both are sorted.

Looking forward to discussing.

zinc's People

Contributors

craigschiff 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.