文件模块.rb
module CardExpiry
def check_expiry value
return true
end
end
文件包含.rb
#raise File.dirname(__FILE__).inspect
require "#{File.dirname(__FILE__)}/module.rb"
module Include
include CardExpiry
def self.function
raise (check_expiry 1203).inspect
end
end
打电话
Include::function
这可能吗 ?
调用时触发错误:
`function': undefined method `check_expiry' for Include:Module (NoMethodError)