Created
August 14, 2013 21:20
-
-
Save deivinsontejeda/6235765 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TestDSL < Regexp | |
def initialize(&block) | |
instance_eval &block | |
super('/some_regex/') | |
end | |
def some_method(value) | |
puts "Output: #{value}" | |
end | |
end | |
# Using previous code | |
TestDSL.new { some_method 'Hi!' } | |
# raise the follow error | |
ArgumentError: block not supplied | |
from org/jruby/RubyBasicObject.java:1709:in `instance_eval' | |
from (irb):10:in `initialize' | |
from org/jruby/RubyRegexp.java:729:in `new' | |
from (irb):17:in `evaluate' | |
from org/jruby/RubyKernel.java:1066:in `eval' | |
from org/jruby/RubyKernel.java:1409:in `loop' | |
from org/jruby/RubyKernel.java:1174:in `catch' | |
from org/jruby/RubyKernel.java:1174:in `catch' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment