Skip to content

Commit dbf2553

Browse files
authored
Merge pull request #12 from ArkieCoder/morelessons
adding more lessons
2 parents 4576ed0 + e4d7fe6 commit dbf2553

File tree

20 files changed

+317
-8
lines changed

20 files changed

+317
-8
lines changed

AGENTS.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,26 @@
11
## Ruby Primer Agent Instructions
22

3+
### Installation
4+
5+
- **Prerequisites**: Ruby 3.2+, pandoc, xelatex, imagemagick, viu, IBM Plex Serif Light font.
6+
- **Setup**: Run `./install.sh` to install Ruby gems, utilities, and configure the app.
7+
38
### Build, Lint, and Test
49

10+
- **Ruby Version**: Requires Ruby 3.2 or higher.
511
- **Testing**: This project uses RSpec.
612
- Run all tests: `bundle exec rspec`
713
- Run a single test file: `bundle exec rspec examples_spec/0.0.2.rb`
814
- **Linting**: There is no linting configuration. Please adhere to the style of existing code.
15+
- **CI**: GitHub Actions run Ruby and JSON syntax checks on pull requests (`.github/workflows/ruby-syntax.yml` and `json-syntax.yml`). Checks run on all PRs and validate `.rb` files, `rp`, and `.json` files using `ruby -c` and `jq`.
916

1017
### Code Style
1118

1219
- **Formatting**: Use 2-space indentation.
1320
- **Naming**: Use `snake_case` for variables and methods.
1421
- **Strings**: Use double quotes for strings, especially with interpolation. Use single quotes for `require` statements.
1522
- **Methods**: Use parentheses for method definitions with arguments.
16-
- **Error Handling**: Not specified.
1723
- **Imports**: Use `require`.
1824
- **Types**: Not specified.
25+
- **Terminal Support**: Check for minimum 135 columns x 40 rows at startup. Detect Kitty or iTerm2 for image display; generate PDFs/PNGs for formatted text.
1926
- **General**: Follow existing patterns in the code. Explicit `return` is preferred.

examples/4.0.0.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
restaurant_menu = # Fill the hash here.

examples/4.0.1.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
restaurant_menu = {
2+
"Ramen" => 3,
3+
"Dal Makhani" => 4,
4+
"Tea" => 2
5+
}
6+
## how do you use restaurant_menu to get the price of Ramen?

examples/4.0.2.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
restaurant_menu = {}

examples/4.1.0.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
restaurant_menu = {"Ramen" => 3, "Dal Makhani" => 4, "Coffee" => 2}
2+
restaurant_menu.each do |item, price|
3+
puts "#{item}: $#{price}"
4+
end
5+
restaurant_menu

examples/4.1.1.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
restaurant_menu = {"Ramen" => 3, "Dal Makhani" => 4, "Coffee" => 2}

examples/4.1.2.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
restaurant_menu = {"Ramen" => 3, "Dal Makhani" => 4, "Coffee" => 2}

examples/4.1.3.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
normal = Hash.new
2+
was_not_there = normal[:zig]
3+
puts "Wasn't there:"
4+
p was_not_there
5+
6+
usually_brown = Hash.new("brown")
7+
pretending_to_be_there = usually_brown[:zig]
8+
puts "Pretending to be there:"
9+
p pretending_to_be_there

examples/4.1.4.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
chuck_norris = Hash[:punch, 99, :kick, 98, :stops_bullets_with_hands, true]
2+
p chuck_norris

examples/4.1.5.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
def artax
2+
a = [:punch, 0]
3+
b = [:kick, 72]
4+
c = [:stops_bullets_with_hands, false]
5+
key_value_pairs = # you can do this. you are a champion.
6+
# unlike Artax, who gave up in a swamp.
7+
Hash[key_value_pairs]
8+
end
9+
artax

0 commit comments

Comments
 (0)