Sha256: f91d98f09fe0a37d916627c4df2334ec9b107a2535ecbadfe81e0c40c07d18d4
Contents?: true
Size: 435 Bytes
Versions: 17
Compression:
Stored size: 435 Bytes
Contents
class Class # TODO: Check for arity def forward_methods(*methods, object) for method in Array(methods).flatten if method.to_s.end_with?("=") src = "def #{method}(args) raise if #{object}.nil?; #{object}.#{method}(args) end" else src = "def #{method}(*args) #{object}&.#{method}(*args) end" end class_eval(src) end end def forward_method(*args) forward_methods(*args) end end
Version data entries
17 entries across 17 versions & 1 rubygems