mattn / mruby-onig-regexp

mrbgem of 鬼雲's Regular Expression
31 stars 36 forks source link

Delegate to core if not mrb_onig_regexp_type #59

Closed ksss closed 7 years ago

ksss commented 7 years ago
o = Object.new
def o.to_str
  " "
end
"Hello, world!".sub(o, "-")
# Expect(CRuby) => "Hello,-world!"
# Actual => wrong argument type Object (expected Data) (TypeError)

I think, it's more good that mruby-onig-regexp's methods delegate to cores if args are all none OnigRegexp objects instead of string. Then, I think conversion using to_str is core work.

mattn commented 7 years ago

Thank you