module Datacraft::MethodDef
method management
Attributes
mandatory[R]
optional[R]
Public Instance Methods
def_mandatory(*methods)
click to toggle source
# File lib/datacraft/definition.rb, line 17 def def_mandatory(*methods) @mandatory = methods methods.each do |method| def_delegator :instance, method end end
def_optional(*methods)
click to toggle source
# File lib/datacraft/definition.rb, line 24 def def_optional(*methods) @optional = methods methods.each do |method| def_delegator :instance, method end end
validate_methods(klass)
click to toggle source
# File lib/datacraft/definition.rb, line 31 def validate_methods(klass) mandatory.each do |m| fail InvalidInstruction, "Class <#{klass}> missing mandatory methods: #{m}." unless klass.method_defined?(m) end end