Class: Korekto::Syntax
- Inherits:
-
Object
- Object
- Korekto::Syntax
- Defined in:
- lib/korekto/syntax.rb
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize ⇒ Syntax
constructor
A new instance of Syntax.
- #push(s) ⇒ Object
Constructor Details
#initialize ⇒ Syntax
Returns a new instance of Syntax.
3 |
# File 'lib/korekto/syntax.rb', line 3 def initialize = @a=[] |
Instance Method Details
#each ⇒ Object
4 |
# File 'lib/korekto/syntax.rb', line 4 def each = @a.each{|s| yield s} |
#push(s) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/korekto/syntax.rb', line 6 def push(s) # ensure it'll eval on string and returns boolean b = ''.instance_eval(s) raise Error, 'syntax rule must eval boolean' unless b==!!b @a.push(s) rescue raise Error, "#{$!.class}: #{s}" end |