Class: MatchExpr
- Inherits:
-
Object
- Object
- MatchExpr
- Defined in:
- lib/code_generator.rb
Instance Method Summary collapse
- #convert_wildcard(str) ⇒ Object
- #gen ⇒ Object
-
#initialize(e1, e2) ⇒ MatchExpr
constructor
A new instance of MatchExpr.
Constructor Details
#initialize(e1, e2) ⇒ MatchExpr
Returns a new instance of MatchExpr.
230 231 232 233 |
# File 'lib/code_generator.rb', line 230 def initialize e1, e2 @e1 = e1 @e2 = e2 end |
Instance Method Details
#convert_wildcard(str) ⇒ Object
235 236 237 |
# File 'lib/code_generator.rb', line 235 def convert_wildcard str str.gsub(/%/, '.*') end |
#gen ⇒ Object
239 240 241 242 |
# File 'lib/code_generator.rb', line 239 def gen #raise "RHS: #{@e2.class} #{@e2.gen.class}" "#{@e1.gen} =~ /#{convert_wildcard @e2.gen}/" end |