Guest User

Untitled

a guest
Jul 22nd, 2018
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. def self.cross_platform_method(name)
  2. metaclass.instance_eval do
  3. define_method(name) do |*args|
  4. begin
  5. self.send("#{name}_#{os.downcase}", *args)
  6. rescue NoMethodError
  7. raise NotImplementedError.new("#{name} is not yet supported on this platform.")
  8. end
  9. end
  10. end
  11. end
Add Comment
Please, Sign In to add comment