Class: Module
- Inherits:
-
Object
- Object
- Module
- Defined in:
- lib/rxsd/common.rb
Instance Method Summary collapse
-
#class_method(method_name, &block) ⇒ Object
add helper method to define a class method on any class.
-
#virtual(*methods) ⇒ Object
add virtual method support.
Instance Method Details
#class_method(method_name, &block) ⇒ Object
add helper method to define a class method on any class
55 56 57 58 59 |
# File 'lib/rxsd/common.rb', line 55 def class_method(method_name, &block) (class << self; self; end).instance_eval do define_method method_name, block end end |
#virtual(*methods) ⇒ Object
add virtual method support
46 47 48 49 50 51 52 |
# File 'lib/rxsd/common.rb', line 46 def virtual(*methods) methods.each do |m| define_method(m) { raise VirtualMethodCalledError, m } end end |