Skip to content

Commit 150ef59

Browse files
committed
Update examples in README.md
1 parent 70dea64 commit 150ef59

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

README.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,21 +43,27 @@ require 'code_breaker'
4343

4444
code_snippet = 'crazy_number = Rational(3, 5) + 42 - Complex(2.3, 6.4) * 1.2'
4545
CodeBreaker.parse(code_snippet)
46-
# => [Rational, :+, Fixnum, :-, Complex, :*, Float]
46+
# => [:crazy_number, :'=', Rational, :+, Fixnum, :-, Complex, :*, Float]
47+
48+
code_snippet = '"hello" + "World"'
49+
CodeBreaker.parse(code_snippet)
50+
# => [String, :+, String]
4751
```
4852

4953
You can also use the Parser class directly:
5054

5155
```ruby
56+
code_snippet = '"hello" + "World"'
57+
5258
parser = CodeBreaker::Parser.new(code_snippet)
5359
parser.run
54-
# => [Rational, :+, Fixnum, :-, Complex, :*, Float]
55-
56-
parser.input
57-
# => 'crazy_number = Rational(3, 5) + 42 - Complex(2.3, 6.4) * 1.2'
60+
# => [String, :+, String]
5861

5962
parser.output
60-
# => [Rational, :+, Fixnum, :-, Complex, :*, Float]
63+
# => [String, :+, String]
64+
65+
parser.input
66+
# => "\"hello\"+\"world\""
6167
```
6268

6369
## Development

0 commit comments

Comments
 (0)