Class: RpRb::Reader
- Inherits:
-
Object
- Object
- RpRb::Reader
- Defined in:
- lib/expr.rb
Instance Method Summary collapse
Instance Method Details
#read(string) ⇒ Object
36 37 38 |
# File 'lib/expr.rb', line 36 def read(string) to_stream(Parser.parse_string(string)) end |
#to_stream(ast) ⇒ Object
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/expr.rb', line 42 def to_stream(ast) case ast when Stream ast.children[0].collect { |child| to_stream(child) } when Expression, Block to_stream ast.children[0] else ast end end |