Class: Module
- Defined in:
- lib/mumukit/core/module.rb,
lib/mumukit/core/likeability.rb,
lib/mumukit/core/modulability.rb
Instance Method Summary collapse
- #as_module ⇒ Object
- #as_module_name ⇒ Object
- #like?(other) ⇒ Boolean
- #patch(method_name, &block) ⇒ Object
- #required(name, message = nil) ⇒ Object
Instance Method Details
#as_module ⇒ Object
22 23 24 |
# File 'lib/mumukit/core/modulability.rb', line 22 def as_module self end |
#as_module_name ⇒ Object
26 27 28 |
# File 'lib/mumukit/core/modulability.rb', line 26 def as_module_name name end |
#like?(other) ⇒ Boolean
8 9 10 |
# File 'lib/mumukit/core/likeability.rb', line 8 def like?(other) super || to_s.underscore == other.to_s end |
#patch(method_name, &block) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/mumukit/core/module.rb', line 9 def patch(method_name, &block) method_proc = instance_method method_name define_method method_name do |*args| instance_exec(*args, method_proc.bind(self), &block) end end |
#required(name, message = nil) ⇒ Object
2 3 4 5 6 7 |
# File 'lib/mumukit/core/module.rb', line 2 def required(name, =nil) ||= "You need to implement method #{name}" define_method name do |*| raise end end |