> For the complete documentation index, see [llms.txt](https://certil-remy.gitbook.io/learn/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://certil-remy.gitbook.io/learn/scraping/untitled-15.md).

# Student Example 2: Refactoring CLI Gem

## Objectives

1. Distinguish between Classes and their Instances
2. Create powerful and dynamic Scraping methods
3. Test and debug in console
4. Explain the advantages and disadvantages of the zipper pattern to combine arrays to create objects
5. Use user Input to display a specific Object

## Video

&#x20;\<iframe width="100%" height="720" src="<https://www.youtube.com/embed/Lt0oyHiKWIw?rel=0&showinfo=0>" frameborder="0" allowfullscreen>\</iframe>

## Summary

* Objects
* Class variables and properties vs instance properties
* Object orientation vs functional programming
* Fix the Scraper methods
* The Zipper pattern
* The 'Or equals' memoization
* Test in the console
* Pry and other debugging methods
* Build reload! method to reload code changes into console
* Scrape and capture properties using the zipper pattern
* Create objects with those properties
* Utilize these changes in our CLI Class
* Scrape and persist data to objects when the app starts up
* Iterate and display our Concert Objects
* Fix the menu method
* Use user input to grab appropriate Object
* Use the `Concerts.all` method to determine how many concerts we have
* `Array#count` method
* `Integer#between?` method
* Check the docs for available methods for arrays
* Find Concert with the `Concert.find` method
* Use returned Concert object to return it's attributes
* Debug and fix the 'No method' error
* Tips on building another application using these ideas
* Tips on avoiding the Zipper pattern
* Talk about the power of Object Orientation
* Think about the objects in physical space
* Think about method returns
* Figure out average length of artist names in our data
* Use iteration over Concert Objects
* Talk about `Array#collect` method
* Tips on internalizing the concepts
* Solidify concepts - move slowly!

## Code

[Original Code](https://github.com/benser1/cli-upcoming-concerts/tree/8652e5c285ca779fd2fa94f0490f726a0ec22b6f)

[Refactored Code](https://github.com/benser1/cli-upcoming-concerts)

View [OO Ruby Refactoring CLI Gem 2](https://learn.co/lessons/oo-ruby-refactoring-cli-gem-2) on Learn.co and start learning to code for free.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://certil-remy.gitbook.io/learn/scraping/untitled-15.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
